【fix:bug】- 用户新增、编辑上传时获取公钥

This commit is contained in:
fengchenchen
2024-08-08 11:27:49 +08:00
parent c839e1b89c
commit dd3cbcbd82
+10 -4
View File
@@ -392,7 +392,7 @@ export default {
// 加载角色数据
this.loadRolesTreeData()
// 获取公钥
this.getPublicKey()
// this.getPublicKey()
let that = this
that.initialRoleList()
that.checkedDepartNameString = ''
@@ -479,9 +479,14 @@ 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)
})
})
},
loadCheckedDeparts() {
let that = this
@@ -538,7 +543,7 @@ export default {
console.log('username', this.form.getFieldValue('username'))
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
this.form.validateFields(async (err, values) => {
if (!err) {
that.confirmLoading = true
console.log('values=======', values)
@@ -548,6 +553,7 @@ export default {
} else {
formData.avatar = null
}
await this.getPublicKey()
// 公钥参数
formData.rsaPublicKey = that.rsaPublicKey
// 新建 JSEncrypt 对象