diff --git a/apps/antd-view/src/router/guard/access.ts b/apps/antd-view/src/router/guard/access.ts index 54ebcd0c..7f56c248 100644 --- a/apps/antd-view/src/router/guard/access.ts +++ b/apps/antd-view/src/router/guard/access.ts @@ -2,13 +2,12 @@ import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben/types'; import type { RouteRecordRaw, Router } from 'vue-router'; +import { LOGIN_PATH } from '@vben/constants'; import { useAccessStore } from '@vben/stores'; import { filterTree, mapTree, traverseTreeValues } from '@vben/utils'; -import { dynamicRoutes } from '../routes'; +import { dynamicRoutes } from '@/router/routes'; -// 登录页面路由 path -const LOGIN_ROUTE_PATH = '/auth/login'; // 不需要权限的页面白名单 const WHITE_ROUTE_NAMES = new Set([]); @@ -29,14 +28,15 @@ function configAccessGuard(router: Router) { } // 白名单路由列表检查 + // TODO: 不是很需要,通过 ignoreAccess 也可以做到,考虑删除 if (WHITE_ROUTE_NAMES.has(to.name as string)) { return true; } // 没有访问权限,跳转登录页面 - if (to.fullPath !== LOGIN_ROUTE_PATH) { + if (to.fullPath !== LOGIN_PATH) { return { - path: LOGIN_ROUTE_PATH, + path: LOGIN_PATH, // 如不需要,直接删除 query query: { redirect: encodeURIComponent(to.fullPath) }, // 携带当前跳转的页面,登录后重新跳转该页面 diff --git a/apps/antd-view/src/router/guard/index.ts b/apps/antd-view/src/router/guard/index.ts index 3c05d11e..492dde95 100644 --- a/apps/antd-view/src/router/guard/index.ts +++ b/apps/antd-view/src/router/guard/index.ts @@ -12,9 +12,11 @@ import { configAccessGuard } from './access'; * @param router */ function configCommonGuard(router: Router) { + // 记录已经加载的页面 const loadedPaths = new Set(); router.beforeEach(async (to) => { + // 页面加载进度条 if (preference.pageProgress) { startProgress(); } @@ -25,6 +27,8 @@ function configCommonGuard(router: Router) { router.afterEach((to) => { // 记录页面是否加载,如果已经加载,后续的页面切换动画等效果不在重复执行 loadedPaths.add(to.path); + + // 关闭页面加载进度条 if (preference.pageProgress) { stopProgress(); } diff --git a/apps/antd-view/src/router/routes/builtin.ts b/apps/antd-view/src/router/routes/_essential.ts similarity index 57% rename from apps/antd-view/src/router/routes/builtin.ts rename to apps/antd-view/src/router/routes/_essential.ts index f04bbd82..9382dc23 100644 --- a/apps/antd-view/src/router/routes/builtin.ts +++ b/apps/antd-view/src/router/routes/_essential.ts @@ -2,9 +2,12 @@ import type { RouteRecordRaw } from 'vue-router'; import { AuthPageLayout } from '@/layouts'; import { Fallback } from '@vben/common-ui'; +import { $t } from '@vben/locales'; -/** 静态路由列表,访问这些页面可以不需要权限 */ -const builtinRoutes: RouteRecordRaw[] = [ +import Login from '@/views/_essential/authentication/login.vue'; + +/** 基本路由,这些路由是必须存在的 */ +const essentialRoutes: RouteRecordRaw[] = [ { component: AuthPageLayout, meta: { @@ -16,46 +19,50 @@ const builtinRoutes: RouteRecordRaw[] = [ { name: 'Login', path: 'login', - component: () => import('@/views/authentication/login.vue'), + component: Login, meta: { ignoreAccess: true, - title: 'Login', + title: $t('page.login'), }, }, { name: 'CodeLogin', path: 'code-login', - component: () => import('@/views/authentication/code-login.vue'), + component: () => + import('@/views/_essential/authentication/code-login.vue'), meta: { ignoreAccess: true, - title: 'CodeLogin', + title: $t('page.code-login'), }, }, { name: 'QrCodeLogin', path: 'qrcode-login', - component: () => import('@/views/authentication/qrcode-login.vue'), + component: () => + import('@/views/_essential/authentication/qrcode-login.vue'), meta: { ignoreAccess: true, - title: 'QrCodeLogin', + title: $t('page.qrcode-login'), }, }, { name: 'ForgetPassword', path: 'forget-password', - component: () => import('@/views/authentication/forget-password.vue'), + component: () => + import('@/views/_essential/authentication/forget-password.vue'), meta: { ignoreAccess: true, - title: 'ForgetPassword', + title: $t('page.forget-password'), }, }, { name: 'Register', path: 'register', - component: () => import('@/views/authentication/register.vue'), + component: () => + import('@/views/_essential/authentication/register.vue'), meta: { ignoreAccess: true, - title: 'Register', + title: $t('page.register'), }, }, ], @@ -67,6 +74,7 @@ const builtinRoutes: RouteRecordRaw[] = [ hideInBreadcrumb: true, hideInMenu: true, hideInTab: true, + ignoreAccess: true, title: 'Fallback', }, name: 'Fallback', @@ -74,4 +82,4 @@ const builtinRoutes: RouteRecordRaw[] = [ }, ]; -export { builtinRoutes }; +export { essentialRoutes }; diff --git a/apps/antd-view/src/router/routes/index.ts b/apps/antd-view/src/router/routes/index.ts index 0c495802..520cd86b 100644 --- a/apps/antd-view/src/router/routes/index.ts +++ b/apps/antd-view/src/router/routes/index.ts @@ -1,36 +1,15 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '@/layouts'; - -import { builtinRoutes } from './builtin'; +import { essentialRoutes } from './_essential'; import { nestedRoutes } from './modules/nested'; import { outsideRoutes } from './modules/outside'; +import { rootRoutes } from './modules/root'; import { vbenRoutes } from './modules/vben'; /** 动态路由 */ const dynamicRoutes: RouteRecordRaw[] = [ // 根路由 - { - component: BasicLayout, - meta: { - hideChildrenInMenu: true, - title: '首页', - }, - name: 'Home', - path: '/', - redirect: '/welcome', - children: [ - { - name: 'Welcome', - path: '/welcome', - component: () => import('@/views/dashboard/index.vue'), - meta: { - affixTab: true, - title: 'Welcome', - }, - }, - ], - }, + ...rootRoutes, ...nestedRoutes, ...outsideRoutes, ...vbenRoutes, @@ -40,6 +19,6 @@ const dynamicRoutes: RouteRecordRaw[] = [ const externalRoutes: RouteRecordRaw[] = []; /** 静态路由列表,访问这些页面可以不需要权限 */ -const staticRoutes: RouteRecordRaw[] = [...builtinRoutes]; +const staticRoutes: RouteRecordRaw[] = [...essentialRoutes]; export { dynamicRoutes, externalRoutes, staticRoutes }; diff --git a/apps/antd-view/src/router/routes/modules/root.ts b/apps/antd-view/src/router/routes/modules/root.ts new file mode 100644 index 00000000..1b91603b --- /dev/null +++ b/apps/antd-view/src/router/routes/modules/root.ts @@ -0,0 +1,29 @@ +import type { RouteRecordRaw } from 'vue-router'; + +import { BasicLayout } from '@/layouts'; + +const rootRoutes: RouteRecordRaw[] = [ + { + component: BasicLayout, + meta: { + hideChildrenInMenu: true, + title: '首页', + }, + name: 'Home', + path: '/', + redirect: '/welcome', + children: [ + { + name: 'Welcome', + path: '/welcome', + component: () => import('@/views/dashboard/index.vue'), + meta: { + affixTab: true, + title: 'Welcome', + }, + }, + ], + }, +]; + +export { rootRoutes }; diff --git a/apps/antd-view/src/views/_essential/README.md b/apps/antd-view/src/views/_essential/README.md new file mode 100644 index 00000000..81eec5e3 --- /dev/null +++ b/apps/antd-view/src/views/_essential/README.md @@ -0,0 +1,3 @@ +# \_essential + +此目录包含应用程序正常运行所需的基本视图。这些视图是应用程序布局中使用的视图。 diff --git a/apps/antd-view/src/views/authentication/code-login.vue b/apps/antd-view/src/views/_essential/authentication/code-login.vue similarity index 100% rename from apps/antd-view/src/views/authentication/code-login.vue rename to apps/antd-view/src/views/_essential/authentication/code-login.vue diff --git a/apps/antd-view/src/views/authentication/forget-password.vue b/apps/antd-view/src/views/_essential/authentication/forget-password.vue similarity index 100% rename from apps/antd-view/src/views/authentication/forget-password.vue rename to apps/antd-view/src/views/_essential/authentication/forget-password.vue diff --git a/apps/antd-view/src/views/authentication/login.vue b/apps/antd-view/src/views/_essential/authentication/login.vue similarity index 100% rename from apps/antd-view/src/views/authentication/login.vue rename to apps/antd-view/src/views/_essential/authentication/login.vue diff --git a/apps/antd-view/src/views/authentication/qrcode-login.vue b/apps/antd-view/src/views/_essential/authentication/qrcode-login.vue similarity index 100% rename from apps/antd-view/src/views/authentication/qrcode-login.vue rename to apps/antd-view/src/views/_essential/authentication/qrcode-login.vue diff --git a/apps/antd-view/src/views/authentication/register.vue b/apps/antd-view/src/views/_essential/authentication/register.vue similarity index 100% rename from apps/antd-view/src/views/authentication/register.vue rename to apps/antd-view/src/views/_essential/authentication/register.vue diff --git a/apps/antd-view/src/views/_essential/fallback/.gitkeep b/apps/antd-view/src/views/_essential/fallback/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/internal/lint-configs/eslint-config/package.json b/internal/lint-configs/eslint-config/package.json index cff8e393..0e1a652d 100644 --- a/internal/lint-configs/eslint-config/package.json +++ b/internal/lint-configs/eslint-config/package.json @@ -41,7 +41,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-i": "^2.29.1", - "eslint-plugin-jsdoc": "^48.2.6", + "eslint-plugin-jsdoc": "^48.2.7", "eslint-plugin-jsonc": "^2.16.0", "eslint-plugin-n": "^17.7.0", "eslint-plugin-no-only-tests": "^3.1.0", diff --git a/internal/lint-configs/eslint-config/src/configs/disableds.ts b/internal/lint-configs/eslint-config/src/configs/disableds.ts new file mode 100644 index 00000000..4cd6599b --- /dev/null +++ b/internal/lint-configs/eslint-config/src/configs/disableds.ts @@ -0,0 +1,28 @@ +import type { Linter } from 'eslint'; + +export async function disableds(): Promise { + return [ + { + files: ['**/__tests__/**/*.?([cm])[jt]s?(x)'], + name: 'disables/test', + rules: { + '@typescript-eslint/ban-ts-comment': 'off', + 'no-console': 'off', + }, + }, + { + files: ['**/*.d.ts'], + name: 'disables/dts', + rules: { + '@typescript-eslint/triple-slash-reference': 'off', + }, + }, + { + files: ['**/*.js', '**/*.mjs', '**/*.cjs'], + name: 'disables/js', + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + }, + }, + ]; +} diff --git a/internal/lint-configs/eslint-config/src/configs/ignores.ts b/internal/lint-configs/eslint-config/src/configs/ignores.ts index bc2f6f8c..23045827 100644 --- a/internal/lint-configs/eslint-config/src/configs/ignores.ts +++ b/internal/lint-configs/eslint-config/src/configs/ignores.ts @@ -19,7 +19,6 @@ export async function ignores(): Promise { '**/tmp', '**/.tmp', '**/.history', - '**/.vitepress/cache', '**/.nuxt', '**/.next', '**/.vercel', @@ -33,6 +32,9 @@ export async function ignores(): Promise { '**/*.min.*', '**/LICENSE*', '**/__snapshots__', + '**/*.snap', + '**/fixtures/**', + '**/.vitepress/cache/**', '**/auto-import?(s).d.ts', '**/components.d.ts', '**/vite.config.mts.*', diff --git a/internal/lint-configs/eslint-config/src/configs/index.ts b/internal/lint-configs/eslint-config/src/configs/index.ts index 8957ca62..982997a2 100644 --- a/internal/lint-configs/eslint-config/src/configs/index.ts +++ b/internal/lint-configs/eslint-config/src/configs/index.ts @@ -1,5 +1,6 @@ export * from './command'; export * from './comments'; +export * from './disableds'; export * from './ignores'; export * from './import'; export * from './javascript'; diff --git a/internal/lint-configs/eslint-config/src/index.ts b/internal/lint-configs/eslint-config/src/index.ts index 54c46caa..33c6b44b 100644 --- a/internal/lint-configs/eslint-config/src/index.ts +++ b/internal/lint-configs/eslint-config/src/index.ts @@ -3,6 +3,7 @@ import type { Linter } from 'eslint'; import { command, comments, + disableds, ignores, importPluginConfig, javascript, @@ -35,6 +36,7 @@ async function defineConfig(config: FlatConfig[] = []) { prettier(), typescript(), jsonc(), + disableds(), importPluginConfig(), node(), perfectionist(), diff --git a/internal/lint-configs/prettier-config/package.json b/internal/lint-configs/prettier-config/package.json index 9a3535df..dba63e8c 100644 --- a/internal/lint-configs/prettier-config/package.json +++ b/internal/lint-configs/prettier-config/package.json @@ -32,6 +32,6 @@ }, "dependencies": { "prettier": "^3.2.5", - "prettier-plugin-tailwindcss": "^0.5.14" + "prettier-plugin-tailwindcss": "^0.6.0" } } diff --git a/internal/tailwind-config/package.json b/internal/tailwind-config/package.json index 2bf28d4a..e9b951e8 100644 --- a/internal/tailwind-config/package.json +++ b/internal/tailwind-config/package.json @@ -45,7 +45,7 @@ "./*": "./*" }, "dependencies": { - "@iconify/json": "^2.2.214", + "@iconify/json": "^2.2.215", "@iconify/tailwind": "^1.1.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/nesting": "0.0.0-insiders.565cd3e", diff --git a/internal/tsconfig/package.json b/internal/tsconfig/package.json index 9cf6b2c2..8cf72d83 100644 --- a/internal/tsconfig/package.json +++ b/internal/tsconfig/package.json @@ -20,6 +20,6 @@ ], "dependencies": { "@vben/types": "workspace:*", - "vite": "5.2.11" + "vite": "6.0.0-alpha.17" } } diff --git a/internal/vite-config/package.json b/internal/vite-config/package.json index 91c676c0..a949a3aa 100644 --- a/internal/vite-config/package.json +++ b/internal/vite-config/package.json @@ -42,13 +42,13 @@ "@types/html-minifier-terser": "^7.0.2", "@vben/node-utils": "workspace:*", "@vitejs/plugin-vue": "^5.0.4", - "@vitejs/plugin-vue-jsx": "^3.1.0", + "@vitejs/plugin-vue-jsx": "^4.0.0", "dayjs": "^1.11.11", "dotenv": "^16.4.5", "rollup-plugin-visualizer": "^5.12.0", - "sass": "^1.77.2", + "sass": "^1.77.4", "unplugin-turbo-console": "^1.8.6", - "vite": "5.2.11", + "vite": "6.0.0-alpha.17", "vite-plugin-compression": "^0.5.1", "vite-plugin-dts": "^3.9.1", "vite-plugin-html": "^3.2.2", diff --git a/package.json b/package.json index 12b7f20f..31dbbfdc 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "devDependencies": { "@changesets/cli": "^2.27.5", "@ls-lint/ls-lint": "^2.2.3", - "@types/jsdom": "^21.1.6", - "@types/node": "^20.12.12", + "@types/jsdom": "^21.1.7", + "@types/node": "^20.12.13", "@vben/commitlint-config": "workspace:*", "@vben/eslint-config": "workspace:*", "@vben/lint-staged-config": "workspace:*", @@ -67,7 +67,7 @@ "turbo": "^1.13.3", "typescript": "^5.4.5", "unbuild": "^2.0.0", - "vite": "5.2.11", + "vite": "6.0.0-alpha.17", "vitest": "^2.0.0-beta.3", "vue-tsc": "^2.0.19" }, @@ -75,7 +75,7 @@ "node": ">=18.7.0", "pnpm": ">=8.5.0" }, - "packageManager": "pnpm@9.1.3", + "packageManager": "pnpm@9.1.4", "pnpm": { "overrides": { "@ctrl/tinycolor": "4.1.0", diff --git a/packages/@vben-core/shared/typings/src/preference.ts b/packages/@vben-core/shared/typings/src/preference.ts index 5d8d25d2..21f475fb 100644 --- a/packages/@vben-core/shared/typings/src/preference.ts +++ b/packages/@vben-core/shared/typings/src/preference.ts @@ -61,6 +61,8 @@ interface Preference { footerFixed: boolean; /** 页脚是否可见 */ footerVisible: boolean; + /** 顶栏是否隐藏 */ + headerHidden: boolean; /** header显示模式 */ headerMode: LayoutHeaderMode; /** 顶栏是否可见 */ @@ -103,6 +105,8 @@ interface Preference { sideExpandOnHover: boolean; /** 侧边栏扩展区域是否折叠 */ sideExtraCollapse: boolean; + /** 侧边栏是否隐藏 */ + sideHidden: boolean; /** 侧边栏是否可见 */ sideVisible: boolean; /** 侧边栏宽度 */ diff --git a/packages/@vben-core/uikit/layout-ui/src/components/layout-header.vue b/packages/@vben-core/uikit/layout-ui/src/components/layout-header.vue index 6ff5e0cd..c0e15564 100644 --- a/packages/@vben-core/uikit/layout-ui/src/components/layout-header.vue +++ b/packages/@vben-core/uikit/layout-ui/src/components/layout-header.vue @@ -112,7 +112,7 @@ function handleOpenMenu() {