| 1 |
- import{v as e,r as a,Q as s,o as r,s as l,R as t,t as n,T as o,U as i,a as c,y as u,d,w as m,F as p,i as g,j as f,e as _,f as h,u as b,z as x,b as v,x as y,V as U,W as w,g as V,I as k,k as E,M}from"./index-708bb52f.js";import{c as R,m as I,_ as $}from"./phone-international-input.vue_vue_type_style_index_0_scoped_a2d557af_lang.20409793.js";import{p as q,_ as O,a as C,b as j}from"./phone-international-input.ab10a90b.js";import{_ as F}from"./_plugin-vue_export-helper.1b428a4d.js";const P=F({__name:"login",setup(F){const P=(e,a)=>{L.model.mobile=e,L.mobileErrorMsg=a},L=e({verifyUsername:!1,usernameErrorMsg:"",mobileErrorMsg:"",openid:"",socialUsers:[],registerReqVO:{type:31,code:"",state:"",username:""},isMobileEnd:!1,codeText:"获取验证码",model:{mobile:"",code:"",scene:1},rules:{code:R,mobile:I}}),T=a(!1),A=a(!1);let B=a("");async function S(e){const a=e.detail.value;if(""==a||a==B.value)return!1;B.value=a;const{data:s}=await U.verifyUsername(a);console.log(s),s?(L.usernameErrorMsg="",L.verifyUsername=s):(L.usernameErrorMsg=n("account.username_exists"),L.verifyUsername=s)}async function W(){const e=o("linkId");L.registerReqVO.linkId=e;const{code:a}=await U.OfficialEnterLogin(L.model,L.registerReqVO);if(0===a){w();let e=o("returnUrl");e?(i("returnUrl"),location.replace(e)):l.$router.redirect("/pages/index/index")}}return s((async()=>{const e={};new URLSearchParams(location.search).forEach(((a,s)=>{e[s]=a})),L.registerReqVO.code=e.code,L.registerReqVO.state=e.state})),r((async e=>{new URLSearchParams(location.search).forEach(((a,s)=>{e[s]=a}));const a=e.event,s=e.code,r=e.state;if("login"===a){const e=await l.$platform.useProvider().login(s,r);if(console.log("login.vue的res",e),!e)return t({title:n("setting.prompt"),content:n("account.wechat_no_account"),confirmColor:"#0e932e",showCancel:!1,buttonText:n("common.confirm"),success:function(e){e.confirm&&l.$router.go("/pages/index/index")}}),!1;if(null!=e.data.socialUsers)return c=e.data.openid,u=e.data.socialUsers,A.value=!0,L.openid=c,L.socialUsers=u,console.log("updateSocialUsers条用了,这时state.socialUsers是",L.socialUsers),!1}else{if("register"===a)return await l.$platform.useProvider().register(s,r),T.value=!0,!1;"bind"===a&&await l.$platform.useProvider().bind(s,r)}var c,u;let d=o("returnUrl");d?(i("returnUrl"),location.replace(d)):l.$router.redirect("/pages/index/index")})),(e,a)=>{const s=g,r=V,t=k,w=f(E("su-popup"),$),R=f(E("uni-easyinput"),O),I=f(E("uni-forms-item"),C),F=f(E("uni-forms"),j),B=M;return c(),u(p,null,[d(s),d(w,{show:A.value,type:"center",round:"10",isMaskClick:!1},{default:m((()=>[d(s,{class:"head-nav"},{default:m((()=>[d(s,{class:"head-box"},{default:m((()=>[d(s,{class:"ss-flex ss-m-b-20"},{default:m((()=>[d(s,{class:"isActive head-title"},{default:m((()=>[_(h(b(n)("account.select_account_login")),1)])),_:1})])),_:1})])),_:1})])),_:1}),d(s,null,{default:m((()=>[d(t,{class:"side-menu-wrap","scroll-y":"",style:{height:"600rpx"}},{default:m((()=>[(c(!0),u(p,null,x(L.socialUsers,(e=>(c(),v(s,{key:e.username,class:"ss-flex",style:{padding:"20rpx",margin:"0 auto",width:"520rpx"},onClick:a=>async function(e){console.log(e);const{code:a}=await U.selectUsernameLogin({openId:L.openid,username:e});if(0===a){let e=o("returnUrl");e?(i("returnUrl"),location.replace(e)):l.$router.redirect("/pages/index/index")}}(e.username)},{default:m((()=>[d(r,{src:e.avatar,style:{width:"100rpx",height:"100rpx","border-radius":"50%","margin-right":"20rpx"}},null,8,["src"]),d(s,null,{default:m((()=>[_(h(e.username),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),L.socialUsers.length?y("",!0):(c(),v(s,{key:0,style:{padding:"20rpx",width:"520rpx","text-align":"center","margin-top":"100rpx"}},{default:m((()=>[_(h(b(n)("account.wechat_no_bind")),1)])),_:1}))])),_:1})])),_:1})])),_:1},8,["show"]),d(w,{show:T.value,round:"10",isMaskClick:!1},{default:m((()=>[d(s,null,{default:m((()=>[d(s,{class:"head-box"},{default:m((()=>[d(s,{class:"ss-flex ss-m-b-20"},{default:m((()=>[d(s,{class:"isActive head-title"},{default:m((()=>[_(h(b(n)("account.wechat_register")),1)])),_:1})])),_:1})])),_:1}),d(F,{modelValue:L.model,"onUpdate:modelValue":a[2]||(a[2]=e=>L.model=e),rules:L.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",class:"loginUniForm"},{default:m((()=>[d(I,{name:"username",label:b(n)("account.username"),class:"loginUniFormItem","error-message":L.usernameErrorMsg},{default:m((()=>[d(R,{placeholder:b(n)("account.enter_username"),modelValue:L.registerReqVO.username,"onUpdate:modelValue":a[0]||(a[0]=e=>L.registerReqVO.username=e),inputBorder:!1,clearable:!1,onBlur:S},{right:m((()=>[L.verifyUsername?(c(),v(s,{key:1,class:"icon"},{default:m((()=>[d(r,{src:b(l).$url.static("/static/images/chenggong.png")},null,8,["src"])])),_:1})):(c(),v(s,{key:0,class:"icon"},{default:m((()=>[d(r,{style:"",src:b(l).$url.static("/static/images/shibai.png")},null,8,["src"])])),_:1}))])),_:1},8,["placeholder","modelValue"])])),_:1},8,["label","error-message"]),d(I,{name:"mobile",label:b(n)("account.phone_number"),class:"mobile loginUniFormItem ss-p-t-10","error-message":L.mobileErrorMsg},{default:m((()=>[d(q,{"verify-username":L.verifyUsername,onInput:P},null,8,["verify-username"])])),_:1},8,["label","error-message"]),d(I,{name:"code",label:b(n)("account.verification_code"),class:"loginUniFormItem"},{default:m((()=>[d(R,{placeholder:b(n)("account.enter_verification_code"),modelValue:L.model.code,"onUpdate:modelValue":a[1]||(a[1]=e=>L.model.code=e),inputBorder:!1,type:"number",maxlength:"4"},null,8,["placeholder","modelValue"])])),_:1},8,["label"])])),_:1},8,["modelValue","rules"]),d(s,{style:{display:"flex","justify-content":"space-between",padding:"40rpx","padding-bottom":"40rpx"}},{default:m((()=>[d(B,{class:"ss-reset-button login-btn-start",onClick:W},{default:m((()=>[_(h(b(n)("account.register")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])],64)}}},[["__scopeId","data-v-6b7c7e8e"]]);export{P as default};
|