import{d as k,V as A,a3 as I,X as L,r as i,o as N,c as t,e as v,f as S,h as l,i as n,F as h,j as x,k as D,m as F,E as J}from"./index.0308b213.js";import M from"./LoginPage.ad2bcaa4.js";const O=F("\u786E\u8BA4"),T=k({setup(U){const{router:V,route:b}=A(),{login:y}=I(),{getConfig:j,updateInfo:C}=L(),m=i({}),u=i([]),a=i(""),d=i(!1),p=r=>{m.value=r,y({...r,sid:a.value}).then(e=>{if(console.log(e,"res1231"),e.stores){if(u.value=e.stores,u.value.length==1){a.value=u.value[0].id,p(m.value);return}d.value=!0;return}let f=localStorage.getItem("shangpu_pinia-website-info")||"",s=JSON.parse(f);s.config.web_logo=e.logo,s.config.web_name=e.name;const _=JSON.stringify(s);localStorage.setItem("shangpu_pinia-website-info",_),C(e.name,e.logo,"","");const{query:{redirect:c}}=b,g=typeof c=="string"?c:"/store";V.replace(g)}).catch(e=>{console.log(e)})},w=()=>{if(!a.value){J.error("\u8BF7\u9009\u62E9\u5E73\u53F0");return}p(m.value)};return N(()=>{}),(r,e)=>{const f=t("el-option"),s=t("el-select"),_=t("el-form-item"),c=t("el-form"),g=t("el-button"),B=t("el-dialog");return v(),S(h,null,[l(M,{"login-title":"\u5546\u6237",onLogin:p}),l(B,{modelValue:d.value,"onUpdate:modelValue":e[1]||(e[1]=o=>d.value=o),title:"\u9009\u62E9\u5546\u5BB6",width:"30%","destroy-on-close":"",onClose:r.handleSelectStoreDialogClose},{footer:n(()=>[l(g,{type:"primary",onClick:w},{default:n(()=>[O]),_:1})]),default:n(()=>[l(c,null,{default:n(()=>[l(_,null,{default:n(()=>[l(s,{modelValue:a.value,"onUpdate:modelValue":e[0]||(e[0]=o=>a.value=o),style:{width:"100%"}},{default:n(()=>[(v(!0),S(h,null,x(u.value,(o,E)=>(v(),D(f,{key:`select_platform_${E}`,value:o.id,label:o.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue","onClose"])],64)}}});export{T as default};
