goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
2 lines (1 loc) • 3.86 kB
JavaScript
import{_,L as T,q as P,v as w,x as b,r as d,o as g,c as O,a as n,b as o,w as i,j as k,t as u,e as f,p as x,k as I}from"./index-10e8cffd.js";import{a as C}from"./js.cookie-edb2da2a.js";import{a as v,s as y}from"./user.password-f4b2e9bc.js";const B={components:{Logo:T},data(){return{isWorking:{update:!1,sendOTP:!1},errorTip:"",form:{otpElement:"",otpCodeId:null,otpCode:"",newPassword:""},sendOTPData:{time:60,buttonText:"发送验证码"}}},computed:{disabledSendOTPButton(){return this.isWorking.sendOTP||this.form.otpElement.trim()===""?!0:!/^1[3456789]\d{9}$/.test(this.form.otpElement)},disabledConfirmButton(){return this.isWorking.update||this.form.newPassword.trim()===""||this.form.otpElement.trim()===""||!/^1[3456789]\d{9}$/.test(this.form.otpElement)?!0:this.form.otpCode.trim()===""}},methods:{...P(["setUserInfo"]),confirm(){if(!this.disabledConfirmButton&&this.check()){if(this.form.otpCodeId==null){this.errorTip="短信验证码不正确";return}this.isWorking.update=!0,this.form.newPassword=this.form.newPassword.trim(),v(this.form).then(e=>(C.set("x-kit-token",e),w(e))).then(()=>b()).then(e=>{this.setUserInfo(e),this.$router.push({name:"Desktop"})}).catch(e=>{this.errorTip=e.message}).finally(()=>{this.isWorking.update=!1})}},sendOTP(){this.disabledSendOTPButton||(this.errorTip="",this.isWorking.sendOTP=!0,y({mobile:this.form.otpElement}).then(e=>{this.form.otpCodeId=e,this.sendOTPData.buttonText=`${this.sendOTPData.time}s`;const t=setInterval(()=>{this.sendOTPData.time===0?(clearInterval(t),this.sendOTPData.buttonText="发送验证码",this.sendOTPData.time=60,this.isWorking.sendOTP=!1):(this.sendOTPData.time--,this.sendOTPData.buttonText=`${this.sendOTPData.time}s`)},1e3)}).catch(e=>{this.errorTip=e.message,this.isWorking.sendOTP=!1}))},check(){return this.form.newPassword.trim().length<6?(this.errorTip="密码长度至少为6位",!1):(this.errorTip="",!0)}}},h=e=>(x("data-v-ae4c6d93"),e=e(),I(),e),D={class:"page-wrap"},V={class:"wrap"},E=h(()=>n("h2",null,"设置新的登录密码",-1)),S=h(()=>n("p",{class:"tip"},"作为一个没有钱的初创团队,为了节省短信开支,我们关闭了短信登录功能,请您谅解!现在请通过验证短信验证码的方式设置新的登录密码,并牢牢的记住它。",-1)),W={class:"otp-input"},M={class:"text-danger",style:{height:"40px"}},U={class:"footer-wrap"};function z(e,t,L,N,s,r){const l=d("el-input"),p=d("el-form-item"),m=d("el-button"),c=d("el-form");return g(),O("div",D,[n("div",V,[E,S,o(c,{ref:"form",model:s.form,onSubmit:t[3]||(t[3]=k(()=>{},["stop"]))},{default:i(()=>[o(p,{label:"手机号码(仅支持中国大陆)",prop:"otpElement"},{default:i(()=>[o(l,{modelValue:s.form.otpElement,"onUpdate:modelValue":t[0]||(t[0]=a=>s.form.otpElement=a),size:"large",maxlength:"11",onInput:r.check},null,8,["modelValue","onInput"])]),_:1}),o(p,{label:"短信验证码",prop:"otpCode"},{default:i(()=>[n("div",W,[o(l,{modelValue:s.form.otpCode,"onUpdate:modelValue":t[1]||(t[1]=a=>s.form.otpCode=a),size:"large",maxlength:"4",onInput:r.check},null,8,["modelValue","onInput"]),o(m,{type:"primary",disabled:r.disabledSendOTPButton,onClick:r.sendOTP},{default:i(()=>[f(u(s.sendOTPData.buttonText),1)]),_:1},8,["disabled","onClick"])])]),_:1}),o(p,{class:"password-item",label:"新的登录密码",prop:"newPassword"},{default:i(()=>[o(l,{modelValue:s.form.newPassword,"onUpdate:modelValue":t[2]||(t[2]=a=>s.form.newPassword=a),"show-password":"",type:"password",size:"large",maxlength:"20",onInput:r.check},null,8,["modelValue","onInput"])]),_:1})]),_:1},8,["model"]),n("p",M,u(s.errorTip),1),n("div",U,[n("div",null,[o(m,{type:"important",disabled:r.disabledConfirmButton,onClick:r.confirm},{default:i(()=>[f("确认设置")]),_:1},8,["disabled","onClick"])])])])])}const F=_(B,[["render",z],["__scopeId","data-v-ae4c6d93"]]);export{F as default};