test_lgq/niucloud/public/admin/assets/preview-d2d21aa1.js

2 lines
3.5 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{d as R,r as n,O as W,n as z,aL as M,s as O,a4 as h,N as e,h as b,c as B,y as m,z as _,a as t,t as i,u as o,e as l,w as r,i as N,I as S,R as X,B as Y,U as j,W as A,E as G,X as H,V as J,Y as K}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css *//* empty css */import{g as Q}from"./weapp-4d690662.js";import{p as Z}from"./sys-8ead7f22.js";import{b as ee}from"./browser-a1ac24ac.js";import{l as ae}from"./diy-aa30030c.js";const te={class:"main-container w-[375px] mx-auto my-[20px] relative"},oe={class:"flex h-full"},le=["src"],se={class:"w-[375px] border border-slate-100 bg-body pt-[20px] px-[20px]"},ne={class:"font-bold text-xl mb-[40px]"},re={class:"mb-[20px] flex flex-col"},pe={class:"mb-[10px]"},ie={key:0,class:"w-[400px] absolute bg-body top-[10%] -right-[450px]"},ce={class:"info-wrap mt-[20px]"},de={class:"px-[20px] pb-[10px] font-bold"},ue={class:"px-[20px] pb-[10px] font-bold mt-[40px]"},me={class:"text-gray-400"},Ce=R({__name:"preview",setup(_e){const v=n(""),d=n(""),f=n(""),p=n(""),D=n(!1),u=n(!1),x=n(!1),T=n(0);new Date().getTime();const c=W();c.query.id=c.query.id||0,c.query.name=c.query.name||"",Z().then(a=>{d.value=a.data.wap_domain,v.value=a.data.wap_url,q()});const L=()=>{if(d.value.trim().length==0){h({type:"warning",message:`${e("wapDomainPlaceholder")}`});return}v.value=d.value+"/wap",q(),j.set({key:"wap_domain",data:v.value}),u.value=!0,x.value=!1},q=()=>{ae({id:c.query.id,name:c.query.name}).then(a=>{const s=a.data;p.value=`${v.value}/${s.page}`,ee.toDataURL(p.value,{errorCorrectionLevel:"L",margin:0,width:100}).then(w=>{f.value=w})})},U=()=>{if(!p.value)return;new Date().getTime()-T.value<1e3?(x.value=!0,u.value=!1,p.value="",f.value=""):(x.value=!1,u.value=!0),D.value=!0},y=z({qr_code:""});n("weapp"),Q().then(a=>{if(a.code==1){const s=a.data;y.qr_code=s.qr_code}});const{copy:P,isSupported:$,copied:k}=M(),F=a=>{$.value||h({message:e("notSupportCopy"),type:"warning"}),P(a)};return O(k,()=>{k.value&&h({message:e("copySuccess"),type:"success"})}),(a,s)=>{const w=A,C=G,g=H,E=J,I=K;return b(),B("div",te,[m(t("div",oe,[m(t("iframe",{class:"w-[375px] border border-slate-100 bg-gray-100",src:p.value,frameborder:"0",id:"previewIframe",onLoad:U},null,40,le),[[_,u.value]]),m(t("div",se,[t("div",ne,i(o(e)("developTitle")),1),t("div",re,[t("text",pe,i(o(e)("wapDomain")),1),l(w,{modelValue:d.value,"onUpdate:modelValue":s[0]||(s[0]=V=>d.value=V),placeholder:o(e)("wapDomainPlaceholder"),clearable:""},null,8,["modelValue","placeholder"])]),l(C,{type:"primary",onClick:L},{default:r(()=>[N(i(o(e)("confirm")),1)]),_:1})],512),[[_,x.value]]),u.value?(b(),B("div",ie,[t("div",ce,[t("div",de,i(o(e)("h5")),1),l(I,{"label-width":"40px",class:"px-[20px]"},{default:r(()=>[m(l(g,{label:o(e)("link")},{default:r(()=>[l(w,{readonly:"",value:p.value},{append:r(()=>[l(C,{onClick:s[1]||(s[1]=V=>F(p.value)),class:"bg-primary copy"},{default:r(()=>[N(i(o(e)("copy")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label"]),[[_,p.value]]),m(l(g,{label:" "},{default:r(()=>[l(E,{src:f.value},null,8,["src"])]),_:1},512),[[_,f.value]])]),_:1}),t("div",ue,i(o(e)("weapp")),1),l(I,{"label-width":"40px",class:"px-[20px]"},{default:r(()=>[y.qr_code?(b(),S(g,{key:0,label:" "},{default:r(()=>[l(E,{class:"w-[100px] h-[100px]",src:o(X)(y.qr_code)},null,8,["src"])]),_:1})):(b(),S(g,{key:1,label:" "},{default:r(()=>[t("span",me,i(o(e)("weappNotSet")),1)]),_:1}))]),_:1})])])):Y("",!0)],512),[[_,D.value]])])}}});export{Ce as default};