fix: 教师端样式第一版

This commit is contained in:
陆光LG
2025-08-12 23:36:04 +08:00
parent 5986c032dd
commit f8ac3cc751
59 changed files with 6188 additions and 1691 deletions

View File

@@ -8,6 +8,10 @@ import { usePageLoading } from '@/hooks/web/usePageLoading'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { useUserStoreWithOut } from '@/store/modules/user'
import { usePermissionStoreWithOut } from '@/store/modules/permission'
import { useAppStoreWithOut } from '@/store/modules/app'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
const { start, done } = useNProgress()
@@ -68,6 +72,23 @@ router.beforeEach(async (to, from, next) => {
const dictStore = useDictStoreWithOut()
const userStore = useUserStoreWithOut()
const permissionStore = usePermissionStoreWithOut()
const appStore = useAppStoreWithOut()
// 根据路由自动切换布局 - 只有当前路径是dashboard时才使用dashboard布局
if (to.path === '/dashboard' || to.path === '/') {
appStore.setLayout('dashboard')
appStore.setFixedHeader(true) // 设置header固定
} else {
// 获取当前保存的布局设置如果不是dashboard就恢复到之前的设置
const currentLayout = appStore.getLayout
if (currentLayout === 'dashboard') {
// 恢复到默认布局或从缓存中获取之前的布局
const cachedLayout = wsCache.get(CACHE_KEY.LAYOUT) || 'classic'
appStore.setLayout(cachedLayout === 'dashboard' ? 'classic' : cachedLayout)
appStore.setFixedHeader(true) // 保持header固定
}
}
if (!dictStore.getIsSetDict) {
await dictStore.setDictMap()
}
@@ -103,4 +124,18 @@ router.afterEach((to) => {
useTitle(to?.meta?.title as string)
done() // 结束Progress
loadDone()
// 路由切换后的布局处理
const appStore = useAppStoreWithOut()
if (to.path === '/dashboard' || to.path === '/') {
appStore.setLayout('dashboard')
appStore.setFixedHeader(true) // 设置header固定
} else {
const currentLayout = appStore.getLayout
if (currentLayout === 'dashboard') {
// 恢复到默认布局
appStore.setLayout('classic')
appStore.setFixedHeader(true) // 保持header固定
}
}
})