diff --git a/src/service/api/system/tenant.ts b/src/service/api/system/tenant.ts index 0fd939a1..0724a4c1 100644 --- a/src/service/api/system/tenant.ts +++ b/src/service/api/system/tenant.ts @@ -16,7 +16,7 @@ export function fetchCreateTenant(data: Api.System.TenantOperateParams) { method: 'post', headers: { isEncrypt: true, - repeatSubmit: true + repeatSubmit: false }, data }); diff --git a/src/service/api/system/user.ts b/src/service/api/system/user.ts index e7c03d86..df1c11d2 100644 --- a/src/service/api/system/user.ts +++ b/src/service/api/system/user.ts @@ -81,7 +81,8 @@ export function fetchResetUserPassword(userId: CommonType.IdType, password: stri url: '/system/user/resetPwd', method: 'put', headers: { - isEncrypt: true + isEncrypt: true, + repeatSubmit: false }, data: { userId, password } }); @@ -118,6 +119,9 @@ export function fetchUpdateUserPassword(data: Api.System.UserPasswordOperatePara return request({ url: '/system/user/profile/updatePwd', method: 'put', + headers: { + isEncrypt: true + }, data }); } diff --git a/src/typings/api/system.api.d.ts b/src/typings/api/system.api.d.ts index d91b0fef..c3df96eb 100644 --- a/src/typings/api/system.api.d.ts +++ b/src/typings/api/system.api.d.ts @@ -152,9 +152,10 @@ declare namespace Api { type UserProfileOperateParams = CommonType.RecordNullable>; /** user password operate params */ - type UserPasswordOperateParams = CommonType.RecordNullable< - Pick & { newPassword: string } - >; + type UserPasswordOperateParams = CommonType.RecordNullable<{ + oldPassword: string; + newPassword: string; + }>; /** user info */ type UserInfo = { diff --git a/src/views/_builtin/user-center/index.vue b/src/views/_builtin/user-center/index.vue index a603f4ef..de6ad42c 100644 --- a/src/views/_builtin/user-center/index.vue +++ b/src/views/_builtin/user-center/index.vue @@ -46,14 +46,14 @@ function createDefaultProfileModel(): ProfileModel { function createDefaultPasswordModel(): PasswordModel { return { - password: '', + oldPassword: '', confirmPassword: '', newPassword: '' }; } type ProfileRuleKey = Extract; -type PasswordRuleKey = Extract; +type PasswordRuleKey = Extract; const profileRules: Record = { nickName: createRequiredRule('昵称不能为空'), @@ -63,7 +63,7 @@ const profileRules: Record = { }; const passwordRules: Record = { - password: createRequiredRule('密码不能为空'), + oldPassword: createRequiredRule('旧密码不能为空'), confirmPassword: createRequiredRule('确认密码不能为空'), newPassword: createRequiredRule('新密码不能为空') }; @@ -90,7 +90,8 @@ async function updatePassword() { return; } startBtnLoading(); - const { error } = await fetchUpdateUserPassword(passwordModel); + const { oldPassword, newPassword } = passwordModel; + const { error } = await fetchUpdateUserPassword({ oldPassword, newPassword }); if (!error) { window.$message?.success('密码修改成功'); // 清空表单 @@ -185,7 +186,7 @@ async function updatePassword() { >