【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.loadRolesTreeData()
// 获取公钥 // 获取公钥
this.getPublicKey() // this.getPublicKey()
let that = this let that = this
that.initialRoleList() that.initialRoleList()
that.checkedDepartNameString = '' that.checkedDepartNameString = ''
@@ -479,9 +479,14 @@ 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)
})
}) })
}, },
loadCheckedDeparts() { loadCheckedDeparts() {
let that = this let that = this
@@ -538,7 +543,7 @@ export default {
console.log('username', this.form.getFieldValue('username')) console.log('username', this.form.getFieldValue('username'))
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
console.log('values=======', values) console.log('values=======', values)
@@ -548,6 +553,7 @@ export default {
} else { } else {
formData.avatar = null formData.avatar = null
} }
await this.getPublicKey()
// 公钥参数 // 公钥参数
formData.rsaPublicKey = that.rsaPublicKey formData.rsaPublicKey = that.rsaPublicKey
// 新建 JSEncrypt 对象 // 新建 JSEncrypt 对象