mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
feat:增加根据用户权限判断当用户进入管理员端展示的界面。
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
import { createRouter, createWebHistory } from 'vue-router';
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
import routesConfig from './config';
|
import routesConfig from './config';
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
@@ -21,4 +23,26 @@ const router = createRouter({
|
|||||||
routes,
|
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
|
export default router
|
||||||
@@ -12,14 +12,7 @@ export default createStore({
|
|||||||
state: {
|
state: {
|
||||||
openpages: localStorage.getItem("openpages")
|
openpages: localStorage.getItem("openpages")
|
||||||
? JSON.parse(localStorage.getItem("openpages"))
|
? JSON.parse(localStorage.getItem("openpages"))
|
||||||
: [
|
: [],
|
||||||
{
|
|
||||||
pagename: "学习路径图",
|
|
||||||
href: "/learningpath",
|
|
||||||
active: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
assessmentName: "",
|
assessmentName: "",
|
||||||
routerId: null,
|
routerId: null,
|
||||||
projectTemplateId: null,
|
projectTemplateId: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user