You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1009 B

8 months ago
// 引入路由
import router from '@/router/index'
3 months ago
import pinia from './store'
8 months ago
import { constRouter } from '@/router/module/constRouter'
3 months ago
import userStore from '@/store/module/user'
8 months ago
import useSettingStore from '@/store/module/setting'
const settingStore = useSettingStore(pinia) //重新指向pinia仓储
3 months ago
const useUserStore = userStore(pinia)
router.beforeEach((to, _from, next) => {
3 months ago
console.log(to.query)
// 判断是否登录
if (!useUserStore.token) {
// http://10.121.2.26:8866/portal#/home?code=abcdef
if (Object.keys(to.query).length) {
console.log('有参数')
// 传入token
useUserStore.verifyToken('1111111')
} else {
// window.location.replace('http://39.106.16.162/')
}
}
let index = constRouter[0].children.findIndex((item: any) => {
// console.log(to.path,item.path);
return to.path.includes(item.path)
})
// console.log(index);
settingStore.setuseIndex(index)
document.title = `教学一体化-${to.meta.title}`
next()
8 months ago
})