mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 11:56:46 +08:00
feat:增加根据用户权限判断当用户进入管理员端展示的界面。
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user