import{d as Q,a5 as T,b7 as W,a6 as R,r as f,p as F,c as u,e as h,f as V,h as n,i as l,u as s,k as y,A as v,dD as $,g as d,C as z,q as L,m as r,y as k}from"./index.0308b213.js";import j from"./BaseConfig.0466b450.js";import{M as H}from"./index.dfdc0704.js";import{d as X}from"./vuedraggable.umd.405b1bec.js";import{S as Y}from"./index.de7bcb5e.js";import{a as Z}from"./account.fdb98bc4.js";const ee={class:"swiper-config"},te=r("\u5426"),oe=r("\u662F"),ae=r("\u5426"),ne=r("\u662F"),le=r("\u70B9\u6211\u914D\u7F6E\u8F6E\u64AD\u56FE"),ie={class:"config__item"},se=["onClick"],ue=d("i",{class:"tn-icon-close-circle"},null,-1),de=[ue],re={class:"config__item__image"},ce={class:"config__item__page"},me=["onClick"],pe={key:0,class:"config__item--add-btn"},_e=r(" \u6DFB\u52A0\u8F6E\u64AD\u56FE "),Ve=Q({props:{config:null},emits:["update:config"],setup(A,{emit:C}){const E=A,{updateAgentInfo:S}=T(),g=W(),{OpPlatform:B}=R();let t=f({banner:[],status:0,tile:0});F(()=>E.config,e=>{e&&k(()=>{t.value.banner=e.banner||[{image:"https://qny.wdsp666.com/images/1/2023/02/KBKogGN4kfK66Gfug458o85iQiqUKg.png",url:"",id:""}],t.value.status=e.status||0,t.value.tile=e.tile||0})},{immediate:!0});const w=f(!1);(()=>{let e=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);w.value=e})();const x=f("PC"),U=e=>{if(e==0)if(B.value==="agent")window.open(g.resolve({path:"/agent/dashboard/slide"}).href);else{const o=localStorage.getItem("diy_page_agentid");o?Z(o).then(i=>{S(i).then(()=>{k(()=>{w.value?x.value=="iOS"?window.location.href=window.location.protocol+"//"+window.location.host+"/admin/agent/dashboard/slide":window.open(g.resolve({path:"/agent/dashboard/slide"}).href):window.open(g.resolve({path:"/agent/dashboard/slide"}).href)})})}):window.open(g.resolve({path:"/admin/dashboard/slide"}).href)}},N=e=>{const o=P(t.value.banner,e);o!==-1&&t.value.banner.splice(o,1)},P=(e,o)=>e.findIndex(i=>i.id===o),I=()=>{console.log(t);const e=t.value.banner.length;if(e>=5)return;let o=0;if(e>0){const i=JSON.parse(JSON.stringify(t.value.banner));i.sort((b,p)=>Number(b.id)-Number(p.id)),o=i[e-1].id}t.value.banner.push({id:Number(o)+1,image:"",url:""})};let c=f(0),m=f(!1);const D=e=>{m.value=!0;let o=t.value.banner.findIndex(i=>i.id==e);c.value=o},M=e=>{e.type==1?t.value.banner[c.value].url=e.miniProgram:e.type==2?t.value.banner[c.value].url=e.webview:e.type==3&&(t.value.banner[c.value].url=e.phone)},O=e=>{t.value.banner[c.value].url=e};return F(t.value,e=>{C("update:config",e)}),(e,o)=>{const i=u("el-radio"),b=u("el-radio-group"),p=u("el-form-item"),K=u("el-link"),q=u("el-input"),G=u("el-button"),J=u("el-form");return h(),V("div",ee,[n(j,{title:"\u8F6E\u64AD\u56FE",desc:"\u5C55\u793A\u4E3B\u8981\u4FE1\u606F"},{default:l(()=>[n(J,{"label-width":"120px"},{default:l(()=>[n(p,{label:"\u662F\u5426\u542F\u7528diy\u8F6E\u64AD\u56FE"},{default:l(()=>[n(b,{modelValue:s(t).status,"onUpdate:modelValue":o[0]||(o[0]=a=>s(t).status=a)},{default:l(()=>[n(i,{label:0},{default:l(()=>[te]),_:1}),n(i,{label:1},{default:l(()=>[oe]),_:1})]),_:1},8,["modelValue"])]),_:1}),n(p,{label:"\u662F\u5426\u542F\u7528\u5E73\u94FA\u6A21\u5F0F"},{default:l(()=>[n(b,{modelValue:s(t).tile,"onUpdate:modelValue":o[1]||(o[1]=a=>s(t).tile=a)},{default:l(()=>[n(i,{label:0},{default:l(()=>[ae]),_:1}),n(i,{label:1},{default:l(()=>[ne]),_:1})]),_:1},8,["modelValue"])]),_:1}),+s(t).status==0?(h(),y(K,{key:0,type:"primary",onClick:o[2]||(o[2]=a=>U(0))},{default:l(()=>[le]),_:1})):v("",!0),+s(t).status==1?(h(),y(p,{key:1,label:"\u8F6E\u64AD\u56FE"},{default:l(()=>[n(s(X),$({modelValue:s(t).banner,"onUpdate:modelValue":o[3]||(o[3]=a=>s(t).banner=a),"item-key":"id","component-data":{tag:"div",type:"transition-group",name:"drag-list"}},{animation:200,group:"description",disabled:!1,ghostClass:"drag-ghost"}),{item:l(({element:a})=>[d("div",ie,[d("div",{class:"config__item--close-btn",onClick:z(_=>N(a.id),["stop"])},de,8,se),d("div",re,[n(H,{modelValue:a.image,"onUpdate:modelValue":_=>a.image=_,limit:1,size:"80px"},null,8,["modelValue","onUpdate:modelValue"])]),d("div",ce,[n(q,{modelValue:a.url,"onUpdate:modelValue":_=>a.url=_},{append:l(()=>[d("div",{class:"config__item__page--btn",onClick:_=>D(a.id)},"\u9009\u62E9\u94FE\u63A5",8,me)]),_:2},1032,["modelValue","onUpdate:modelValue"])])])]),_:1},16,["modelValue"]),s(t).banner.length<5?(h(),V("div",pe,[n(G,{type:"primary",style:{width:"100%"},onClick:I},{default:l(()=>[_e]),_:1})])):v("",!0)]),_:1})):v("",!0)]),_:1})]),_:1}),n(s(Y),{modelValue:s(m),"onUpdate:modelValue":o[4]||(o[4]=a=>L(m)?m.value=a:m=a),onConfirmAll:M,onChange:O},null,8,["modelValue"])])}}});export{Ve as _};
