|
|
@@ -21,6 +21,8 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { updateUserPwd } from "@/api/system/user"
|
|
|
+import { encryptAES, decryptAES } from '@/utils/cryptoAES'
|
|
|
+import { getIsKey } from '@/utils/crypto'
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
@@ -48,9 +50,18 @@ const rules = ref({
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
function submit() {
|
|
|
- proxy.$refs.pwdRef.validate(valid => {
|
|
|
+ proxy.$refs.pwdRef.validate(async valid => {
|
|
|
if (valid) {
|
|
|
- updateUserPwd(user.oldPassword, user.newPassword).then(response => {
|
|
|
+ let requestForm = {...user}
|
|
|
+ try {
|
|
|
+ const keyObj = await getIsKey()
|
|
|
+ const isKey = keyObj["data"];
|
|
|
+ if("1" === isKey || 1 === isKey){
|
|
|
+ requestForm.oldPassword = encryptAES(user.oldPassword)
|
|
|
+ requestForm.newPassword = encryptAES(user.newPassword)
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ updateUserPwd(requestForm.oldPassword, requestForm.newPassword).then(response => {
|
|
|
proxy.$modal.msgSuccess("修改成功")
|
|
|
})
|
|
|
}
|