feat:增加根据用户权限判断当用户进入管理员端展示的界面。

This commit is contained in:
wyx
2023-03-15 15:07:36 +08:00
parent fa431338c8
commit 761b8a9f40
2 changed files with 25 additions and 8 deletions

View File

@@ -8,6 +8,8 @@
*/
import { createRouter, createWebHistory } from 'vue-router';
import routesConfig from './config';
import store from "@/store";
const routes = [
{
path: '/',
@@ -21,4 +23,26 @@ const router = createRouter({
routes,
})
let count = 0;
const timers = setInterval(() => {
count ++
let pathArr = store.state.menus
let currentPath = router.options.history.location
console.log(pathArr, currentPath, pathArr.indexOf(currentPath))
if(pathArr.length!==0){
// 刷新界面是否重新执行
if(pathArr.indexOf(currentPath)==-1){
clearInterval(timers)
router.push({path: pathArr[0]})
}else{
clearInterval(timers)
}
}
// 30s超时结束
if(count==60&&pathArr.length==0){
clearInterval(timers)
}
}, 500);
export default router