import{d as B,V as F,W as N,X as x,Y as U,r as c,o as J,c as a,e as p,f as y,h as s,i as u,F as b,j as M,k as O,m as q,Z as D,E as $,$ as j}from"./index.0308b213.js";import R from"./LoginPage.ad2bcaa4.js";const T=q("\u786E\u8BA4"),z=B({setup(W){const{router:_,route:k}=F(),{login:w,selectPlatform:E}=N(),{getConfig:X,updateInfo:P}=x(),{getSassRoleMenu:V}=U(),v=c([]),m=c(!1),l=c(""),I=t=>{w(t).then(async e=>{console.log(e,"res",e.uniacid),e.uniacid==0?(v.value=await D({keyword:""}),m.value=!0):(l.value=e.uniacid,S())}).catch(e=>{console.log(e)})},C=()=>{},h=c(null),S=()=>{if(!l.value){$.error("\u8BF7\u9009\u62E9\u5E73\u53F0");return}E({uniacid:Number(l.value)}).then(()=>{j(l.value).then(o=>{let d=localStorage.getItem("shangpu_pinia-website-info")||"{}",r=JSON.parse(d);r.config.web_logo=o.logo,r.config.web_name=o.name;const f=JSON.stringify(r);localStorage.setItem("shangpu_pinia-website-info",f),P(o.name,o.logo,"","");let g=document.querySelector('link[rel="icon"]');g.href=o.logo}),console.log(1);const{query:{redirect:t}}=k;let e=JSON.parse(localStorage.getItem("shangpu_pinia-admin-user")||"{}");if(e&&e.user.role_id>0){_.replace("/admin"+e.user.redirect);return}const i=typeof t=="string"?t:"/saas/index";V(i),h.value=setInterval(()=>{const o=L();console.log(o,"result"),o&&(clearInterval(h.value),console.log(i,"path"),_.replace(i))},100)}).catch(t=>{console.log(t)})},L=()=>!!(localStorage.getItem("shangpu_tuniao_pluginlist")||"");return J(()=>{}),(t,e)=>{const i=a("el-option"),o=a("el-select"),d=a("el-form-item"),r=a("el-form"),f=a("el-button"),g=a("el-dialog");return p(),y(b,null,[s(R,{"login-title":"\u603B\u540E\u53F0",onLogin:I}),s(g,{modelValue:m.value,"onUpdate:modelValue":e[1]||(e[1]=n=>m.value=n),title:"\u9009\u62E9\u5E73\u53F0",width:"30%","destroy-on-close":"",onClose:C},{footer:u(()=>[s(f,{type:"primary",onClick:S},{default:u(()=>[T]),_:1})]),default:u(()=>[s(r,null,{default:u(()=>[s(d,null,{default:u(()=>[s(o,{modelValue:l.value,"onUpdate:modelValue":e[0]||(e[0]=n=>l.value=n),style:{width:"100%"}},{default:u(()=>[(p(!0),y(b,null,M(v.value,(n,A)=>(p(),O(i,{key:`select_platform_${A}`,value:n.uniacid,label:n.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64)}}});export{z as default};
