data_center/public/admin/assets/picker.2c9cd9c1.js

2 lines
5.4 KiB
JavaScript

import{B as F,d as G,f as H}from"./element-plus.9c2fdfa8.js";import{d as g,b as D}from"./index.b57b84f0.js";import{d as P,r as h,o as p,c as E,a as f,T as O,a7 as B,O as $,S as b,u as o,R as I,U as S,e as w,w as V,L as v,K as A,k,Q as C,s as L,Z as M}from"./@vue.53f8d7c3.js";import{P as N}from"./index.3fc23cf2.js";var u=(l=>(l.SHOP_PAGES="shop",l.CUSTOM_LINK="custom",l))(u||{});const U={class:"shop-pages"},q={class:"link-list flex flex-wrap"},K=["onClick"],R=P({__name:"shop-pages",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(l,{emit:c}){const d=c,m=h([{path:"/pages/index/index",name:"\u5546\u57CE\u9996\u9875",type:u.SHOP_PAGES},{path:"/pages/news/news",name:"\u6587\u7AE0\u8D44\u8BAF",type:u.SHOP_PAGES},{path:"/pages/user/user",name:"\u4E2A\u4EBA\u4E2D\u5FC3",type:u.SHOP_PAGES},{path:"/pages/collection/collection",name:"\u6211\u7684\u6536\u85CF",type:u.SHOP_PAGES},{path:"/pages/customer_service/customer_service",name:"\u8054\u7CFB\u5BA2\u670D",type:u.SHOP_PAGES},{path:"/pages/user_set/user_set",name:"\u4E2A\u4EBA\u8BBE\u7F6E",type:u.SHOP_PAGES},{path:"/pages/as_us/as_us",name:"\u5173\u4E8E\u6211\u4EEC",type:u.SHOP_PAGES},{path:"/pages/user_data/user_data",name:"\u4E2A\u4EBA\u8D44\u6599",type:u.SHOP_PAGES},{path:"/pages/agreement/agreement",name:"\u9690\u79C1\u653F\u7B56",query:{type:"privacy"},type:u.SHOP_PAGES},{path:"/pages/agreement/agreement",name:"\u670D\u52A1\u534F\u8BAE",query:{type:"service"},type:u.SHOP_PAGES},{path:"/pages/search/search",name:"\u641C\u7D22",type:u.SHOP_PAGES},{path:"/packages/pages/user_wallet/user_wallet",name:"\u6211\u7684\u94B1\u5305",type:u.SHOP_PAGES}]),r=a=>{d("update:modelValue",a)};return(a,n)=>(p(),E("div",U,[f("div",q,[(p(!0),E(O,null,B(o(m),(i,e)=>(p(),E("div",{class:$(["link-item border border-br px-5 py-[5px] rounded-[3px] cursor-pointer mr-[10px] mb-[10px]",{"border-primary text-primary":l.modelValue.path==i.path&&l.modelValue.name==i.name}]),key:e,onClick:t=>r(i)},b(i.name),11,K))),128))])]))}}),T={class:"custom-link mt-[30px]"},j={class:"flex flex-wrap items-center"},z={class:"ml-4 flex-1 min-w-[100px]"},Q=f("div",{class:"form-tips"}," \u8BF7\u586B\u5199\u5B8C\u6574\u7684\u5E26\u6709\u201Chttps://\u201D\u6216\u201Chttp://\u201D\u7684\u94FE\u63A5\u5730\u5740\uFF0C\u94FE\u63A5\u7684\u57DF\u540D\u5FC5\u987B\u5728\u5FAE\u4FE1\u516C\u4F17\u5E73\u53F0\u8BBE\u7F6E\u4E1A\u52A1\u57DF\u540D ",-1),Z=P({__name:"custom-link",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(l,{emit:c}){const d=c,m=r=>{d("update:modelValue",{path:"/pages/webview/webview",query:{url:r},type:u.CUSTOM_LINK})};return(r,a)=>{var i;const n=F;return p(),E("div",T,[f("div",j,[I(" \u81EA\u5B9A\u4E49\u94FE\u63A5 "),f("div",z,[S(n,{"model-value":(i=l.modelValue.query)==null?void 0:i.url,placeholder:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740",onInput:m},null,8,["model-value"])])]),Q])}}}),J={class:"link flex"},W={class:"flex-1 pl-4"},X=P({__name:"index",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(l,{emit:c}){const d=l,m=c,r=h([{name:"\u5546\u57CE\u9875\u9762",type:u.SHOP_PAGES,link:{}},{name:"\u81EA\u5B9A\u4E49\u94FE\u63A5",type:u.CUSTOM_LINK,link:{}}]),a=w({get(){var e;return(e=r.value.find(t=>t.type==n.value))==null?void 0:e.link},set(e){r.value.forEach(t=>{t.type==n.value&&(t.link=e)})}}),n=h(u.SHOP_PAGES),i=e=>{n.value=e};return V(a,e=>{!e.type||m("update:modelValue",e)}),V(()=>d.modelValue,e=>{n.value=e.type,a.value=e},{immediate:!0}),(e,t)=>{const _=G,x=H;return p(),E("div",J,[S(x,{"default-active":o(n),class:"w-[160px] min-h-[350px] link-menu",onSelect:i},{default:v(()=>[(p(!0),E(O,null,B(o(r),(s,y)=>(p(),A(_,{index:s.type,key:y},{default:v(()=>[f("span",null,b(s.name),1)]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"]),f("div",W,[o(u).SHOP_PAGES==o(n)?(p(),A(R,{key:0,modelValue:o(a),"onUpdate:modelValue":t[0]||(t[0]=s=>k(a)?a.value=s:null)},null,8,["modelValue"])):C("",!0),o(u).CUSTOM_LINK==o(n)?(p(),A(Z,{key:1,modelValue:o(a),"onUpdate:modelValue":t[1]||(t[1]=s=>k(a)?a.value=s:null)},null,8,["modelValue"])):C("",!0)])])}}});const Y=g(X,[["__scopeId","data-v-9b4140c5"]]),ee=P({__name:"picker",props:{modelValue:{type:Object},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(l,{emit:c}){const d=l,m=c,r=L(),a=h({path:"",type:u.SHOP_PAGES}),n=()=>{m("update:modelValue",a.value)},i=w(()=>{var e,t,_;switch((e=d.modelValue)==null?void 0:e.type){case u.SHOP_PAGES:return d.modelValue.name;case u.CUSTOM_LINK:return(t=d.modelValue.query)==null?void 0:t.url;default:return(_=d.modelValue)==null?void 0:_.name}});return V(()=>d.modelValue,e=>{e!=null&&e.type&&(a.value=e)},{immediate:!0}),(e,t)=>{const _=D,x=F;return p(),E("div",{class:"link-picker flex-1",onClick:t[2]||(t[2]=s=>{var y;return!l.disabled&&((y=o(r))==null?void 0:y.open())})},[S(x,{"model-value":o(i),placeholder:"\u8BF7\u9009\u62E9\u94FE\u63A5",readonly:"",disabled:l.disabled},{suffix:v(()=>{var s;return[(s=l.modelValue)!=null&&s.path?(p(),A(_,{key:1,name:"el-icon-Close",onClick:t[0]||(t[0]=M(y=>!l.disabled&&m("update:modelValue",{}),["stop"]))})):(p(),A(_,{key:0,name:"el-icon-ArrowRight"}))]}),_:1},8,["model-value","disabled"]),S(N,{ref_key:"popupRef",ref:r,width:"700px",title:"\u94FE\u63A5\u9009\u62E9",onConfirm:n},{default:v(()=>[S(Y,{modelValue:o(a),"onUpdate:modelValue":t[1]||(t[1]=s=>k(a)?a.value=s:null)},null,8,["modelValue"])]),_:1},512)])}}});const ne=g(ee,[["__scopeId","data-v-f0325f86"]]);export{ne as _};