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