feat:新增密码过期修改页面逻辑

This commit is contained in:
秋帆
2024-06-15 14:46:04 +08:00
parent 8bc3992214
commit 921d9c63e9
9 changed files with 567 additions and 65 deletions

View File

@@ -53,6 +53,11 @@ export const constantRoutes: RouteRecordRaw[] = [
component: () => import('@/views/login/social/index.vue'),
meta: { hidden: true }
},
{
path: '/pwdExpired',
component: () => import('@/views/login/pwdExpired/index.vue'),
meta: { hidden: true }
},
{
path: '/setting',
name: 'Setting',

View File

@@ -1,10 +1,11 @@
import { Message } from '@arco-design/web-vue'
import router from '@/router'
import { useRouteStore, useUserStore } from '@/stores'
import { getToken } from '@/utils/auth'
import { isHttp } from '@/utils/validate'
/** 免登录白名单 */
const whiteList = ['/login', '/social/callback']
const whiteList = ['/login', '/social/callback', '/pwdExpired']
/** 是否已经生成过路由表 */
let hasRouteFlag = false
@@ -25,6 +26,10 @@ router.beforeEach(async (to, from, next) => {
if (!hasRouteFlag) {
try {
await userStore.getInfo()
if (userStore.userInfo.pwdExpired && to.path !== '/pwdExpired') {
Message.warning('密码已过期,请修改密码')
next('/pwdExpired')
}
const accessRoutes = await routeStore.generateRoutes()
accessRoutes.forEach((route) => {
if (!isHttp(route.path)) {