import{d as K,n as M,r as T,f as Q,s as $,h as c,c as w,a as r,F as V,G as C,A as F,t as u,y as v,z as x,u as p,N as n,e as i,w as d,i as g,R as Z,B as R,I,a4 as E,U as ee,W as te,E as ae,X as le,as as oe,aF as se,Y as ne,aa as ie,_ as pe}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css */import{b as re,c as de,d as ue}from"./diy-aa30030c.js";const me={class:"flex flex-wrap"},ce={class:"absolute top-[46px] left-[50%] translate-x-[-50%] text-[14px] truncate w-[130px] text-center"},fe={class:"w-[282px] h-[493px] mx-auto"},_e=["id","src"],ge={class:"w-[282px] h-[493px] mx-auto bg-body pt-[20px] px-[20px]"},ve={class:"font-bold text-xl mb-[40px]"},xe={class:"mb-[20px] flex flex-col"},we={class:"mb-[10px]"},ye={class:"flex"},he={class:"overflow-hidden w-[282px] h-[493px] mx-auto"},be=["src"],De={class:"text-[12px] text-[#999] mt-[10px] mx-auto truncate text-center w-[250px]"},Pe={class:"item-btn-box absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] flex flex-col flex-wrap"},Ve={class:"text-primary px-[5px]"},ke={class:"mt-[10px]"},Te={class:"dialog-footer"},Ce=K({__name:"index",setup(Ie){const l=M({}),b=T(!1),U=Q(),m=T("template"),D=T(""),t=M({type:"",name:"",mode:"",template:"",id:"",page:"",title:"",action:""}),B=()=>{t.type="",t.name="",t.mode="",t.template="",t.id="",t.page="",t.title="",t.action="",re({}).then(a=>{for(const e in a.data)l[e]=a.data[e];for(const e in l)l[e].use_template.url&&(l[e].loadingIframe=!1,l[e].loadingDev=!1,l[e].isDisabledPop=!1,l[e].difference=0,D.value=l[e].domain_url.wap_domain,l[e].wapUrl=l[e].domain_url.wap_url,L(e))})};B(),window.addEventListener("message",a=>{try{const e=JSON.parse(a.data);if(["appOnLaunch","appOnReady"].indexOf(e.type)!=-1)for(const s in l){l[s].loadingDev=!1,l[s].loadingIframe=!0;const _=new Date().getTime();l[s].difference=_-l[s].timeIframe,l[s].isDisabledPop=!1}}catch(e){for(const s in l)N(s);console.log("后台接受数据错误",e)}},!1);const S=a=>{const e=JSON.stringify({type:"appOnReady",message:"加载完成"});window["previewIframe_"+a]&&window["previewIframe_"+a].contentWindow.postMessage(e,"*")},N=a=>{l[a].loadingDev=!0,l[a].isDisabledPop=!0,l[a].loadingIframe=!1},q=()=>{if(D.value.trim().length==0){E({type:"warning",message:`${n("wapDomainPlaceholder")}`});return}const a=D.value+"/wap";ee.set({key:"wap_domain",data:a});for(const e in l)l[e].use_template.url&&(l[e].wapUrl=a,L(e));setTimeout(()=>{for(const e in l)l[e].use_template.url&&(l[e].loadingIframe=!0,l[e].loadingDev=!1,l[e].isDisabledPop=!1)},100*3)},z=()=>{window.open("https://www.kancloud.cn/niucloud/niucloud-admin-develop/3213393")},L=a=>{l[a].use_template.wapPreview=l[a].wapUrl+l[a].use_template.url,l[a].timeIframe=new Date().getTime(),S(a),setTimeout(()=>{l[a].difference==0&&N(a)},1e3*2)},A=(a,e)=>{b.value=!0,m.value=e.use_template.hope,t.type=a,t.name=e.use_template.name,t.mode=e.use_template.mode,t.action=e.use_template.action,m.value=="template"?t.template=e.use_template.template:m.value=="diy"?t.id=e.use_template.id:m.value=="other"&&(t.page=e.use_template.page,t.title=e.use_template.title)},J=a=>{const e={back:"/site/diy/index"};a.id?e.id=a.id:a.name?e.name=a.name:a.url&&(e.url=a.url);const s=U.resolve({path:"/decorate/edit",query:e});window.open(s.href)},W=a=>{let e=a.page;a.url?e=a.url:a.id&&(e+="?id="+a.id);const s=U.resolve({path:"/preview/wap",query:{page:e}});window.open(s.href)},j=a=>{const e=U.resolve({path:"/diy/list"});window.open(e.href)},G=()=>{de({type:t.type}).then(a=>{let e=!0;for(let s=0;sm.value,(a,e)=>{a=="template"?(t.id="",t.page="",t.action="decorate",t.name=t.type):a=="diy"?(t.mode="diy",t.template="",t.page="",t.action="decorate",t.name=t.type):a=="other"&&(t.mode="other",t.template="",t.id="")}),$(()=>t.template,(a,e)=>{a&&(t.mode=l[t.type].template[a].mode)}),$(()=>t.page,(a,e)=>{if(a){for(let s=0;s{if(m.value=="template"){if(t.template==""){E({type:"warning",message:`${n("placeholderTemplate")}`});return}}else if(m.value=="diy"){if(t.id==""){E({type:"warning",message:`${n("placeholderMyPage")}`});return}}else if(m.value=="other"&&t.page==""){E({type:"warning",message:`${n("placeholderOtherPage")}`});return}O.value||(O.value=!0,ue({...t}).then(a=>{O.value=!1,b.value=!1,B()}))};return(a,e)=>{const s=te,_=ae,P=le,y=oe,k=se,Y=ne,H=ie;return c(),w(V,null,[r("div",me,[(c(!0),w(V,null,C(l,(o,f)=>(c(),w("div",{class:F(["page-item relative bg-no-repeat ml-[20px] mr-[40px] mt-[20px] bg-[#f7f7f7] w-[300px] pt-[80px] pb-[20px]",{"cursor-pointer":!o.isDisabledPop}]),key:f},[r("p",ce,u(o.use_template.title),1),v(r("div",fe,[v(r("iframe",{id:"previewIframe_"+f,class:"w-[282px] h-[493px] mx-auto",src:o.use_template.wapPreview,frameborder:"0"},null,8,_e),[[x,o.loadingIframe]]),v(r("div",ge,[r("div",ve,u(p(n)("developTitle")),1),r("div",xe,[r("text",we,u(p(n)("wapDomain")),1),i(s,{modelValue:D.value,"onUpdate:modelValue":e[0]||(e[0]=h=>D.value=h),placeholder:p(n)("wapDomainPlaceholder"),clearable:""},null,8,["modelValue","placeholder"])]),r("div",ye,[i(_,{type:"primary",onClick:e[1]||(e[1]=h=>q())},{default:d(()=>[g(u(p(n)("confirm")),1)]),_:1}),i(_,{type:"primary",onClick:e[2]||(e[2]=h=>z()),plain:""},{default:d(()=>[g(u(p(n)("settingTips")),1)]),_:1})])],512),[[x,o.loadingDev]])],512),[[x,o.use_template.url]]),v(r("div",he,[o.use_template.cover?(c(),w("img",{key:0,class:"max-w-full",src:p(Z)(o.use_template.cover)},null,8,be)):R("",!0)],512),[[x,!o.use_template.wapPreview]]),r("p",De,u(o.use_template.desc),1),r("div",{class:F(["item-hide absolute inset-x-0 inset-y-0 bg-black bg-opacity-50 text-center",{disabled:o.isDisabledPop}])},[r("div",Pe,[i(_,{onClick:h=>A(f,o)},{default:d(()=>[g(u(p(n)("changePage")),1)]),_:2},1032,["onClick"]),v(i(_,{onClick:h=>J(o.use_template)},{default:d(()=>[g(u(p(n)("decorate")),1)]),_:2},1032,["onClick"]),[[x,o.use_template.mode!="other"||o.use_template.action=="decorate"]]),i(_,{onClick:h=>W(o.use_template)},{default:d(()=>[g(u(p(n)("preview")),1)]),_:2},1032,["onClick"])])],2)],2))),128))]),i(H,{modelValue:b.value,"onUpdate:modelValue":e[8]||(e[8]=o=>b.value=o),title:p(n)("changeTemplate"),width:"400px","close-on-press-escape":!1,"destroy-on-close":!0,"close-on-click-modal":!1},{footer:d(()=>[r("span",Te,[i(_,{onClick:e[7]||(e[7]=o=>b.value=!1)},{default:d(()=>[g(u(p(n)("cancel")),1)]),_:1}),i(_,{type:"primary",onClick:X},{default:d(()=>[g(u(p(n)("confirm")),1)]),_:1})])]),default:d(()=>[t.type?(c(),I(Y,{key:0,model:a.form,"label-width":"0px"},{default:d(()=>[i(P,{label:""},{default:d(()=>[r("div",null,[g(u(p(n)("hopeBeforeTip")),1),r("span",Ve,u(l[t.type].title),1),g(u(p(n)("hopeAfterTip")),1)])]),_:1}),i(P,{label:""},{default:d(()=>[i(k,{modelValue:m.value,"onUpdate:modelValue":e[3]||(e[3]=o=>m.value=o),class:"w-full"},{default:d(()=>[i(y,{label:p(n)("changeTemplateTip")+" "+l[t.type].title+" "+p(n)("template"),value:"template"},null,8,["label"]),i(y,{label:p(n)("changeMyPageTip")+" "+l[t.type].title,value:"diy"},null,8,["label"]),i(y,{label:p(n)("changeOtherPageTip")+" "+l[t.type].title,value:"other"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1}),v(i(P,{label:""},{default:d(()=>[i(k,{modelValue:t.template,"onUpdate:modelValue":e[4]||(e[4]=o=>t.template=o),class:"w-full"},{default:d(()=>[(c(!0),w(V,null,C(l[t.type].template,(o,f)=>(c(),I(y,{label:o.title,value:f,key:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},512),[[x,m.value=="template"]]),v(i(P,{label:""},{default:d(()=>[i(k,{modelValue:t.id,"onUpdate:modelValue":e[5]||(e[5]=o=>t.id=o),class:"w-full"},{default:d(()=>[(c(!0),w(V,null,C(l[t.type].my_page,(o,f)=>(c(),I(y,{label:o.title,value:o.id,key:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),r("div",ke,[r("span",{class:"cursor-pointer text-primary mr-[10px]",onClick:j},u(p(n)("createPage")),1),r("span",{class:"cursor-pointer text-primary",onClick:G},u(p(n)("refreshPage")),1)])]),_:1},512),[[x,m.value=="diy"]]),v(i(P,{label:""},{default:d(()=>[i(k,{modelValue:t.page,"onUpdate:modelValue":e[6]||(e[6]=o=>t.page=o),class:"w-full"},{default:d(()=>[(c(!0),w(V,null,C(l[t.type].other_page,(o,f)=>(c(),I(y,{label:o.title,value:o.page,key:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},512),[[x,m.value=="other"]])]),_:1},8,["model"])):R("",!0)]),_:1},8,["modelValue","title"])],64)}}});const ze=pe(Ce,[["__scopeId","data-v-d8961a6c"]]);export{ze as default};