1.初次登录必须修改密码

This commit is contained in:
1638245306
2024-11-06 13:09:09 +08:00
parent 436a722ce8
commit 421e89823a
8 changed files with 49 additions and 13 deletions

View File

@@ -44,7 +44,7 @@ export async function initBackEndControlRoutes() {
if (!Session.get('token')) return false;
// 触发初始化用户信息 pinia
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
await useUserInfo().setUserInfos();
await useUserInfo().getApiUserInfo();
// 获取路由菜单数据
const res = await getBackEndControlRoutes();
// 无登录权限时,添加判断

View File

@@ -28,6 +28,8 @@ import {checkVersion} from "/@/utils/upgrade";
const storesThemeConfig = useThemeConfig(pinia);
const {themeConfig} = storeToRefs(storesThemeConfig);
const {isRequestRoutes} = themeConfig.value;
import {useUserInfo} from "/@/stores/userInfo";
const { userInfos } = storeToRefs(useUserInfo());
/**
* 创建一个可以被 Vue 应用程序使用的路由实例
@@ -111,7 +113,10 @@ router.beforeEach(async (to, from, next) => {
next(`/login?redirect=${to.path}&params=${JSON.stringify(to.query ? to.query : to.params)}`);
Session.clear();
NProgress.done();
} else if (token && to.path === '/login') {
}else if (token && to.path === '/login' && userInfos.value.pwd_change_count===0 ) {
next('/login');
NProgress.done();
} else if (token && to.path === '/login' && userInfos.value.pwd_change_count>0) {
next('/home');
NProgress.done();
}else if(token && frameOutRoutes.includes(to.path) ){