import{K as e,y as s,L as l,o as a,s as o,M as t,N as n,O as r,e as i,k as d,j as c,w as u,v as m,F as f,i as p,l as b,t as g,u as h,r as _,B as U,P as x,Q as v,R as w,T as y,m as V,G as k,f as C,x as R}from"./index-585b592e.js";import{c as L,m as O,_ as P,a as E,b as I,d as j}from"./form.8fa43ff9.js";import{_ as q}from"./_plugin-vue_export-helper.1b428a4d.js";const M=q({__name:"login",setup(q,{expose:M}){const F=e(null),A=s({socialUsers:[],loginReqVO:{type:31,code:"",state:""},isMobileEnd:!1,codeText:"获取验证码",model:{mobile:"",code:"",scene:1},rules:{code:L,mobile:O}}),B=e(!1),T=e(!1);function S(){B.value=!0}async function $(){const e=t("linkId");e&&(A.loginReqVO.linkId=e);if(!(await m(F).validate().catch((e=>{console.log("error: ",e)}))))return;const{code:s}=await y.OfficialEnterLogin(A.model,A.loginReqVO);if(0===s){w();let e=t("returnUrl");e?(n("returnUrl"),location.replace(e)):r({url:"/"})}}return M({updateIsPopup:S}),l((async()=>{const e={};new URLSearchParams(location.search).forEach(((s,l)=>{e[l]=s})),A.loginReqVO.code=e.code,A.loginReqVO.state=e.state})),a((async e=>{new URLSearchParams(location.search).forEach(((s,l)=>{e[l]=s}));const s=e.event,l=e.code,a=e.state;if("login"===s){const e=await o.$platform.useProvider().login(l,a);if(console.log("login.vue的res",e),!e)return S(),!1;if(null!=e.data.socialUsers||e.data.socialUsers.length>1)return function(e){T.value=!0,A.socialUsers=e}(e.data.socialUsers),!1}else"bind"===s&&o.$platform.useProvider().bind(l,a);let i=t("returnUrl");i?(n("returnUrl"),location.replace(i)):r({url:"/"})})),(e,s)=>{const l=p,a=R,o=b(V("su-popup"),P),t=k,n=b(V("uni-easyinput"),E),r=b(V("uni-forms-item"),I),y=b(V("uni-forms"),j);return i(),d(f,null,[c(l),c(o,{show:A.showProtocol,type:"center",round:"10",isMaskClick:!1,showClose:"",onClose:e.close},{default:u((()=>[c(l,{class:"head-nav"},{default:u((()=>[c(l,{class:"head-box"},{default:u((()=>[c(l,{class:"ss-flex ss-m-b-20"},{default:u((()=>[c(l,{class:"isActive head-title"},{default:u((()=>[g(" 请选择账号登录 ")])),_:1})])),_:1})])),_:1})])),_:1}),c(l,null,{default:u((()=>[g(h(e.socialUsers)+" ",1),(i(!0),d(f,null,_(e.socialUsers,(e=>(i(),C(l,{key:e.username,class:"ss-flex"},{default:u((()=>[c(a,{src:e.avatar,style:{width:"100rpx",height:"100rpx"}},null,8,["src"]),c(l,null,{default:u((()=>[g(h(e.username),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["show","onClose"]),c(o,{show:B.value,round:"10",showClose:!1,onClose:m(w)},{default:u((()=>[c(l,null,{default:u((()=>[c(l,{class:"head-box"},{default:u((()=>[c(l,{class:"ss-flex ss-m-b-20"},{default:u((()=>[c(l,{class:"isActive head-title"},{default:u((()=>[g(" 微信注册 ")])),_:1})])),_:1})])),_:1}),c(y,{ref_key:"smsLoginRef",ref:F,modelValue:A.model,"onUpdate:modelValue":s[3]||(s[3]=e=>A.model=e),rules:A.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",class:"loginUniForm"},{default:u((()=>[c(r,{name:"mobile",label:"手机号",class:"loginUniFormItem"},{default:u((()=>[c(n,{placeholder:"请输入手机号",modelValue:A.model.mobile,"onUpdate:modelValue":s[1]||(s[1]=e=>A.model.mobile=e),inputBorder:!1,type:"number"},{right:u((()=>[c(t,{class:U(["ss-reset-button code-btn code-btn-start",{"code-btn-end":A.isMobileEnd}]),disabled:A.isMobileEnd,onClick:s[0]||(s[0]=e=>m(x)("smsLogin",A.model.mobile))},{default:u((()=>[g(h(m(v)("smsLogin")),1)])),_:1},8,["disabled","class"])])),_:1},8,["modelValue"])])),_:1}),c(r,{name:"code",label:"验证码",class:"loginUniFormItem"},{default:u((()=>[c(n,{placeholder:"请输入验证码",modelValue:A.model.code,"onUpdate:modelValue":s[2]||(s[2]=e=>A.model.code=e),inputBorder:!1,type:"number",maxlength:"4"},null,8,["modelValue"])])),_:1})])),_:1},8,["modelValue","rules"]),c(l,{style:{display:"flex","justify-content":"space-between",padding:"40rpx","padding-bottom":"0rpx"}},{default:u((()=>[c(t,{class:"ss-reset-button login-btn-start",onClick:$},{default:u((()=>[g(" 继续登录 ")])),_:1})])),_:1})])),_:1})])),_:1},8,["show","onClose"])],64)}}},[["__scopeId","data-v-600dc654"]]);export{M as default};
