diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue index 7aaaa0b..f862a5b 100644 --- a/src/views/system/modules/UserModal.vue +++ b/src/views/system/modules/UserModal.vue @@ -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 对象