mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-06 04:58:10 +00:00
2 lines
6.9 KiB
JavaScript
2 lines
6.9 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 d,k as i,K as n,L as p,n as m,F as c,H as b,G as _,m as g,l as f,v as h,a4 as x,a5 as y,a0 as v,x as w,q as V,t as k,M as j,N as P,Z as U,I as q}from"./index-59b72094.js";import{_ as S,a as T,b as A}from"./u-form.a20c08e5.js";import{u as C,_ as L}from"./sms-code.vue_vue_type_script_setup_true_lang.8021dd43.js";import{_ as R}from"./app-link.vue_vue_type_script_setup_true_lang.b6496d1c.js";import{_ as E}from"./u-button.0f6f73b7.js";import"./u-icon.4046c188.js";import"./_plugin-vue_export-helper.1b428a4d.js";import"./u-line.9ef7233b.js";import"./u-modal.30bfd23d.js";import"./u-loading-icon.85becb71.js";import"./u-popup.94ffd479.js";import"./u-transition.4588f416.js";import"./u-safe-bottom.1b1ffd7b.js";const F=e({__name:"register",setup(e){const F=l({username:"",password:"",confirm_password:"",mobile:"",mobile_code:"",mobile_key:"",captcha_key:"",captcha_code:""});uni.getStorageSync("openid")&&Object.assign(F,{openid:uni.getStorageSync("openid")});const N=C(F);N.refresh();const O=a(),Y=r(),Z=o(!1),$=o(""),B=s((()=>{const e=[];return Y.login.is_username&&e.push({type:"username",title:U("usernameRegister")}),Y.login.is_mobile&&!Y.login.is_bind_mobile&&e.push({type:"mobile",title:U("mobileRegister")}),$.value=e[0]?e[0].type:"",e})),G=s((()=>({username:{type:"string",required:"username"==$.value,message:U("usernamePlaceholder"),trigger:["blur","change"]},password:{type:"string",required:"username"==$.value,message:U("passwordPlaceholder"),trigger:["blur","change"]},confirm_password:[{type:"string",required:"username"==$.value,message:U("confirmPasswordPlaceholder"),trigger:["blur","change"]},{validator:(e,l)=>l==F.password,message:U("confirmPasswordError"),trigger:["change","blur"]}],mobile:[{type:"string",required:"mobile"==$.value||Y.login.is_bind_mobile,message:U("mobilePlaceholder"),trigger:["blur","change"]},{validator:(e,l)=>"mobile"!=$.value&&!Y.login.is_bind_mobile||uni.$u.test.mobile(l),message:U("mobileError"),trigger:["change","blur"]}],mobile_code:{type:"string",required:"mobile"==$.value||Y.login.is_bind_mobile,message:U("codePlaceholder"),trigger:["blur","change"]},captcha_code:{type:"string",required:"username"==$.value,message:U("captchaPlaceholder"),trigger:["blur","change"]}}))),H=o(null),I=()=>{H.value.validate().then((()=>{if(Z.value)return;Z.value=!0;("username"==$.value?x:y)(F).then((e=>{O.setToken(e.data.token),v().handleLoginBack()})).catch((()=>{Z.value=!1,N.refresh()}))}))};return(e,l)=>{const a=w,r=V(k("u-input"),S),o=V(k("u-form-item"),T),s=V(k("sms-code"),L),x=j,y=P,v=V(k("app-link"),R),C=V(k("u-button"),E),O=V(k("u-form"),A);return t(),u(a,{class:"w-screen h-screen flex flex-col"},{default:d((()=>[i(a,{class:"flex-1"},{default:d((()=>[i(a,{class:"h-[100rpx]"}),i(a,{class:"px-[60rpx] pt-[100rpx] mb-[100rpx]"},{default:d((()=>[i(a,{class:"font-bold text-xl"},{default:d((()=>[n(p(m(U)("register")),1)])),_:1})])),_:1}),m(B).length>1?(t(),u(a,{key:0,class:"px-[60rpx] text-sm flex mb-[50rpx] font-bold leading-none"},{default:d((()=>[(t(!0),c(_,null,b(m(B),((e,l)=>(t(),c(_,null,[i(a,{class:q({"text-gray-300":e.type!=$.value}),onClick:l=>$.value=e.type},{default:d((()=>[n(p(e.title),1)])),_:2},1032,["class","onClick"]),f(i(a,{class:"mx-[30rpx] border-solid border-0 border-r-[2px] border-gray-300"},null,512),[[h,0==l]])],64)))),256))])),_:1})):g("v-if",!0),i(a,{class:"px-[60rpx]"},{default:d((()=>[i(O,{labelPosition:"left",model:F,errorType:"toast",rules:m(G),ref_key:"formRef",ref:H},{default:d((()=>[f(i(a,null,{default:d((()=>[i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"username","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.username,"onUpdate:modelValue":l[0]||(l[0]=e=>F.username=e),border:"none",clearable:"",placeholder:m(U)("usernamePlaceholder")},null,8,["modelValue","placeholder"])])),_:1})])),_:1}),i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"password","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.password,"onUpdate:modelValue":l[1]||(l[1]=e=>F.password=e),border:"none",type:"password",clearable:"",placeholder:m(U)("passwordPlaceholder")},null,8,["modelValue","placeholder"])])),_:1})])),_:1}),i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"confirm_password","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.confirm_password,"onUpdate:modelValue":l[2]||(l[2]=e=>F.confirm_password=e),border:"none",type:"password",clearable:"",placeholder:m(U)("confirmPasswordPlaceholder")},null,8,["modelValue","placeholder"])])),_:1})])),_:1})])),_:1},512),[[h,"username"==$.value]]),f(i(a,null,{default:d((()=>[i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"mobile","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.mobile,"onUpdate:modelValue":l[3]||(l[3]=e=>F.mobile=e),border:"none",clearable:"",placeholder:m(U)("mobilePlaceholder")},null,8,["modelValue","placeholder"])])),_:1})])),_:1}),i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"code","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.mobile_code,"onUpdate:modelValue":l[5]||(l[5]=e=>F.mobile_code=e),border:"none",type:"password",clearable:"",placeholder:m(U)("codePlaceholder")},{suffix:d((()=>[i(s,{mobile:F.mobile,type:"register",modelValue:F.mobile_key,"onUpdate:modelValue":l[4]||(l[4]=e=>F.mobile_key=e)},null,8,["mobile","modelValue"])])),_:1},8,["modelValue","placeholder"])])),_:1})])),_:1})])),_:1},512),[[h,"mobile"==$.value||m(Y).login.is_bind_mobile]]),f(i(a,null,{default:d((()=>[i(a,{class:"mt-[30rpx]"},{default:d((()=>[i(o,{label:"",prop:"captcha_code","border-bottom":!0},{default:d((()=>[i(r,{modelValue:F.captcha_code,"onUpdate:modelValue":l[7]||(l[7]=e=>F.captcha_code=e),border:"none",clearable:"",placeholder:m(U)("captchaPlaceholder")},{suffix:d((()=>[i(x,{src:m(N).image.value,class:"h-[48rpx] ml-[20rpx]",mode:"heightFix",onClick:l[6]||(l[6]=e=>m(N).refresh())},null,8,["src"])])),_:1},8,["modelValue","placeholder"])])),_:1})])),_:1})])),_:1},512),[[h,"username"==$.value]]),i(a,{class:"flex text-xs justify-between mt-[20rpx] text-gray-400"},{default:d((()=>[i(v,{url:"/app/pages/auth/login"},{default:d((()=>[n(p(m(U)("haveAccount"))+",",1),i(y,{class:"text-primary"},{default:d((()=>[n(p(m(U)("toLogin")),1)])),_:1})])),_:1})])),_:1}),i(a,{class:"mt-[80rpx]"},{default:d((()=>[i(C,{type:"primary",loading:Z.value,loadingText:m(U)("registering"),onClick:I},{default:d((()=>[n(p(m(U)("register")),1)])),_:1},8,["loading","loadingText"])])),_:1})])),_:1},8,["model","rules"])])),_:1})])),_:1}),m(Y).login.agreement_show?(t(),u(a,{key:0,class:"text-xs py-[50rpx] flex justify-center w-full"},{default:d((()=>[n(p(m(U)("registerAgreeTips"))+" ",1),i(v,{url:"/app/pages/auth/agreement?key=service"},{default:d((()=>[i(y,{class:"text-primary"},{default:d((()=>[n(p(m(U)("userAgreement")),1)])),_:1})])),_:1}),n(" "+p(m(U)("and"))+" ",1),i(v,{url:"/app/pages/auth/agreement?key=privacy"},{default:d((()=>[i(y,{class:"text-primary"},{default:d((()=>[n(p(m(U)("privacyAgreement")),1)])),_:1})])),_:1})])),_:1})):g("v-if",!0)])),_:1})}}});export{F as default};
|