From dd3cbcbd824f2952f55e26ee1d76cf32881478c9 Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Thu, 8 Aug 2024 11:27:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix:bug=E3=80=91-=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=81=E7=BC=96=E8=BE=91=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=97=B6=E8=8E=B7=E5=8F=96=E5=85=AC=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/modules/UserModal.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 对象