UNPKG

goldpankit

Version:

GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。

2 lines (1 loc) 3.82 kB
import{_,L as T,s as P,v as b,x as w,r as d,o as O,c as g,a as n,b as s,w as i,k,t as u,e as f,p as x,l as I}from"./index-8602688b.js";import{a as C}from"./js.cookie-edb2da2a.js";import{a as v,s as y}from"./user.password-1d9b9ec3.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),b(e))).then(()=>w()).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-99a57b2a"),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 L(e,t,N,j,o,r){const l=d("el-input"),p=d("el-form-item"),m=d("el-button"),c=d("el-form");return O(),g("div",D,[n("div",V,[E,S,s(c,{ref:"form",model:o.form,onSubmit:t[3]||(t[3]=k(()=>{},["stop"]))},{default:i(()=>[s(p,{label:"手机号码(仅支持中国大陆)",prop:"otpElement"},{default:i(()=>[s(l,{modelValue:o.form.otpElement,"onUpdate:modelValue":t[0]||(t[0]=a=>o.form.otpElement=a),maxlength:"11",onInput:r.check},null,8,["modelValue","onInput"])]),_:1}),s(p,{label:"短信验证码",prop:"otpCode"},{default:i(()=>[n("div",W,[s(l,{modelValue:o.form.otpCode,"onUpdate:modelValue":t[1]||(t[1]=a=>o.form.otpCode=a),maxlength:"4",onInput:r.check},null,8,["modelValue","onInput"]),s(m,{type:"primary",disabled:r.disabledSendOTPButton,onClick:r.sendOTP},{default:i(()=>[f(u(o.sendOTPData.buttonText),1)]),_:1},8,["disabled","onClick"])])]),_:1}),s(p,{class:"password-item",label:"新的登录密码",prop:"newPassword"},{default:i(()=>[s(l,{modelValue:o.form.newPassword,"onUpdate:modelValue":t[2]||(t[2]=a=>o.form.newPassword=a),"show-password":"",type:"password",maxlength:"20",onInput:r.check},null,8,["modelValue","onInput"])]),_:1})]),_:1},8,["model"]),n("p",M,u(o.errorTip),1),n("div",U,[n("div",null,[s(m,{type:"important",disabled:r.disabledConfirmButton,onClick:r.confirm},{default:i(()=>[f("确认设置")]),_:1},8,["disabled","onClick"])])])])])}const F=_(B,[["render",L],["__scopeId","data-v-99a57b2a"]]);export{F as default};