This commit is contained in:
张成
2025-10-09 18:34:49 +08:00
parent 6c4ebd6e8b
commit e72aea100e
3 changed files with 39 additions and 11 deletions

View File

@@ -44,19 +44,14 @@ const app = new Vue({
console.log('框架版本:', AdminFramework.version)
console.log('配置信息:', this.$config)
// 设置系统标题
await this.$store.dispatch('app/getSysTitle', {
defaultTitle: this.$config.title,
defaultLogo: ''
})
// 刷新时恢复菜单
// 刷新时恢复菜单和标题
const token = this.$store.state.user.token
const authorityMenus = localStorage.getItem('authorityMenus')
if (token && authorityMenus) {
console.log('检测到登录状态,恢复菜单...')
console.log('检测到登录状态,恢复菜单和标题...')
try {
// 先恢复菜单
await this.$store.dispatch('user/setAuthorityMenus', {
Main: AdminFramework.Main,
ParentView: AdminFramework.ParentView,
@@ -64,9 +59,19 @@ const app = new Vue({
authorityMenus: authorityMenus
})
console.log('菜单恢复成功')
// 再获取系统标题(已登录,会从接口获取)
await this.$store.dispatch('app/getSysTitle', {
defaultTitle: this.$config.title,
defaultLogo: ''
})
} catch (error) {
console.error('恢复菜单失败:', error)
console.error('恢复失败:', error)
}
} else {
// 未登录,使用默认标题
console.log('未登录,使用默认标题')
document.title = this.$config.title
}
}
})