mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-03 03:38:12 +00:00
2 lines
9.3 KiB
JavaScript
2 lines
9.3 KiB
JavaScript
import{d as K,R as N,r as E,w as $,e as c,f as w,g as n,F as V,z as C,n as R,B as d,Q as _,u as r,y as p,x as m,A as g,H as S,v as T}from"./base-2de02574.js";import{E as X}from"./el-overlay-c29a408e.js";import{a as Y,E as Z}from"./el-form-item-aacba116.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./index-4ca69875.js";/* empty css *//* empty css */import{v}from"./event-30fa88cc.js";import{t as s}from"./index-a7cd5616.js";import{c as ee,a as te}from"./common-655c495e.js";import{a as le}from"./vue-router-834a68c8.js";import{b as ae,c as oe,d as se}from"./diy-77c4f074.js";import{a as I}from"./index-99061637.js";import{E as ie}from"./index-f34dc67c.js";import{E as pe}from"./index-84eb3c18.js";import{a as re,E as ne}from"./index-9868687d.js";import{_ as me}from"./_plugin-vue_export-helper-c27b6911.js";import"./index-fa3f6669.js";import"./index-53431221.js";import"./focus-trap-852901de.js";import"./index-a556d0d2.js";import"./index-53f4bde2.js";import"./index-29aaa146.js";import"./index-e049ae93.js";import"./el-main-e7ca7755.js";import"./index-907c8fa3.js";import"./index-389593d1.js";import"./index-9c3282b5.js";import"./index-e3e3f033.js";import"./strings-258503d1.js";import"./isEqual-aeead489.js";import"./debounce-b627eb85.js";import"./index-dfcf0976.js";import"./validator-a9a156f1.js";const de={class:"flex flex-wrap"},ue={class:"absolute top-[46px] left-[50%] translate-x-[-50%] text-[14px] truncate w-[130px] text-center"},fe={class:"w-[282px] h-[493px] mx-auto"},ce=["id","src"],_e={class:"w-[282px] h-[493px] mx-auto bg-body pt-[20px] px-[20px]"},ge={class:"font-bold text-xl mb-[40px]"},ve={class:"mb-[20px] flex flex-col"},xe={class:"mb-[10px]"},we={class:"overflow-hidden w-[282px] h-[493px] mx-auto"},ye=["src"],he={class:"text-[12px] text-[#999] mt-[10px] mx-auto truncate text-center w-[250px]"},be={class:"item-btn-box absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] flex flex-col flex-wrap"},De={class:"text-primary px-[5px]"},Pe={class:"mt-[10px]"},Ve={class:"dialog-footer"},ke=K({__name:"index",setup(Ee){const a=N({}),h=E(!1),O=le(),f=E("template"),b=E(""),t=N({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="",ae({}).then(l=>{for(let e in l.data)a[e]=l.data[e];for(let e in a)a[e].use_template.url&&(a[e].loadingIframe=!1,a[e].loadingDev=!1,a[e].isDisabledPop=!1,a[e].difference=0,b.value=a[e].domain_url.wap_domain,a[e].wapUrl=a[e].domain_url.wap_url,M(e))})};B(),window.addEventListener("message",l=>{try{let i=JSON.parse(l.data);if(["appOnLaunch","appOnReady"].indexOf(i.type)!=-1)for(let u in a){a[u].loadingDev=!1,a[u].loadingIframe=!0;var e=new Date().getTime();a[u].difference=e-a[u].timeIframe,a[u].isDisabledPop=!1}}catch(i){for(let u in a)L(u);console.log("后台接受数据错误",i)}},!1);const F=l=>{var e=JSON.stringify({type:"appOnReady",message:"加载完成"});window["previewIframe_"+l]&&window["previewIframe_"+l].contentWindow.postMessage(e,"*")},L=l=>{a[l].loadingDev=!0,a[l].isDisabledPop=!0,a[l].loadingIframe=!1},q=()=>{if(b.value.trim().length==0){I({type:"warning",message:`${s("wapDomainPlaceholder")}`});return}let l=b.value+"/wap";te.set({key:"wap_domain",data:l});for(let e in a)a[e].use_template.url&&(a[e].wapUrl=l,M(e));setTimeout(()=>{for(let e in a)a[e].use_template.url&&(a[e].loadingIframe=!0,a[e].loadingDev=!1,a[e].isDisabledPop=!1)},100*3)},M=l=>{a[l].use_template.wapPreview=a[l].wapUrl+a[l].use_template.url,a[l].timeIframe=new Date().getTime(),F(l),setTimeout(()=>{a[l].difference==0&&L(l)},1e3*2)},z=(l,e)=>{h.value=!0,f.value=e.use_template.hope,t.type=l,t.name=e.use_template.name,t.mode=e.use_template.mode,t.action=e.use_template.action,f.value=="template"?t.template=e.use_template.template:f.value=="diy"?t.id=e.use_template.id:f.value=="other"&&(t.page=e.use_template.page,t.title=e.use_template.title)},A=l=>{let e={back:"/website/diy/index"};l.id?e.id=l.id:l.name?e.name=l.name:l.url&&(e.url=l.url);let i=O.resolve({path:"/decorate/edit",query:e});window.open(i.href)},J=l=>{let e=l.page;l.url?e=l.url:l.id&&(e+="?id="+l.id);let i=O.resolve({path:"/preview/wap",query:{page:e}});window.open(i.href)},j=l=>{let e=O.resolve({path:"/website/diy/list"});window.open(e.href)},H=()=>{oe({type:t.type}).then(l=>{let e=!0;for(let i=0;i<l.data.length;i++)if(t.id==l.data[i].id){e=!1;break}e&&(t.id=""),a[t.type].my_page={},Object.assign(a[t.type].my_page,l.data)})};$(()=>f.value,(l,e)=>{l=="template"?(t.id="",t.page="",t.action="decorate",t.name=t.type):l=="diy"?(t.mode="diy",t.template="",t.page="",t.action="decorate",t.name=t.type):l=="other"&&(t.mode="other",t.template="",t.id="")}),$(()=>t.template,(l,e)=>{l&&(t.mode=a[t.type].template[l].mode)}),$(()=>t.page,(l,e)=>{if(l){for(let i=0;i<a[t.type].other_page.length;i++)if(a[t.type].other_page[i].page==l){t.name=a[t.type].other_page[i].name,t.title=a[t.type].other_page[i].title,t.action=a[t.type].other_page[i].action;break}}});const U=E(!1),Q=()=>{if(f.value=="template"){if(t.template==""){I({type:"warning",message:`${s("placeholderTemplate")}`});return}}else if(f.value=="diy"){if(t.id==""){I({type:"warning",message:`${s("placeholderMyPage")}`});return}}else if(f.value=="other"&&t.page==""){I({type:"warning",message:`${s("placeholderOtherPage")}`});return}U.value||(U.value=!0,se({...t}).then(l=>{U.value=!1,h.value=!1,B()}))};return(l,e)=>{const i=ie,u=pe,D=Y,y=re,k=ne,W=Z,G=X;return c(),w(V,null,[n("div",de,[(c(!0),w(V,null,C(a,(o,x)=>(c(),w("div",{class:R(["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:x},[n("p",ue,d(o.use_template.title),1),_(n("div",fe,[_(n("iframe",{id:"previewIframe_"+x,class:"w-[282px] h-[493px] mx-auto",src:o.use_template.wapPreview,frameborder:"0"},null,8,ce),[[v,o.loadingIframe]]),_(n("div",_e,[n("div",ge,d(r(s)("developTitle")),1),n("div",ve,[n("text",xe,d(r(s)("wapDomain")),1),p(i,{modelValue:b.value,"onUpdate:modelValue":e[0]||(e[0]=P=>b.value=P),placeholder:r(s)("wapDomainPlaceholder"),clearable:""},null,8,["modelValue","placeholder"])]),p(u,{type:"primary",onClick:e[1]||(e[1]=P=>q())},{default:m(()=>[g(d(r(s)("confirm")),1)]),_:1})],512),[[v,o.loadingDev]])],512),[[v,o.use_template.url]]),_(n("div",we,[o.use_template.cover?(c(),w("img",{key:0,class:"max-w-full",src:r(ee)(o.use_template.cover)},null,8,ye)):S("",!0)],512),[[v,!o.use_template.wapPreview]]),n("p",he,d(o.use_template.desc),1),n("div",{class:R(["item-hide absolute inset-x-0 inset-y-0 bg-black bg-opacity-50 text-center",{disabled:o.isDisabledPop}])},[n("div",be,[p(u,{onClick:P=>z(x,o)},{default:m(()=>[g(d(r(s)("changePage")),1)]),_:2},1032,["onClick"]),_(p(u,{onClick:P=>A(o.use_template)},{default:m(()=>[g(d(r(s)("decorate")),1)]),_:2},1032,["onClick"]),[[v,o.use_template.mode!="other"||o.use_template.action=="decorate"]]),p(u,{onClick:P=>J(o.use_template)},{default:m(()=>[g(d(r(s)("preview")),1)]),_:2},1032,["onClick"])])],2)],2))),128))]),p(G,{modelValue:h.value,"onUpdate:modelValue":e[7]||(e[7]=o=>h.value=o),title:r(s)("changeTemplate"),width:"400px","close-on-press-escape":!1,"destroy-on-close":!0,"close-on-click-modal":!1},{footer:m(()=>[n("span",Ve,[p(u,{onClick:e[6]||(e[6]=o=>h.value=!1)},{default:m(()=>[g(d(r(s)("cancel")),1)]),_:1}),p(u,{type:"primary",onClick:Q},{default:m(()=>[g(d(r(s)("confirm")),1)]),_:1})])]),default:m(()=>[t.type?(c(),T(W,{key:0,model:l.form,"label-width":"0px"},{default:m(()=>[p(D,{label:""},{default:m(()=>[n("div",null,[g(d(r(s)("hopeBeforeTip")),1),n("span",De,d(a[t.type].title),1),g(d(r(s)("hopeAfterTip")),1)])]),_:1}),p(D,{label:""},{default:m(()=>[p(k,{modelValue:f.value,"onUpdate:modelValue":e[2]||(e[2]=o=>f.value=o),class:"w-full"},{default:m(()=>[p(y,{label:r(s)("changeTemplateTip")+" "+a[t.type].title+" "+r(s)("template"),value:"template"},null,8,["label"]),p(y,{label:r(s)("changeMyPageTip")+" "+a[t.type].title,value:"diy"},null,8,["label"]),p(y,{label:r(s)("changeOtherPageTip")+" "+a[t.type].title,value:"other"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1}),_(p(D,{label:""},{default:m(()=>[p(k,{modelValue:t.template,"onUpdate:modelValue":e[3]||(e[3]=o=>t.template=o),class:"w-full"},{default:m(()=>[(c(!0),w(V,null,C(a[t.type].template,(o,x)=>(c(),T(y,{label:o.title,value:x},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1},512),[[v,f.value=="template"]]),_(p(D,{label:""},{default:m(()=>[p(k,{modelValue:t.id,"onUpdate:modelValue":e[4]||(e[4]=o=>t.id=o),class:"w-full"},{default:m(()=>[(c(!0),w(V,null,C(a[t.type].my_page,(o,x)=>(c(),T(y,{label:o.title,value:o.id},null,8,["label","value"]))),256))]),_:1},8,["modelValue"]),n("div",Pe,[n("span",{class:"cursor-pointer text-primary mr-[10px]",onClick:j},d(r(s)("createPage")),1),n("span",{class:"cursor-pointer text-primary",onClick:H},d(r(s)("refreshPage")),1)])]),_:1},512),[[v,f.value=="diy"]]),_(p(D,{label:""},{default:m(()=>[p(k,{modelValue:t.page,"onUpdate:modelValue":e[5]||(e[5]=o=>t.page=o),class:"w-full"},{default:m(()=>[(c(!0),w(V,null,C(a[t.type].other_page,(o,x)=>(c(),T(y,{label:o.title,value:o.page},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1},512),[[v,f.value=="other"]])]),_:1},8,["model"])):S("",!0)]),_:1},8,["modelValue","title"])],64)}}});const dt=me(ke,[["__scopeId","data-v-791ea0b0"]]);export{dt as default};
|