提交登录跳转问题
This commit is contained in:
parent
1c07580224
commit
81d74a4cfe
@ -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') // 未认证重定向到登录页
|
||||
|
@ -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') || '[]'))
|
||||
|
Loading…
Reference in New Issue
Block a user