全栈小学生 478de477c8 update admin
2023-07-01 18:29:33 +08:00

2 lines
5.5 KiB
JavaScript

import{g as F,r as f,m as l,n as r,q as t,a1 as h,F as v,I as b,J as y,v as M,L as k,E as S,K as P,u as W,by as q,bz as J}from"./base-45eb5090.js";/* empty css *//* empty css *//* empty css */import{C as K}from"./index-341914e3.js";import{d as $,v as w}from"./event-4977bef7.js";import{t as m}from"./index-047041cb.js";import{b as O,c as R}from"./wechat-fefb3d48.js";import{_ as z}from"./menu-form.vue_vue_type_script_setup_true_lang-573797f8.js";import{E as A}from"./index-0d830c44.js";import{a as G}from"./index-aef37b98.js";import{E as H}from"./index-fc3020f4.js";import{E as Q}from"./index-25c37860.js";import{v as U}from"./directive-9f485fe5.js";import{_ as X}from"./_plugin-vue_export-helper-c27b6911.js";import"./vue-router-fcbaaf02.js";import"./el-overlay-616d6124.js";import"./index-cd1661d3.js";import"./focus-trap-318ae2e0.js";/* empty css */import"./el-radio-2719e44c.js";import"./storage-4159d1ed.js";import"./index-9670e877.js";import"./index-4ce9333e.js";import"./index-3be486d3.js";import"./el-tooltip-58212670.js";import"./el-avatar-bc58ad46.js";import"./common-af78c857.js";import"./common-2cf17469.js";/* empty css */import"./index-c4fd4c9d.js";import"./castArray-df7eff2c.js";import"./_Uint8Array-e584e472.js";import"./_initCloneObject-983ff8c8.js";const B=x=>(q("data-v-64a2583d"),x=x(),J(),x),Y={class:"main-container"},Z={class:"flex"},ee={class:"preview-wrap w-[300px] h-[550px] mr-[16px] bg-overlay rounded-md flex flex-col justify-between"},te=B(()=>t("div",{class:"head w-full h-[70px]"},null,-1)),oe={class:"menu-list h-[70px] flex border-t border-color"},ae={class:"py-[15px]"},se={class:"flex h-full px-[10px] items-center justify-center border-r border-color"},ne={class:"flex-1 flex w-0"},le=["onClick"],re={class:"menu-name px-[10px] border-r border-color w-full leading-[40px] text-base truncate text-center"},ue=B(()=>t("div",{class:"active-shade"},null,-1)),ie={class:"sub-menu-wrap w-full bg-overlay border border-color rounded"},ce=["onClick"],de={class:"menu-name w-full text-base truncate text-center"},pe=B(()=>t("div",{class:"active-shade"},null,-1)),ve=["onClick"],me={class:"flex-1"},_e={key:1,class:"py-[20px] leading"},fe={class:"fixed-footer-wrap"},he={class:"fixed-footer"},be=F({__name:"menu",setup(x){const d=f(!0),e=f([]),a=f(0),n=f(-1),u=f(null);O().then(o=>{e.value=o.data,d.value=!1});const T=()=>{e.value.push({name:"菜单名称",type:"view",url:"",appid:"",pagepath:"",sub_button:[]}),C(e.value.length-1)},D=o=>{!e.value[o].sub_button&&(e.value[o].sub_button=[]),e.value[o].sub_button.push({name:"子菜单名称",type:"view",url:"",appid:"",pagepath:""}),E(o,e.value[o].sub_button.length-1)},C=o=>{a.value=o,n.value=-1},E=(o,i)=>{a.value=o,n.value=i},j=()=>{A.confirm(m("deleteMemuTips"),m("warning"),{confirmButtonText:m("confirm"),cancelButtonText:m("cancel"),type:"warning"}).then(()=>{n.value!=-1?(e.value[a.value].sub_button.splice(n.value,1),n.value=e.value[a.value].sub_button.length-1,n.value==-1&&Object.assign(e.value[a.value],{type:"view",url:"",appid:"",pagepath:""})):(e.value.splice(a.value,1),e.value.length&&(a.value=e.value.length-1))})},I=async()=>{if(!u.value||!u.value){G.error(m("menusEmptyTips"));return}for(let o=0;o<(u==null?void 0:u.value.length);o++){const i=u.value[o];if(!await i.validate()){a.value=i.index,n.value=i.subIndex;break}}d.value||(d.value=!0,R({button:e.value}).then(()=>{d.value=!1}).catch(()=>{d.value=!1}))};return(o,i)=>{const g=K,L=H,N=Q,V=U;return l(),r(b,null,[t("div",Y,[h((l(),r("div",Z,[t("div",ee,[te,t("div",oe,[t("div",ae,[t("div",se,[v(g,{name:"iconfont-iconjianpan",size:"20px",color:"#b1b2b3"})])]),t("div",ne,[(l(!0),r(b,null,y(e.value,(c,s)=>(l(),r("div",{class:M(["menu-item py-[15px] flex items-center justify-center cursor-pointer",{"size-1":e.value.length==1,"size-2-3":e.value.length>1,active:s==a.value,curr:s==a.value&&n.value==-1}]),key:s,onClick:_=>C(s)},[t("div",re,k(c.name),1),ue,t("div",ie,[(l(!0),r(b,null,y(c.sub_button,(_,p)=>(l(),r("div",{class:M(["menu-item h-[50px] p-[10px] border-b border-color flex items-center justify-center cursor-pointer",{curr:p==n.value}]),key:p,onClick:$(xe=>E(s,p),["stop"])},[t("div",de,k(_.name),1),pe],10,ce))),128)),h(t("div",{class:"add-menu flex items-center justify-center flex-1 cursor-pointer menu-item h-[50px]",onClick:$(_=>D(s),["stop"])},[v(g,{name:"element-Plus"})],8,ve),[[w,!c.sub_button||c.sub_button.length<5]])])],10,le))),128)),h(t("div",{class:"add-menu flex items-center justify-center flex-1 cursor-pointer menu-item",onClick:T},[v(g,{name:"element-Plus"})],512),[[w,e.value.length<3]])])])]),t("div",me,[v(L,{class:"box-card !border-none h-auto",shadow:"never"},{default:S(()=>[e.value.length?(l(!0),r(b,{key:0},y(e.value,(c,s)=>(l(),r("div",{key:s},[h(t("div",null,[v(z,{data:c,onDelete:j,index:s,ref_for:!0,ref_key:"formRef",ref:u},null,8,["data","index"])],512),[[w,s==a.value&&n.value==-1]]),(l(!0),r(b,null,y(c.sub_button,(_,p)=>(l(),r("div",{key:p},[h(t("div",null,[v(z,{data:_,onDelete:j,index:s,"sub-index":p,ref_for:!0,ref_key:"formRef",ref:u},null,8,["data","index","sub-index"])],512),[[w,s==a.value&&p==n.value]])]))),128))]))),128)):(l(),r("div",_e,"尚未添加自定义菜单,点击左侧添加菜单为公众号创建菜单栏。"))]),_:1})])])),[[V,d.value]])]),t("div",fe,[t("div",he,[v(N,{type:"primary",loading:d.value,onClick:i[0]||(i[0]=c=>I())},{default:S(()=>[P(k(W(m)("save")),1)]),_:1},8,["loading"])])])],64)}}});const et=X(be,[["__scopeId","data-v-64a2583d"]]);export{et as default};