[fix 87354] 登录-登录时先去获取公钥
This commit is contained in:
+38
-34
@@ -278,7 +278,7 @@ export default {
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
this.getRouterData()
|
||||
this.handleChangeCheckCode()
|
||||
this.getPublicKey() // 获取秘钥
|
||||
// this.getPublicKey() // 获取秘钥
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['Login', 'Logout', 'PhoneLogin']),
|
||||
@@ -295,8 +295,10 @@ export default {
|
||||
const that = this
|
||||
const loginParams = {}
|
||||
that.loginBtn = true
|
||||
that.form.validateFields(['username', 'password', 'inputCode', 'rememberMe'], { force: true }, (err, values) => {
|
||||
that.form.validateFields(['username', 'password', 'inputCode', 'rememberMe'], { force: true }, async (err, values) => {
|
||||
if (!err) {
|
||||
// 获取公钥
|
||||
await this.getPublicKey()
|
||||
loginParams.remember_me = values.rememberMe
|
||||
loginParams.captcha = that.inputCodeContent
|
||||
loginParams.checkKey = that.currdatetime
|
||||
@@ -326,39 +328,39 @@ export default {
|
||||
e.preventDefault()
|
||||
const that = this
|
||||
this.form.validateFields(['mobile'], { force: true }, (err, values) => {
|
||||
if (!values.mobile) {
|
||||
that.cmsFailed('请输入手机号')
|
||||
} else if (!err) {
|
||||
this.state.smsSendBtn = true
|
||||
const interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000)
|
||||
if (!values.mobile) {
|
||||
that.cmsFailed('请输入手机号')
|
||||
} else if (!err) {
|
||||
this.state.smsSendBtn = true
|
||||
const 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)
|
||||
const smsParams = {}
|
||||
smsParams.mobile = values.mobile
|
||||
smsParams.smsmode = '0'
|
||||
postAction('/sys/sms', smsParams)
|
||||
.then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 0)
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
.catch(err => {
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
}
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
const smsParams = {}
|
||||
smsParams.mobile = values.mobile
|
||||
smsParams.smsmode = '0'
|
||||
postAction('/sys/sms', smsParams)
|
||||
.then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 0)
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
.catch(err => {
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
handleChangeCheckCode () {
|
||||
@@ -379,8 +381,10 @@ export default {
|
||||
// 获取RSA公钥
|
||||
getPublicKey () {
|
||||
// 获取公钥
|
||||
getRSAPublicKey().then(res => {
|
||||
return getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
},
|
||||
loginSuccess () {
|
||||
|
||||
Reference in New Issue
Block a user