【update】-所有获取公钥的接口 在使用前获取
This commit is contained in:
@@ -83,7 +83,6 @@ export default {
|
||||
id: uId,
|
||||
email: uEmail
|
||||
}
|
||||
this.getPublicKey()
|
||||
let timer = setTimeout(() => {
|
||||
this.form.setFieldsValue({ email: this.model.email })
|
||||
clearTimeout(timer)
|
||||
@@ -93,17 +92,22 @@ export default {
|
||||
}
|
||||
},
|
||||
getPublicKey() {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
return new Promise(resolve => {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).finally(() => {
|
||||
resolve(this.rsaPublicKey)
|
||||
})
|
||||
})
|
||||
},
|
||||
handleOk() {
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
this.form.validateFields(async (err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true
|
||||
let params = Object.assign(this.model, values)
|
||||
await this.getPublicKey()
|
||||
params.emailPassword = encrypt(this.rsaPublicKey, values.emailPassword)
|
||||
params.rsaPublicKey = this.rsaPublicKey
|
||||
console.log('修改授权码提交数据', params)
|
||||
|
||||
@@ -125,14 +125,17 @@ export default {
|
||||
return
|
||||
} else {
|
||||
this.username = uname
|
||||
this.getPublicKey()
|
||||
this.form.resetFields()
|
||||
this.visible = true
|
||||
}
|
||||
},
|
||||
getPublicKey() {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
return new Promise(resolve => {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).finally(() => {
|
||||
resolve(this.rsaPublicKey)
|
||||
})
|
||||
})
|
||||
},
|
||||
handleCancel() {
|
||||
@@ -147,9 +150,10 @@ export default {
|
||||
handleOk() {
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
this.form.validateFields(async (err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true
|
||||
await this.getPublicKey()
|
||||
let params = {}
|
||||
params.username = this.username
|
||||
params.rsaPublicKey = this.rsaPublicKey
|
||||
|
||||
@@ -122,7 +122,6 @@ export default {
|
||||
},
|
||||
edit(record) {
|
||||
this.form.resetFields()
|
||||
this.getRSAPublicKeyFunc()
|
||||
this.model = Object.assign({}, record)
|
||||
// 回显企业
|
||||
this.model.companyId = {
|
||||
@@ -148,8 +147,15 @@ export default {
|
||||
* 获取公钥
|
||||
* */
|
||||
getRSAPublicKeyFunc() {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
// getRSAPublicKey().then(res => {
|
||||
// this.rsaPublicKey = res.result
|
||||
// })
|
||||
return new Promise(resolve => {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).finally(() => {
|
||||
resolve(this.rsaPublicKey)
|
||||
})
|
||||
})
|
||||
},
|
||||
close() {
|
||||
@@ -164,7 +170,7 @@ export default {
|
||||
this.confirmLoading = true
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
this.form.validateFields(async (err, values) => {
|
||||
if (!err) {
|
||||
let httpurl = ''
|
||||
let method = 'post'
|
||||
@@ -173,6 +179,7 @@ export default {
|
||||
} else {
|
||||
httpurl += this.url.edit
|
||||
}
|
||||
await this.getRSAPublicKeyFunc()
|
||||
const formData = Object.assign(this.model, values)
|
||||
formData.companyName = this.selectedCompany.companyName
|
||||
formData.companyId = this.selectedCompany.id
|
||||
|
||||
@@ -150,8 +150,9 @@ export default {
|
||||
let that = this
|
||||
let 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
|
||||
@@ -243,13 +244,16 @@ export default {
|
||||
}).catch(()=>{
|
||||
this.requestCodeSuccess=false
|
||||
})
|
||||
this.getPublicKey()
|
||||
},
|
||||
//获取RSA公钥
|
||||
getPublicKey(){
|
||||
// 获取公钥
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
return new Promise(resolve => {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).finally(() => {
|
||||
resolve(this.rsaPublicKey)
|
||||
})
|
||||
})
|
||||
},
|
||||
loginSuccess () {
|
||||
|
||||
@@ -180,9 +180,10 @@ export default {
|
||||
submit() {
|
||||
let that = this
|
||||
that.loading = true
|
||||
this.form.validateFields((err, values) => {
|
||||
this.form.validateFields(async (err, values) => {
|
||||
if (!err) {
|
||||
let params = {}
|
||||
await this.getPublicKey()
|
||||
console.log(values, '======values')
|
||||
params.rsaPublicKey = this.rsaPublicKey
|
||||
let encrypt = new JSEncrypt()
|
||||
@@ -271,7 +272,6 @@ export default {
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
this.getPublicKey()
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -283,8 +283,12 @@ export default {
|
||||
})
|
||||
},
|
||||
getPublicKey() {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
return new Promise(resolve => {
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
}).finally(() => {
|
||||
resolve(this.rsaPublicKey)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 密码禁止粘贴
|
||||
|
||||
Reference in New Issue
Block a user