|
@@ -15,11 +15,18 @@ import {
|
|
|
} from '@vben/layouts';
|
|
} from '@vben/layouts';
|
|
|
import { preferences } from '@vben/preferences';
|
|
import { preferences } from '@vben/preferences';
|
|
|
import { useAccessStore, useUserStore } from '@vben/stores';
|
|
import { useAccessStore, useUserStore } from '@vben/stores';
|
|
|
|
|
+
|
|
|
|
|
+import { ElMessageBox } from 'element-plus';
|
|
|
// import { openWindow } from '@vben/utils';
|
|
// import { openWindow } from '@vben/utils';
|
|
|
|
|
|
|
|
// import { $t } from '#/locales';
|
|
// import { $t } from '#/locales';
|
|
|
import { useAuthStore } from '#/store';
|
|
import { useAuthStore } from '#/store';
|
|
|
import LoginForm from '#/views/_core/authentication/login.vue';
|
|
import LoginForm from '#/views/_core/authentication/login.vue';
|
|
|
|
|
+import ChangePasswordForm from '#/views/system-manage/user-manage/change-password-form.vue';
|
|
|
|
|
+
|
|
|
|
|
+const changePasswordFormRef = ref<InstanceType<
|
|
|
|
|
+ typeof ChangePasswordForm
|
|
|
|
|
+> | null>(null);
|
|
|
|
|
|
|
|
const notifications = ref<NotificationItem[]>([
|
|
const notifications = ref<NotificationItem[]>([
|
|
|
// {
|
|
// {
|
|
@@ -60,10 +67,18 @@ const showDot = computed(() =>
|
|
|
notifications.value.some((item) => !item.isRead),
|
|
notifications.value.some((item) => !item.isRead),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+function handleChangePassword() {
|
|
|
|
|
+ if (userStore.userInfo?.accountid) {
|
|
|
|
|
+ changePasswordFormRef.value?.openModal({
|
|
|
|
|
+ accountid: userStore.userInfo.accountid,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const menus = computed(() => [
|
|
const menus = computed(() => [
|
|
|
{
|
|
{
|
|
|
handler: () => {
|
|
handler: () => {
|
|
|
- // ...
|
|
|
|
|
|
|
+ handleChangePassword();
|
|
|
},
|
|
},
|
|
|
icon: MdiOnepassword,
|
|
icon: MdiOnepassword,
|
|
|
text: '修改密码',
|
|
text: '修改密码',
|
|
@@ -135,6 +150,21 @@ watch(
|
|
|
immediate: true,
|
|
immediate: true,
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
|
|
+// 修改密码完成后回调
|
|
|
|
|
+const handleFinish = () => {
|
|
|
|
|
+ ElMessageBox.confirm('密码修改成功,请重新登录', '提示', {
|
|
|
|
|
+ confirmButtonText: '重新登录',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(async () => {
|
|
|
|
|
+ await handleLogout();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {
|
|
|
|
|
+ // catch cancel action
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -169,4 +199,5 @@ watch(
|
|
|
<LockScreen :avatar @to-login="handleLogout" />
|
|
<LockScreen :avatar @to-login="handleLogout" />
|
|
|
</template>
|
|
</template>
|
|
|
</BasicLayout>
|
|
</BasicLayout>
|
|
|
|
|
+ <ChangePasswordForm ref="changePasswordFormRef" @finish="handleFinish" />
|
|
|
</template>
|
|
</template>
|