This commit is contained in:
仲么了
2024-01-05 15:14:35 +08:00
parent 379732c7d5
commit ae1ae5b2a7
7 changed files with 263 additions and 268 deletions

View File

@@ -1,6 +1,6 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import staticRoutes from '@/router/static'
import { useConfig } from '@/stores/config'
import { useAdminInfo } from '@/stores/adminInfo'
import NProgress from 'nprogress'
import { loading } from '@/utils/loading'
import { ElMessage } from 'element-plus'
@@ -23,7 +23,8 @@ router.beforeEach((to, from, next) => {
next()
} else {
// 获取 token
const token = localStorage.getItem('token')
const adminInfo = useAdminInfo()
const token = adminInfo.getToken()
// token 不存在
if (token === null || token === '') {
ElMessage.error('您还没有登录,请先登录')