完善店务员工默认密码提示
This commit is contained in:
@@ -119,6 +119,13 @@
|
||||
</button>
|
||||
</div>
|
||||
</BaseModal>
|
||||
|
||||
<DefaultPasswordNoticeModal
|
||||
v-model="defaultPasswordNoticeVisible"
|
||||
title="密码已重置"
|
||||
message="该员工密码已重置为系统默认密码。请提醒员工首次登录后修改。"
|
||||
:password="defaultPasswordNoticePassword"
|
||||
/>
|
||||
</MobileShell>
|
||||
</template>
|
||||
|
||||
@@ -127,6 +134,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { KeyRound, Pencil, Trash2, Upload } from 'lucide-vue-next'
|
||||
import BaseModal from '@/components/BaseModal.vue'
|
||||
import DefaultPasswordNoticeModal from '@/components/DefaultPasswordNoticeModal.vue'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import LoadingState from '@/components/LoadingState.vue'
|
||||
import MobileShell from '@/components/MobileShell.vue'
|
||||
@@ -161,6 +169,8 @@ const resettingPassword = ref(false)
|
||||
const deletingEmployee = ref(false)
|
||||
const resetConfirmVisible = ref(false)
|
||||
const deleteConfirmVisible = ref(false)
|
||||
const defaultPasswordNoticeVisible = ref(false)
|
||||
const defaultPasswordNoticePassword = ref('')
|
||||
const employee = ref<Artist | null>(null)
|
||||
const editModalVisible = ref(false)
|
||||
const employeeId = computed(() => String(route.params.id))
|
||||
@@ -298,6 +308,20 @@ function errorMessage(error: { message?: string } | null, fallback: string): str
|
||||
return error?.message ? error.message : fallback
|
||||
}
|
||||
|
||||
async function resolveResetDefaultPassword(): Promise<string> {
|
||||
const response = await managerEmployeesApi.getResetDefaultPassword()
|
||||
const password = response.password.trim()
|
||||
if (!password) {
|
||||
throw new Error('默认密码为空,请先检查系统参数配置')
|
||||
}
|
||||
return password
|
||||
}
|
||||
|
||||
function showDefaultPasswordNotice(password: string): void {
|
||||
defaultPasswordNoticePassword.value = password
|
||||
defaultPasswordNoticeVisible.value = true
|
||||
}
|
||||
|
||||
const loadEmployee = async (): Promise<void> => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -387,7 +411,11 @@ const confirmResetPassword = async (): Promise<void> => {
|
||||
try {
|
||||
await managerEmployeesApi.resetPassword(employee.value.userId || employeeId.value)
|
||||
resetConfirmVisible.value = false
|
||||
toast.success('密码已重置为系统默认密码')
|
||||
try {
|
||||
showDefaultPasswordNotice(await resolveResetDefaultPassword())
|
||||
} catch (error) {
|
||||
toast.error(errorMessage(error as { message?: string } | null, '密码已重置,但默认密码获取失败'))
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error(errorMessage(error as { message?: string } | null, '密码重置失败,请稍后重试'))
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user