提交登录跳转问题

This commit is contained in:
limengnan 2025-06-20 10:00:15 +08:00
parent 1c07580224
commit 81d74a4cfe
2 changed files with 2 additions and 10 deletions

View File

@ -139,18 +139,11 @@ router.beforeEach((to, from, next) => {
// 设置页面标题
document.title = to.meta.title ? `${to.meta.title} - StdProject` : 'StdProject'
debugger
const token = localStorage.getItem('token') || ''
console.log(userStore.isAuthenticated)
// 检查是否需要认证
if (to.meta.requiresAuth) {
// next()
// if (userStore.isAuthenticated) {
// next()
// } else {
// next('/login')
// }
if (userStore.isAuthenticated) {
if (!!token) {
next()
} else {
next('/UserLogin') // 未认证重定向到登录页

View File

@ -5,7 +5,6 @@ import { ElMessage } from 'element-plus'
export const useUserStore = defineStore('user', () => {
// 状态
debugger
const token = ref(localStorage.getItem('token') || '')
const userInfo = ref(JSON.parse(localStorage.getItem('userInfo') || 'null'))
const permissions = ref(JSON.parse(localStorage.getItem('permissions') || '[]'))