2 lines
8.8 KiB
JavaScript
2 lines
8.8 KiB
JavaScript
|
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;s<a.data.length;s++)if(t.id==a.data[s].id){e=!1;break}e&&(t.id=""),l[t.type].my_page={},Object.assign(l[t.type].my_page,a.data)})};$(()=>m.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"
|