fix: 页面跳转问题

This commit is contained in:
Kerwin
2025-08-27 18:38:40 +08:00
parent d49ce77350
commit 80a94c0f05
2 changed files with 10 additions and 11 deletions

View File

@@ -21,15 +21,14 @@
<script setup lang="ts">
import { useApiFetch } from '~/composables/useApiFetch'
import { parseApiResponse } from '~/composables/useApi'
// 使用版本信息组合式函数
const { versionInfo, fetchVersionInfo } = useVersion()
// 获取系统配置
const { data: systemConfigData } = await useAsyncData('footerSystemConfig',
() => useApiFetch('/system/config').then(parseApiResponse)
)
const systemConfig = computed(() => (systemConfigData.value as any) || { copyright: '© 2025 老九网盘资源数据库 By 老九' })
import { useSystemConfigStore } from '~/stores/systemConfig'
const systemConfigStore = useSystemConfigStore()
await systemConfigStore.initConfig(false, false)
const systemConfig = computed(() => systemConfigStore.config)
console.log(systemConfig.value)
// 组件挂载时获取版本信息
onMounted(() => {

View File

@@ -52,21 +52,21 @@ export const useUserStore = defineStore('user', {
try {
const token = localStorage.getItem('token')
const userStr = localStorage.getItem('user')
console.log('initAuth - token:', token ? 'exists' : 'not found')
console.log('initAuth - userStr:', userStr ? 'exists' : 'not found')
// console.log('initAuth - token:', token ? 'exists' : 'not found')
// console.log('initAuth - userStr:', userStr ? 'exists' : 'not found')
if (token && userStr) {
try {
this.token = token
this.user = JSON.parse(userStr)
this.isAuthenticated = true
console.log('initAuth - 状态恢复成功:', this.user?.username)
// console.log('initAuth - 状态恢复成功:', this.user?.username)
} catch (error) {
console.error('解析用户信息失败:', error)
this.logout()
}
} else {
console.log('initAuth - 没有找到有效的登录信息')
// console.log('initAuth - 没有找到有效的登录信息')
// 确保状态一致
this.token = null
this.user = null