手机号获取验证码校验修改
This commit is contained in:
+12
-12
@@ -157,7 +157,6 @@ import { getAction } from '@/api/manage'
|
||||
import { getRSAPublicKey } from '@/api/login.js'
|
||||
import { JSEncrypt } from 'jsencrypt'
|
||||
import { phoneReg } from '@/utils/validate'
|
||||
// import { phoneLogin } from '@/api/login.js'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
@@ -292,27 +291,28 @@ export default {
|
||||
if (!values.username) {
|
||||
that.cmsFailed('请输入手机号')
|
||||
} else if (!err) {
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
let smsParams = {}
|
||||
smsParams.phone = values.username
|
||||
let interval
|
||||
getAction('/company/sendVerificationCode', smsParams)
|
||||
.then(res => {
|
||||
// 验证码获取不成功就不倒计时
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 0)
|
||||
this.cmsFailed(res.message)
|
||||
} else {
|
||||
this.state.smsSendBtn = true
|
||||
interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
.catch(err => {
|
||||
}).catch(err => {
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
|
||||
@@ -150,7 +150,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
document.title='标准所协同工作平台'
|
||||
document.title = '标准所协同工作平台'
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['FirstPhoneLogin']),
|
||||
@@ -235,27 +235,31 @@ export default {
|
||||
this.cmsFailed('手机号不能为空!')
|
||||
return
|
||||
}
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
this.form.validateFields(['phone'], { force: true }, (err) => {
|
||||
if (!err) {
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
let smsParams = {
|
||||
phone: phone
|
||||
}
|
||||
getAction('/company/sendVerificationCode', smsParams).then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 1)
|
||||
this.cmsFailed(res.message)
|
||||
} else {
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
this.getPublicKey()
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
let smsParams = {
|
||||
phone: phone
|
||||
}
|
||||
getAction('/company/sendVerificationCode', smsParams).then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 1)
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
this.getPublicKey()
|
||||
},
|
||||
cmsFailed(err) {
|
||||
this.$notification['error']({
|
||||
|
||||
Reference in New Issue
Block a user