feat: 视频问题

This commit is contained in:
2025-11-28 20:26:47 +08:00
parent 46b98e78e5
commit d9f3103304
26 changed files with 1582 additions and 1021 deletions

View File

@@ -100,10 +100,10 @@ router.beforeEach(async (to, from, next) => {
}
// 检查是否已登录(通过 token 是否有效)
const isAuthenticated = tokenManager.isLoggedIn()
const authenToken = tokenManager.getToken()
// 路由访问控制
if (to.meta.requiresAuth && !isAuthenticated) {
if (to.meta.requiresAuth && !authenToken) {
// 需要认证但未登录,跳转到登录页并记录当前路径
next({
path: '/login',
@@ -113,13 +113,13 @@ router.beforeEach(async (to, from, next) => {
}
// 已登录用户访问登录页,重定向到首页
if (to.path === '/login' && isAuthenticated) {
if (to.path === '/login' && authenToken) {
next({ path: '/content-style/benchmark', replace: true })
return
}
// 首次访问且已登录时,同步用户信息到 store
if (isAuthenticated && !userStore.isLoggedIn) {
if (authenToken) {
userStore.isLoggedIn = true
userStore.fetchUserInfo().catch(error => {
console.error('初始化用户信息失败:', error)