mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 03:46:45 +08:00
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
/*
|
|
* @Author: lixg lixg@dongwu-inc.com
|
|
* @Date: 2022-11-09 09:26:26
|
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
|
* @LastEditTime: 2022-11-21 17:42:59
|
|
* @FilePath: /fe-manage/src/router/index.js
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
import { createRouter, createWebHistory } from 'vue-router';
|
|
import routesConfig from './config';
|
|
import store from "@/store";
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: '首页',
|
|
redirect: '/learningpath'
|
|
},
|
|
...routesConfig
|
|
]
|
|
const router = createRouter({
|
|
history: createWebHistory(process.env.VUE_APP_BASE),
|
|
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){
|
|
if(localStorage.getItem("refreshPage") == "jumpverify"){
|
|
clearInterval(timers)
|
|
return
|
|
}
|
|
clearInterval(timers)
|
|
router.push({path: pathArr[0]})
|
|
localStorage.setItem("refreshPage", "jumpverify")
|
|
}else{
|
|
localStorage.setItem("refreshPage", "jumpverify")
|
|
clearInterval(timers)
|
|
}
|
|
}
|
|
// 30s超时结束
|
|
if(count==60&&pathArr.length==0){
|
|
clearInterval(timers)
|
|
}
|
|
}, 500);
|
|
|
|
export default router |