import{x as P,_ as I}from"./index-fNs72j9w.js";import{B as W,b as u,D as w,G as e,U as n,u as i,V as r,H as p,P as d,ah as b,I as h,C as _,Z as x,Y as V,F as S}from"./vue-DweYBrEc.js";const A={class:"default-main program-widget-page"},E={class:"panel"},B={class:"panel-title"},D={class:"code-section"},U={class:"section-heading"},F={class:"section-help"},H={class:"section-actions"},L={class:"code-section function-section"},T={class:"section-heading"},N={class:"section-help"},$={class:"section-actions"},O={class:"preview-grid"},z=["onClick"],G={class:"preview-note"},J=W({name:"embed/programWidget",__name:"programWidget",setup(M){const{t:o}=P.useI18n(),l=u(!1),k=[{page:262,label:"WF",image:"https://admin.tl-tech.top/images/262.png"},{page:263,label:"FE",image:"https://admin.tl-tech.top/images/263.png"},{page:264,label:"CD",image:"https://admin.tl-tech.top/images/264.png"},{page:265,label:"GL",image:"https://admin.tl-tech.top/images/265.png"},{page:266,label:"LS",image:"https://admin.tl-tech.top/images/266.png"},{page:267,label:"DP",image:"https://admin.tl-tech.top/images/267.png"},{page:268,label:"PB",image:"https://admin.tl-tech.top/images/268.png"},{page:269,label:"GE",image:"https://admin.tl-tech.top/images/269.png"},{page:270,label:"SW",image:"https://admin.tl-tech.top/images/270.png"}],g=u(`<div class='promo-container'>
    <div class='wf-wrapper promo-wrapper'><button class='wf-button promo-button' onclick='programPage(262);'>Click</button></div>
    <div class='fe-wrapper promo-wrapper'><button class='fe-button promo-button' onclick='programPage(263);'>Click</button></div>
    <div class='cd-wrapper promo-wrapper'><button class='cd-button promo-button' onclick='programPage(264);'>Click</button></div>
    <div class='gl-wrapper promo-wrapper'><button class='gl-button promo-button' onclick='programPage(265);'>Click</button></div>
    <div class='ls-wrapper promo-wrapper'><button class='ls-button promo-button' onclick='programPage(266);'>Click</button></div>
    <div class='dp-wrapper promo-wrapper'><button class='dp-button promo-button' onclick='programPage(267);'>Click</button></div>
    <div class='pb-wrapper promo-wrapper'><button class='pb-button promo-button' onclick='programPage(268);'>Click</button></div>
    <div class='ge-wrapper promo-wrapper'><button class='ge-button promo-button' onclick='programPage(269);'>Click</button></div>
    <div class='sw-wrapper promo-wrapper'><button class='sw-button promo-button' onclick='programPage(270);'>Click</button></div>
</div>
<style>
    .wf-button { background-image: url(https://admin.tl-tech.top/images/262.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .fe-button { background-image: url(https://admin.tl-tech.top/images/263.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .cd-button { background-image: url(https://admin.tl-tech.top/images/264.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .gl-button { background-image: url(https://admin.tl-tech.top/images/265.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .ls-button { background-image: url(https://admin.tl-tech.top/images/266.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .dp-button { background-image: url(https://admin.tl-tech.top/images/267.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .pb-button { background-image: url(https://admin.tl-tech.top/images/268.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .ge-button { background-image: url(https://admin.tl-tech.top/images/269.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .sw-button { background-image: url(https://admin.tl-tech.top/images/270.png); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
</style>`),m=u(`<script>
    function programPage(page) {
        let userId = '';
        let merchantId = (typeof _ !== 'undefined' && typeof _.getVar === 'function') ? (_.getVar('merchantId') ?? '') : '';
        if (!merchantId) { alert('merchantId not found'); return; }

        var refValue = 'jdkUserId';
        if (!localStorage.getItem('USER')) { alert('Please login first!'); return; }
        userId = JSON.parse(localStorage.getItem('USER')).id;
        if (typeof userId == 'undefined' || userId == '') { alert('Please login first!'); return; }
        if (userId === null) { alert('user id is null'); return; }

        var content = refValue + '=' + userId;
        var encodedContent = btoa(content);
        var form = document.createElement('form');
        form.setAttribute('method', 'POST');
        form.setAttribute('action', 'https://admin.tl-tech.top/index.php/api/index/xyxLogin');

        var input1 = document.createElement('input');
        input1.setAttribute('type', 'hidden');
        input1.setAttribute('name', 'userData');
        input1.setAttribute('value', encodedContent);

        var input2 = document.createElement('input');
        input2.setAttribute('type', 'hidden');
        input2.setAttribute('name', 'clientMerchant');
        input2.setAttribute('value', merchantId);
        input2.setAttribute('page', page);

        form.appendChild(input1);
        form.appendChild(input2);
        document.body.appendChild(form);
        form.submit();
        form.remove();
    }
<\/script>`),v=async s=>{try{await navigator.clipboard.writeText(s),b.success(o("embed.programWidget.copied"))}catch{b.error(o("embed.programWidget.copyFailed"))}},C=s=>{b.info(o("embed.programWidget.previewProgram",{page:s}))};return(s,t)=>{const f=h("el-input"),c=h("el-button"),y=h("el-dialog");return _(),w("div",A,[e("section",E,[e("div",B,n(i(o)("embed.programWidget.title")),1),e("div",D,[e("div",U,n(i(o)("embed.programWidget.bannerCode"))+":",1),e("p",F,[r(n(i(o)("embed.programWidget.bannerHelpPrefix"))+" ",1),t[6]||(t[6]=e("strong",null,"JDK Back-end > DISPLAY > SEO > Heading 1",-1)),r(" "+n(i(o)("embed.programWidget.bannerHelpSuffix")),1)]),p(f,{modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=a=>g.value=a),type:"textarea",rows:7,readonly:"",resize:"vertical"},null,8,["modelValue"]),e("div",H,[p(c,{onClick:t[1]||(t[1]=a=>l.value=!0)},{default:d(()=>[r(n(i(o)("embed.programWidget.preview")),1)]),_:1}),p(c,{type:"primary",plain:"",onClick:t[2]||(t[2]=a=>v(g.value))},{default:d(()=>[r(n(i(o)("embed.programWidget.copyBanner")),1)]),_:1})])]),e("div",L,[e("div",T,n(i(o)("embed.programWidget.functionCode"))+":",1),e("p",N,[r(n(i(o)("embed.programWidget.functionHelpPrefix"))+" ",1),t[7]||(t[7]=e("strong",null,"JDK Back-end > LAYOUT > Home Page · Floating Widget > HTML",-1))]),p(f,{modelValue:m.value,"onUpdate:modelValue":t[3]||(t[3]=a=>m.value=a),type:"textarea",rows:7,readonly:"",resize:"vertical"},null,8,["modelValue"]),e("div",$,[p(c,{type:"primary",plain:"",onClick:t[4]||(t[4]=a=>v(m.value))},{default:d(()=>[r(n(i(o)("embed.programWidget.copyFunction")),1)]),_:1})])])]),p(y,{modelValue:l.value,"onUpdate:modelValue":t[5]||(t[5]=a=>l.value=a),title:i(o)("embed.programWidget.previewTitle"),width:"760px"},{default:d(()=>[e("div",O,[(_(),w(x,null,V(k,a=>e("button",{key:a.page,type:"button",class:"program-banner",style:S({backgroundImage:`url(${a.image})`}),onClick:Y=>C(a.page)},[e("span",null,n(a.label),1)],12,z)),64))]),e("p",G,n(i(o)("embed.programWidget.previewNote")),1)]),_:1},8,["modelValue","title"])])}}}),R=I(J,[["__scopeId","data-v-9ba472b1"]]);export{R as default};
