diff --git a/src/pages/src/components/ChangePassword.vue b/src/pages/src/components/ChangePassword.vue new file mode 100644 index 000000000..3fb9e7565 --- /dev/null +++ b/src/pages/src/components/ChangePassword.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/pages/src/http/personalCenterFiles.ts b/src/pages/src/http/personalCenterFiles.ts index d742adca1..e94814b19 100644 --- a/src/pages/src/http/personalCenterFiles.ts +++ b/src/pages/src/http/personalCenterFiles.ts @@ -3,6 +3,7 @@ import type { PatchUserEmailParams, PatchUserLogoParams, PatchUserPhoneParams, + PutUserPasswordParams, } from './types/personalCenterFiles'; /** @@ -39,3 +40,8 @@ export const getPersonalCenterUserVisibleFields = (id: string) => http.get(`/api * 修改用户自定义字段 */ export const putPersonalCenterUserExtrasFields = (params: any) => http.put(`/api/v1/web/personal-center/tenant-users/${params.id}/extras/`, params); + +/** + * 个人中心修改密码 + */ +export const putPersonalCenterUserPassword = (params: PutUserPasswordParams) => http.put(`/api/v1/web/personal-center/tenant-users/${params.id}/password/`, params); diff --git a/src/pages/src/http/types/personalCenterFiles.ts b/src/pages/src/http/types/personalCenterFiles.ts index dcd06ed93..270a2b44a 100644 --- a/src/pages/src/http/types/personalCenterFiles.ts +++ b/src/pages/src/http/types/personalCenterFiles.ts @@ -24,3 +24,12 @@ export interface PatchUserLogoParams { id: string, logo: string, } + +/** + * 租户用户更新密码 + */ +export interface PutUserPasswordParams { + id: string, + old_password: string, + new_password: string, +} diff --git a/src/pages/src/views/personal-center/index.vue b/src/pages/src/views/personal-center/index.vue index 30e9381e8..72b523116 100644 --- a/src/pages/src/views/personal-center/index.vue +++ b/src/pages/src/views/personal-center/index.vue @@ -90,6 +90,9 @@
+ + 修改密码 + @@ -303,6 +310,7 @@ import { bkTooltips as vBkTooltips, Message } from 'bkui-vue'; import { computed, inject, nextTick, onMounted, ref, watch } from 'vue'; +import ChangePassword from '@/components/ChangePassword.vue'; import phoneInput from '@/components/phoneInput.vue'; import useValidate from '@/hooks/use-validate'; import { useCustomFields } from '@/hooks/useCustomFields'; @@ -484,7 +492,7 @@ const changeEmail = async () => { custom_email: currentUserInfo.value.custom_email, }).then(() => { isEditEmail.value = false; - isEditFn(); + isEditing(); }); }; // 取消编辑邮箱 @@ -492,7 +500,7 @@ const cancelEditEmail = () => { currentUserInfo.value.is_inherited_email = isInheritedEmail.value; currentUserInfo.value.custom_email = customEmail.value; isEditEmail.value = false; - isEditFn(); + isEditing(); }; const isEditPhone = ref(false); @@ -524,7 +532,7 @@ const changePhone = () => { custom_phone_country_code: currentUserInfo.value.custom_phone_country_code, }).then(() => { isEditPhone.value = false; - isEditFn(); + isEditing(); }); }; // 取消编辑手机号 @@ -534,7 +542,7 @@ const cancelEditPhone = () => { currentUserInfo.value.custom_phone_country_code = customPhoneCode.value; isEditPhone.value = false; telError.value = false; - isEditFn(); + isEditing(); }; // 切换关联账号 const handleClickItem = async (item) => { @@ -586,10 +594,26 @@ const handleError = (file) => { }; // 是否是编辑状态 -const isEditFn = () => { +const isEditing = () => { const allFalse = currentUserInfo.value?.extras.every(item => !item.isEdit); window.changeInput = !(allFalse && isEditEmail.value === false && isEditPhone.value === false); }; + +// 修改密码 +const passwordModalConfig = ref({ + isShow: false, + title: '修改密码', + id: '', +}); + +const showPasswordModal = () => { + passwordModalConfig.value.isShow = true; + passwordModalConfig.value.id = currentUserInfo.value?.id; +}; + +const hidePasswordModal = () => { + passwordModalConfig.value.isShow = false; +};