import{d as A,ah as g,r as b,$ as m,f as w,br as y,bd as u,m as c,g as n,ai as f,c as a,q as i,B as E,P as j,bi as C,bs as D}from"./index.27735e87.js";import{I as l}from"./index.06a07328.js";const M="_bindWeChat_h1af0_1",I="_largeLogo_h1af0_5",L="_smallLogo_h1af0_13",V="_tips_h1af0_19",x="_phone_h1af0_26",G="_btnGroup_h1af0_32",k="_wxPopupDialog_h1af0_35",B="_popupContainer_h1af0_50",O="_title1_h1af0_56",R="_popupTips_h1af0_63";var t={bindWeChat:M,largeLogo:I,smallLogo:L,tips:V,phone:x,btnGroup:G,wxPopupDialog:k,popupContainer:B,title1:O,popupTips:R},q="./assets/icon-logo.39c9825e.png",T="data:image/png;base64,[encoded data, 5260 characters]",K=A({name:"bind-wechat",setup(){const p=g();console.log(p.query);const o=b({showPopup:!1,code:"",phone:"",time:"",popupMessage:"\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6253\u5F00"}),d=async e=>{try{const{data:s}=await c.get(n.platformApi+"/open/paramConfig/wechatAppId");s&&(C(),D(s,e))}catch{}},h=async()=>{try{await c.post(n.platformApi+"/open/user/updateOpenId",{data:{clientType:n.platformType,code:o.code,phone:o.phone}}),n.platformType==="STUDENT"?window.location.href="https://mp.weixin.qq.com/s?__biz=MzkxMDMwOTI5Nw==&mid=2247485362&idx=3&sn=9b265d36b5dabe7f9393fc679c367540&chksm=c12c256cf65bac7ae2a865435b950f6e1285afd226356db0ffde815b1ee345f29cfcdb798cc9#rd":n.platformType==="TEACHER"?window.location.href="https://mp.weixin.qq.com/s?__biz=MzkxMDMwOTI5Nw==&mid=2247485362&idx=2&sn=e3eaa3b85315535fcf4fd344c0a9b548&chksm=c12c256cf65bac7a898b0bce0d59f02ff924b6a0eabd9ba3fa67a87a0bdb98b916c328fe43f0#rd":n.platformType==="SCHOOL"&&(window.location.href="https://mp.weixin.qq.com/s?__biz=MzkxMDMwOTI5Nw==&mid=2247485362&idx=1&sn=b9081f35ec8a09897a6a14c2ff617b35&chksm=c12c256cf65bac7ae7ad2627454d296870483070b861729a40c2b9deda54b097e75be206b49f#rd")}catch{}};return m(async()=>{if(w().weixin){const e=y();if(e)o.code=e;else{const s=window.location.origin+window.location.pathname+"#"+p.path+"?"+u.stringify({...p.query});await d(s);return}}else{o.showPopup=!0;return}try{const e=window.location.hash?window.location.hash.split("?")[1]:"",s=window.atob(decodeURIComponent(e)),r=u.parse(s);if(o.phone=r.phone,o.time=r.time,!o.phone){o.popupMessage="\u94FE\u63A5\u5DF2\u5931\u6548",o.showPopup=!0;return}}catch{}try{if(o.time){const{data:e}=await c.get(n.platformApi+"/open/paramConfig/queryByParamName",{requestType:"form",params:{paramName:"qr_code_expire_hours"}});f(Number(o.time)).add(e.paramValue,"hour").isBefore(f())&&(o.popupMessage="\u4E8C\u7EF4\u7801\u5DF2\u5931\u6548",o.showPopup=!0)}}catch{}}),()=>a("div",{class:t.bindWeChat},[a(l,{class:t.largeLogo,src:T},null),a(l,{src:q,class:t.smallLogo},null),a("p",{class:t.tips},[i("\u540C\u610F\u7BA1\u4E50\u56E2\u83B7\u53D6\u60A8\u7684\u5FAE\u4FE1\u4FE1\u606F")]),a("p",{class:t.phone},[o.phone]),a("div",{class:t.btnGroup},[a(E,{type:"primary",size:"large",round:!0,onClick:h},{default:()=>[i("\u786E\u8BA4\u6388\u6743")]})]),a(j,{show:o.showPopup,"onUpdate:show":e=>o.showPopup=e,round:!0,style:{width:"88%",marginTop:"-6vh"},closeOnClickOverlay:!1,class:t.wxPopupDialog},{default:()=>[a("div",{class:t.popupContainer},[a("p",{class:t.title1},[i("\u6E29\u99A8\u63D0\u793A")]),a("p",{class:t.popupTips},[o.popupMessage])])]})])}});export{K as default};
