| 1 |
- import{v as e,r as a,Q as s,o as r,s as l,R as t,t as o,T as n,U as i,V as c,a as u,b as d,x as m,f as p,w as g,F as f,e as _,g as h,j as b,u as y,y as v,d as U,z as x,W as w,X as V,i as k,k as E,I as M,M as R}from"./index-C9WR-P8v.js";import{c as I,m as O,_ as j}from"./phone-international-input.vue_vue_type_style_index_0_scoped_a793e264_lang.BWy48FZ3.js";import{_ as q,a as C,b as $,p as F}from"./phone-international-input.CaEhQ8Bc.js";import{_ as P}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.GlkbvVoE.js";const S=P({__name:"login",setup(P){const S=(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:I,mobile:O}}),T=a(!1),A=a(!1);function B(e){history.replaceState?(history.replaceState(null,document.title,e),history.go(0)):location.replace(e)}let Q=a("");async function W(e){const a=e.detail.value;if(""==a||a==Q.value)return!1;Q.value=a;const{data:s}=await w.verifyUsername(a);console.log(s),s?(L.usernameErrorMsg="",L.verifyUsername=s):(L.usernameErrorMsg=o("account.username_exists"),L.verifyUsername=s)}async function z(){const e=n("linkId");L.registerReqVO.linkId=e;const{code:a}=await w.OfficialEnterLogin(L.model,L.registerReqVO);if(0===a){V();let e=n("returnUrl");e?(i("returnUrl"),B(e)):c({url:"/"})}}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:o("setting.prompt"),content:o("account.wechat_no_account"),confirmColor:"#0e932e",showCancel:!1,buttonText:o("common.confirm"),success:function(e){e.confirm&&l.$router.go("/pages/index/index")}}),!1;if(null!=e.data.socialUsers)return u=e.data.openid,d=e.data.socialUsers,A.value=!0,L.openid=u,L.socialUsers=d,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 u,d;let m=n("returnUrl");m?(i("returnUrl"),B(m)):c({url:"/"})})),(e,a)=>{const s=k,r=E,t=M,V=u(d("su-popup"),j),I=u(d("uni-easyinput"),q),O=u(d("uni-forms-item"),C),P=u(d("uni-forms"),$),Q=R;return _(),m(f,null,[p(s),p(V,{show:A.value,type:"center",round:"10",isMaskClick:!1},{default:g((()=>[p(s,{class:"head-nav"},{default:g((()=>[p(s,{class:"head-box"},{default:g((()=>[p(s,{class:"ss-flex ss-m-b-20"},{default:g((()=>[p(s,{class:"isActive head-title"},{default:g((()=>[h(b(y(o)("account.select_account_login")),1)])),_:1})])),_:1})])),_:1})])),_:1}),p(s,null,{default:g((()=>[p(t,{class:"side-menu-wrap","scroll-y":"",style:{height:"600rpx"}},{default:g((()=>[(_(!0),m(f,null,v(L.socialUsers,(e=>(_(),U(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 w.selectUsernameLogin({openId:L.openid,username:e});if(0===a){let e=n("returnUrl");e?(console.log(e),i("returnUrl"),B(e)):c({url:"/"})}}(e.username)},{default:g((()=>[p(r,{src:e.avatar,style:{width:"100rpx",height:"100rpx","border-radius":"50%","margin-right":"20rpx"}},null,8,["src"]),p(s,null,{default:g((()=>[h(b(e.username),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),L.socialUsers.length?x("",!0):(_(),U(s,{key:0,style:{padding:"20rpx",width:"520rpx","text-align":"center","margin-top":"100rpx"}},{default:g((()=>[h(b(y(o)("account.wechat_no_bind")),1)])),_:1}))])),_:1})])),_:1})])),_:1},8,["show"]),p(V,{show:T.value,round:"10",isMaskClick:!1},{default:g((()=>[p(s,null,{default:g((()=>[p(s,{class:"head-box"},{default:g((()=>[p(s,{class:"ss-flex ss-m-b-20"},{default:g((()=>[p(s,{class:"isActive head-title"},{default:g((()=>[h(b(y(o)("account.wechat_register")),1)])),_:1})])),_:1})])),_:1}),p(P,{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:g((()=>[p(O,{name:"username",label:y(o)("account.username"),class:"loginUniFormItem","error-message":L.usernameErrorMsg},{default:g((()=>[p(I,{placeholder:y(o)("account.enter_username"),modelValue:L.registerReqVO.username,"onUpdate:modelValue":a[0]||(a[0]=e=>L.registerReqVO.username=e),inputBorder:!1,clearable:!1,onBlur:W},{right:g((()=>[L.verifyUsername?(_(),U(s,{key:1,class:"icon"},{default:g((()=>[p(r,{src:y(l).$url.static("/static/images/chenggong.png")},null,8,["src"])])),_:1})):(_(),U(s,{key:0,class:"icon"},{default:g((()=>[p(r,{style:"",src:y(l).$url.static("/static/images/shibai.png")},null,8,["src"])])),_:1}))])),_:1},8,["placeholder","modelValue"])])),_:1},8,["label","error-message"]),p(O,{name:"mobile",label:y(o)("account.phone_number"),class:"mobile loginUniFormItem ss-p-t-10","error-message":L.mobileErrorMsg},{default:g((()=>[p(F,{"verify-username":L.verifyUsername,onInput:S},null,8,["verify-username"])])),_:1},8,["label","error-message"]),p(O,{name:"code",label:y(o)("account.verification_code"),class:"loginUniFormItem"},{default:g((()=>[p(I,{placeholder:y(o)("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"]),p(s,{style:{display:"flex","justify-content":"space-between",padding:"40rpx","padding-bottom":"40rpx"}},{default:g((()=>[p(Q,{class:"ss-reset-button login-btn-start",onClick:z},{default:g((()=>[h(b(y(o)("account.register")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])],64)}}},[["__scopeId","data-v-30dbdf12"]]);export{S as default};
|