app-pages-auth-login.8b31fe6f.js 7.2 KB

1
  1. import{d as e,H as l,r as a,I as o,F as t,P as r,l as s,Q as n,R as i,M as u,G as d,a as p,c,w as m,b as g,p as b,D as _,e as x,S as f,T as h,U as y,g as v,f as j,v as k,A as w,n as S,J as V,V as C,W as P,N as T,j as U,h as q,i as z,E as A,O as L}from"./index-65a0752a.js";import{_ as O,a as R,b as E}from"./u-form.5aee87b7.js";import{_ as I}from"./sms-code.vue_vue_type_script_setup_true_lang.559b9316.js";import{_ as B}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.086befcc.js";import"./u-line.22a1edb4.js";import"./u-modal.1782ca81.js";import"./u-loading-icon.8860be91.js";import"./u-popup.861e9cb5.js";import"./u-transition.4a1deb0f.js";import"./u-popup.vue_vue_type_style_index_0_scoped_ca966c1e_lang.345278f5.js";import"./u-safe-bottom.ed5ce7c3.js";/* empty css */const D=B(e({__name:"login",setup(e){const B=l({username:"",password:"",mobile:"",mobile_code:"",mobile_key:""});let D=a(!0);o((()=>{setTimeout((()=>{D.value=!1}),800)}));const F=t(),G=r();s((async()=>{await G.getLoginConfig(),uni.getStorageSync("openid")&&Object.assign(B,{openid:uni.getStorageSync("openid")}),uni.getStorageSync("unionid")&&Object.assign(B,{unionid:uni.getStorageSync("unionid")}),uni.getStorageSync("pid")&&Object.assign(B,{pid:uni.getStorageSync("pid")}),n()||G.login.is_username||G.login.is_mobile||G.login.is_bind_mobile||(i({title:"商家未开启普通账号登录注册",icon:"none"}),setTimeout((()=>{u({url:"/app/pages/index/index",mode:"reLaunch"})}),100))}));const H=a(!1),J=a(""),M=d((()=>{const e=[];return G.login.is_username&&e.push({type:"username",title:V("usernameLogin")}),(G.login.is_bind_mobile||G.login.is_mobile)&&e.push({type:"mobile",title:V("mobileLogin")}),J.value=e[0]?e[0].type:"",e})),N=d((()=>({username:{type:"string",required:"username"==J.value,message:V("usernamePlaceholder"),trigger:["blur","change"]},password:{type:"string",required:"username"==J.value,message:V("passwordPlaceholder"),trigger:["blur","change"]},mobile:[{type:"string",required:"mobile"==J.value,message:V("mobilePlaceholder"),trigger:["blur","change"]},{validator:(e,l)=>"mobile"!=J.value||uni.$u.test.mobile(l),message:V("mobileError"),trigger:["change","blur"]}],mobile_code:{type:"string",required:"mobile"==J.value,message:V("codePlaceholder"),trigger:["blur","change"]}}))),Q=a(!1),W=a(null),$=()=>{W.value.validate().then((()=>{if(G.login.agreement_show&&!Q.value)return i({title:V("isAgreeTips"),icon:"none"}),!1;if(H.value)return;H.value=!0;("username"==J.value?C:P)(B).then((e=>{F.setToken(e.data.token),G.login.is_bind_mobile&&!e.data.mobile&&uni.setStorageSync("isbindmobile",!0),T().handleLoginBack()})).catch((()=>{H.value=!1}))}))};return a(!1),a(null),(e,l)=>{const a=U,o=q(z("u-input"),O),t=q(z("u-form-item"),R),r=q(z("sms-code"),I),s=A,n=L,i=q(z("u-form"),E);return p(),c(a,{class:"w-screen h-screen flex flex-col",style:S(e.themeColor())},{default:m((()=>[g(a,{class:"flex-1"},{default:m((()=>[g(a,{class:"h-[100rpx]"}),g(a,{class:"px-[60rpx] pt-[100rpx] mb-[100rpx]"},{default:m((()=>[g(a,{class:"font-bold text-xl"},{default:m((()=>[b(_(x(V)("login")),1)])),_:1})])),_:1}),x(M).length>1?(p(),c(a,{key:0,class:"px-[60rpx] text-sm flex mb-[50rpx] font-bold leading-none"},{default:m((()=>[(p(!0),f(y,null,h(x(M),((e,l)=>(p(),f(y,null,[g(a,{class:w({"text-gray-300":e.type!=J.value}),onClick:l=>J.value=e.type},{default:m((()=>[b(_(e.title),1)])),_:2},1032,["class","onClick"]),j(g(a,{class:"mx-[30rpx] border-solid border-0 border-r-[2px] border-gray-300"},null,512),[[k,0==l]])],64)))),256))])),_:1})):v("v-if",!0),g(a,{class:"px-[60rpx]"},{default:m((()=>[g(i,{labelPosition:"left",model:B,errorType:"toast",rules:x(N),ref_key:"formRef",ref:W},{default:m((()=>[j(g(a,null,{default:m((()=>[g(t,{label:"",prop:"username","border-bottom":!0},{default:m((()=>[g(o,{modelValue:B.username,"onUpdate:modelValue":l[0]||(l[0]=e=>B.username=e),border:"none",clearable:"",placeholder:x(V)("usernamePlaceholder"),autocomplete:"off",class:"!bg-transparent",disabled:x(D),fontSize:"26rpx",placeholderClass:"!text-[var(--text-color-light9)] text-[26rpx]"},null,8,["modelValue","placeholder","disabled"])])),_:1}),g(a,{class:"mt-[40rpx]"},{default:m((()=>[g(t,{label:"",prop:"password","border-bottom":!0},{default:m((()=>[g(o,{modelValue:B.password,"onUpdate:modelValue":l[1]||(l[1]=e=>B.password=e),border:"none",type:"password",clearable:"",placeholder:x(V)("passwordPlaceholder"),autocomplete:"new-password",class:"!bg-transparent",disabled:x(D),fontSize:"26rpx",placeholderClass:"!text-[var(--text-color-light9)] text-[26rpx]"},null,8,["modelValue","placeholder","disabled"])])),_:1})])),_:1})])),_:1},512),[[k,"username"==J.value]]),j(g(a,null,{default:m((()=>[g(t,{label:"",prop:"mobile","border-bottom":!0},{default:m((()=>[g(o,{modelValue:B.mobile,"onUpdate:modelValue":l[2]||(l[2]=e=>B.mobile=e),border:"none",clearable:"",placeholder:x(V)("mobilePlaceholder"),autocomplete:"off",class:"!bg-transparent",disabled:x(D),fontSize:"26rpx",placeholderClass:"!text-[var(--text-color-light9)] text-[26rpx]"},null,8,["modelValue","placeholder","disabled"])])),_:1}),g(a,{class:"mt-[40rpx]"},{default:m((()=>[g(t,{label:"",prop:"mobile_code","border-bottom":!0},{default:m((()=>[g(o,{modelValue:B.mobile_code,"onUpdate:modelValue":l[4]||(l[4]=e=>B.mobile_code=e),border:"none",clearable:"",class:"!bg-transparent",disabled:x(D),placeholder:x(V)("codePlaceholder"),fontSize:"26rpx",placeholderClass:"!text-[var(--text-color-light9)] text-[26rpx]"},{suffix:m((()=>[g(r,{mobile:B.mobile,type:"login",modelValue:B.mobile_key,"onUpdate:modelValue":l[3]||(l[3]=e=>B.mobile_key=e)},null,8,["mobile","modelValue"])])),_:1},8,["modelValue","disabled","placeholder"])])),_:1})])),_:1})])),_:1},512),[[k,"mobile"==J.value]]),g(a,{class:"flex text-xs justify-between mt-[20rpx] text-[var(--text-color-light9)]"},{default:m((()=>[g(a,{onClick:l[5]||(l[5]=e=>x(u)({url:"/app/pages/auth/register"}))},{default:m((()=>[b(_(x(V)("noAccount"))+" ",1),g(s,{class:"text-primary"},{default:m((()=>[b(_(x(V)("toRegister")),1)])),_:1})])),_:1}),g(a,{onClick:l[6]||(l[6]=e=>x(u)({url:"/app/pages/auth/resetpwd"}))},{default:m((()=>[b(_(x(V)("resetpwd")),1)])),_:1})])),_:1}),g(a,{class:"mt-[80rpx]"},{default:m((()=>[g(n,{"hover-class":"none",class:"bg-[var(--primary-color)] text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[28rpx]",loading:H.value,onClick:$},{default:m((()=>[b(_(x(V)("login")),1)])),_:1},8,["loading"])])),_:1})])),_:1},8,["model","rules"])])),_:1})])),_:1}),x(G).login.agreement_show?(p(),c(a,{key:0,class:"text-xs py-[50rpx] flex justify-center w-full"},{default:m((()=>[g(s,{class:w(["iconfont text-[var(--primary-color)] text-[34rpx] mr-[12rpx]",Q.value?"iconxuanze1":"nc-iconfont nc-icon-yuanquanV6xx"]),onClick:l[7]||(l[7]=e=>Q.value=!Q.value)},null,8,["class"]),b(" "+_(x(V)("agreeTips"))+" ",1),g(a,{onClick:l[8]||(l[8]=e=>x(u)({url:"/app/pages/auth/agreement?key=service"}))},{default:m((()=>[g(s,{class:"text-primary"},{default:m((()=>[b(_(x(V)("userAgreement")),1)])),_:1})])),_:1}),b(" "+_(x(V)("and"))+" ",1),g(a,{onClick:l[9]||(l[9]=e=>x(u)({url:"/app/pages/auth/agreement?key=privacy"}))},{default:m((()=>[g(s,{class:"text-primary"},{default:m((()=>[b(_(x(V)("privacyAgreement")),1)])),_:1})])),_:1})])),_:1})):v("v-if",!0)])),_:1},8,["style"])}}}),[["__scopeId","data-v-27485d0d"]]);export{D as default};