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