mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-02-20 15:40:27 +00:00
2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
import{d as e,a as l,Y as a,a1 as r,r as o,c as s,i as t,j as u,w as n,k as d,K as i,L as p,n as m,F as c,H as b,G as g,m as _,l as f,v as x,a2 as y,a3 as h,a0 as v,x as j,q as k,t as w,N as V,Z as P,I as T}from"./index-5ba59c4d.js";import{_ as U,a as q,b as S}from"./u-form.2b40e12d.js";import{_ as L}from"./sms-code.vue_vue_type_script_setup_true_lang.8fbacb3d.js";import{_ as A}from"./app-link.vue_vue_type_script_setup_true_lang.a9dbfad3.js";import{_ as C}from"./u-button.ba21cfc7.js";import"./u-icon.8a457f3e.js";import"./_plugin-vue_export-helper.1b428a4d.js";import"./u-line.22e40e4d.js";import"./u-modal.a11c4328.js";import"./u-loading-icon.014f987d.js";import"./u-popup.e7a74750.js";import"./u-transition.d1b248b1.js";import"./u-safe-bottom.6453ad9a.js";const R=e({__name:"login",setup(e){const R=l({username:"",password:"",mobile:"",mobile_code:"",mobile_key:""});uni.getStorageSync("openid")&&Object.assign(R,{openid:uni.getStorageSync("openid")});const Y=a(),Z=r(),B=o(!1),E=o(""),F=s((()=>{const e=[];return Z.login.is_username&&e.push({type:"username",title:P("usernameLogin")}),Z.login.is_mobile&&e.push({type:"mobile",title:P("mobileLogin")}),E.value=e[0]?e[0].type:"",e})),G=s((()=>({username:{type:"string",required:"username"==E.value,message:P("usernamePlaceholder"),trigger:["blur","change"]},password:{type:"string",required:"username"==E.value,message:P("passwordPlaceholder"),trigger:["blur","change"]},mobile:[{type:"string",required:"mobile"==E.value,message:P("mobilePlaceholder"),trigger:["blur","change"]},{validator:(e,l)=>"mobile"!=E.value||uni.$u.test.mobile(l),message:P("mobileError"),trigger:["change","blur"]}],mobile_code:{type:"string",required:"mobile"==E.value,message:P("codePlaceholder"),trigger:["blur","change"]}}))),H=o(null),I=()=>{H.value.validate().then((()=>{if(B.value)return;B.value=!0;("username"==E.value?y:h)(R).then((e=>{Y.setToken(e.data.token),v().handleLoginBack()})).catch((()=>{B.value=!1}))}))};return(e,l)=>{const a=j,r=k(w("u-input"),U),o=k(w("u-form-item"),q),s=k(w("sms-code"),L),y=V,h=k(w("app-link"),A),v=k(w("u-button"),C),Y=k(w("u-form"),S);return t(),u(a,{class:"w-screen h-screen flex flex-col"},{default:n((()=>[d(a,{class:"flex-1"},{default:n((()=>[d(a,{class:"h-[100rpx]"}),d(a,{class:"px-[60rpx] pt-[100rpx] mb-[100rpx]"},{default:n((()=>[d(a,{class:"font-bold text-xl"},{default:n((()=>[i(p(m(P)("login")),1)])),_:1})])),_:1}),m(F).length>1?(t(),u(a,{key:0,class:"px-[60rpx] text-sm flex mb-[50rpx] font-bold leading-none"},{default:n((()=>[(t(!0),c(g,null,b(m(F),((e,l)=>(t(),c(g,null,[d(a,{class:T({"text-gray-300":e.type!=E.value}),onClick:l=>E.value=e.type},{default:n((()=>[i(p(e.title),1)])),_:2},1032,["class","onClick"]),f(d(a,{class:"mx-[30rpx] border-solid border-0 border-r-[2px] border-gray-300"},null,512),[[x,0==l]])],64)))),256))])),_:1})):_("v-if",!0),d(a,{class:"px-[60rpx]"},{default:n((()=>[d(Y,{labelPosition:"left",model:R,errorType:"toast",rules:m(G),ref_key:"formRef",ref:H},{default:n((()=>[f(d(a,null,{default:n((()=>[d(o,{label:"",prop:"username","border-bottom":!0},{default:n((()=>[d(r,{modelValue:R.username,"onUpdate:modelValue":l[0]||(l[0]=e=>R.username=e),border:"none",clearable:"",placeholder:m(P)("usernamePlaceholder")},null,8,["modelValue","placeholder"])])),_:1}),d(a,{class:"mt-[40rpx]"},{default:n((()=>[d(o,{label:"",prop:"password","border-bottom":!0},{default:n((()=>[d(r,{modelValue:R.password,"onUpdate:modelValue":l[1]||(l[1]=e=>R.password=e),border:"none",type:"password",clearable:"",placeholder:m(P)("passwordPlaceholder")},null,8,["modelValue","placeholder"])])),_:1})])),_:1})])),_:1},512),[[x,"username"==E.value]]),f(d(a,null,{default:n((()=>[d(o,{label:"",prop:"mobile","border-bottom":!0},{default:n((()=>[d(r,{modelValue:R.mobile,"onUpdate:modelValue":l[2]||(l[2]=e=>R.mobile=e),border:"none",clearable:"",placeholder:m(P)("mobilePlaceholder")},null,8,["modelValue","placeholder"])])),_:1}),d(a,{class:"mt-[40rpx]"},{default:n((()=>[d(o,{label:"",prop:"mobile_code","border-bottom":!0},{default:n((()=>[d(r,{modelValue:R.mobile_code,"onUpdate:modelValue":l[4]||(l[4]=e=>R.mobile_code=e),border:"none",type:"password",clearable:"",placeholder:m(P)("codePlaceholder")},{suffix:n((()=>[d(s,{mobile:R.mobile,type:"login",modelValue:R.mobile_key,"onUpdate:modelValue":l[3]||(l[3]=e=>R.mobile_key=e)},null,8,["mobile","modelValue"])])),_:1},8,["modelValue","placeholder"])])),_:1})])),_:1})])),_:1},512),[[x,"mobile"==E.value]]),d(a,{class:"flex text-xs justify-between mt-[20rpx] text-gray-400"},{default:n((()=>[d(h,{url:"/app/pages/auth/register"},{default:n((()=>[i(p(m(P)("noAccount"))+" ",1),d(y,{class:"text-primary"},{default:n((()=>[i(p(m(P)("toRegister")),1)])),_:1})])),_:1}),d(h,{url:"/app/pages/auth/resetpwd"},{default:n((()=>[i(p(m(P)("resetpwd")),1)])),_:1})])),_:1}),d(a,{class:"mt-[80rpx]"},{default:n((()=>[d(v,{type:"primary",loading:B.value,loadingText:m(P)("logining"),onClick:I},{default:n((()=>[i(p(m(P)("login")),1)])),_:1},8,["loading","loadingText"])])),_:1})])),_:1},8,["model","rules"])])),_:1})])),_:1}),m(Z).login.agreement_show?(t(),u(a,{key:0,class:"text-xs py-[50rpx] flex justify-center w-full"},{default:n((()=>[i(p(m(P)("agreeTips"))+" ",1),d(h,{url:"/app/pages/auth/agreement?key=service"},{default:n((()=>[d(y,{class:"text-primary"},{default:n((()=>[i(p(m(P)("userAgreement")),1)])),_:1})])),_:1}),i(" "+p(m(P)("and"))+" ",1),d(h,{url:"/app/pages/auth/agreement?key=privacy"},{default:n((()=>[d(y,{class:"text-primary"},{default:n((()=>[i(p(m(P)("privacyAgreement")),1)])),_:1})])),_:1})])),_:1})):_("v-if",!0)])),_:1})}}});export{R as default};
|