|
@@ -55,26 +55,36 @@ export default {
|
|
|
//发送验证码
|
|
|
handlePostCode() {
|
|
|
if(this.sending) return
|
|
|
- const params = {
|
|
|
- action: '0', // 注册用户
|
|
|
- receiver: this.form.username
|
|
|
- }
|
|
|
- if(this.regPhone.test(this.form.username)) params.type = '1'
|
|
|
- if(this.regEmail.test(this.form.username)) params.type = '0'
|
|
|
- this.$axios.get('auth/getVerifyCode', {params}).then((res)=> {
|
|
|
- if(res.code === 200) {
|
|
|
- this.sending = true
|
|
|
- let interval = setInterval(() => {
|
|
|
- this.clock--
|
|
|
- if(this.clock === 0) {
|
|
|
- clearInterval(interval)
|
|
|
- interval = null
|
|
|
- this.clock = 60
|
|
|
- this.sending = false
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
+ if(!this.regPhone.test(this.form.username) && !this.regEmail.test(this.form.username)) {
|
|
|
+ this.errMsg = '手机号/邮箱格式不对'
|
|
|
+ }else if(this.form.password !== this.form.passwordConfirm) {
|
|
|
+ this.errMsg = '两次输入的密码不一致'
|
|
|
+ }else if(this.form.password.length < 6) {
|
|
|
+ this.errMsg = '密码位数不能少于6位'
|
|
|
+ }else if(this.form.password.length> 16){
|
|
|
+ this.errMsg = '密码位数不能大于16位'
|
|
|
+ }else{
|
|
|
+ const params = {
|
|
|
+ action: '0', // 注册用户
|
|
|
+ receiver: this.form.username
|
|
|
}
|
|
|
- })
|
|
|
+ if(this.regPhone.test(this.form.username)) params.type = '1'
|
|
|
+ if(this.regEmail.test(this.form.username)) params.type = '0'
|
|
|
+ this.$axios.get('auth/getVerifyCode', {params}).then((res)=> {
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.sending = true
|
|
|
+ let interval = setInterval(() => {
|
|
|
+ this.clock--
|
|
|
+ if(this.clock === 0) {
|
|
|
+ clearInterval(interval)
|
|
|
+ interval = null
|
|
|
+ this.clock = 60
|
|
|
+ this.sending = false
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//登录
|
|
|
handlerLogin() {
|