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