diff --git a/apps/vben5/.lintstagedrc.mjs b/apps/vben5/.lintstagedrc.mjs index e68d8a3e0..94b0192a7 100644 --- a/apps/vben5/.lintstagedrc.mjs +++ b/apps/vben5/.lintstagedrc.mjs @@ -1,4 +1,10 @@ export default { + '*.md': ['prettier --cache --ignore-unknown --write'], + '*.vue': [ + 'prettier --write', + 'eslint --cache --fix', + 'stylelint --fix --allow-empty-input', + ], '*.{js,jsx,ts,tsx}': [ 'prettier --cache --ignore-unknown --write', 'eslint --cache --fix', @@ -7,14 +13,8 @@ export default { 'prettier --cache --ignore-unknown --write', 'stylelint --fix --allow-empty-input', ], - '*.md': ['prettier --cache --ignore-unknown --write'], - '*.vue': [ - 'prettier --write', - 'eslint --cache --fix', - 'stylelint --fix --allow-empty-input', - ], + 'package.json': ['prettier --cache --write'], '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [ 'prettier --cache --write--parser json', ], - 'package.json': ['prettier --cache --write'], }; diff --git a/apps/vben5/apps/app-antd/.env.development b/apps/vben5/apps/app-antd/.env.development index ea36fef54..d7204a13d 100644 --- a/apps/vben5/apps/app-antd/.env.development +++ b/apps/vben5/apps/app-antd/.env.development @@ -7,10 +7,10 @@ VITE_BASE=/ VITE_GLOB_API_URL=/ # 是否开启 Nitro Mock服务,true 为开启,false 为关闭 -VITE_NITRO_MOCK=true +VITE_NITRO_MOCK=false # 是否打开 devtools,true 为打开,false 为关闭 -VITE_DEVTOOLS=true +VITE_DEVTOOLS=false # 是否注入全局loading VITE_INJECT_APP_LOADING=true diff --git a/apps/vben5/apps/app-antd/package.json b/apps/vben5/apps/app-antd/package.json index 675f638eb..c49b42bd0 100644 --- a/apps/vben5/apps/app-antd/package.json +++ b/apps/vben5/apps/app-antd/package.json @@ -1,18 +1,18 @@ { - "name": "@vben/app-antd", - "version": "5.5.1", - "homepage": "https://vben.pro", - "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", + "name": "@abp/app-antd", + "version": "8.3.4", + "homepage": "https://github.com/colinin/abp-next-admin", + "bugs": "https://github.com/colinin/abp-next-admin/issues", "repository": { "type": "git", - "url": "git+https://github.com/vbenjs/vue-vben-admin.git", + "url": "git+https://github.com/colinin/abp-next-admin.git", "directory": "apps/app-antd" }, "license": "MIT", "author": { - "name": "vben", - "email": "ann.vben@gmail.com", - "url": "https://github.com/anncwb" + "name": "colin", + "email": "colin.in@foxmail.com", + "url": "https://github.com/colinin" }, "type": "module", "scripts": { diff --git a/apps/vben5/apps/app-antd/src/bootstrap.ts b/apps/vben5/apps/app-antd/src/bootstrap.ts index a0af6fcfe..1967cea94 100644 --- a/apps/vben5/apps/app-antd/src/bootstrap.ts +++ b/apps/vben5/apps/app-antd/src/bootstrap.ts @@ -1,6 +1,7 @@ import { createApp, watchEffect } from 'vue'; import { registerAccessDirective } from '@vben/access'; +import { initTippy } from '@vben/common-ui'; import { preferences } from '@vben/preferences'; import { initStores } from '@vben/stores'; import '@vben/styles'; @@ -31,6 +32,9 @@ async function bootstrap(namespace: string) { // 安装权限指令 registerAccessDirective(app); + // 初始化 tippy + initTippy(app); + // 配置路由及路由守卫 app.use(router); diff --git a/apps/vben5/apps/app-antd/src/locales/index.ts b/apps/vben5/apps/app-antd/src/locales/index.ts index 60e61112a..d9d3c867e 100644 --- a/apps/vben5/apps/app-antd/src/locales/index.ts +++ b/apps/vben5/apps/app-antd/src/locales/index.ts @@ -1,7 +1,9 @@ -import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; import type { Locale } from 'ant-design-vue/es/locale'; import type { App } from 'vue'; + +import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; + import { ref } from 'vue'; import { @@ -15,6 +17,7 @@ import { useAbpStore } from '@abp/core'; import antdEnLocale from 'ant-design-vue/es/locale/en_US'; import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN'; import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat'; import { useAbpConfigApi } from '#/api/core/useAbpConfigApi'; @@ -73,6 +76,7 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) { } if (locale) { dayjs.locale(locale); + dayjs.extend(localizedFormat); } else { console.error(`Failed to load dayjs locale for ${lang}`); } @@ -119,8 +123,7 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) { await coreSetup(app, { defaultLocale: preferences.app.locale, loadMessages, - // missingWarn: !import.meta.env.PROD, - missingWarn: false, + missingWarn: !import.meta.env.PROD, ...options, }); } diff --git a/apps/vben5/apps/app-antd/src/router/routes/core.ts b/apps/vben5/apps/app-antd/src/router/routes/core.ts index fe030a9a2..7218da228 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/core.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/core.ts @@ -2,7 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'; import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; -import { AuthPageLayout } from '#/layouts'; +import { AuthPageLayout, BasicLayout } from '#/layouts'; import { $t } from '#/locales'; import Login from '#/views/_core/authentication/login.vue'; @@ -21,13 +21,21 @@ const fallbackNotFoundRoute: RouteRecordRaw = { /** 基本路由,这些路由是必须存在的 */ const coreRoutes: RouteRecordRaw[] = [ + /** + * 根路由 + * 使用基础布局,作为所有页面的父级容器,子级就不必配置BasicLayout。 + * 此路由必须存在,且不应修改 + */ { + component: BasicLayout, meta: { + hideInBreadcrumb: true, title: 'Root', }, name: 'Root', path: '/', redirect: DEFAULT_HOME_PATH, + children: [], }, { component: AuthPageLayout, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts index 1b7ec5c4f..0b3f7f404 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts @@ -1,11 +1,9 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'https://abp.io/assets/favicon.ico/favicon-16x16.png', keepAlive: true, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts index 1bddab9db..5254dc65d 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts @@ -1,18 +1,16 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'lucide:layout-dashboard', order: -1, title: $t('page.dashboard.title'), }, name: 'Dashboard', - path: '/', + path: '/dashboard', children: [ { name: 'Analytics', diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts index 32bb338e0..55ade09c9 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts @@ -1,11 +1,9 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts index 210e8610f..98acf5821 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts @@ -8,30 +8,20 @@ import { VBEN_NAIVE_PREVIEW_URL, } from '@vben/constants'; -import { BasicLayout, IFrameView } from '#/layouts'; +import { IFrameView } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', icon: VBEN_LOGO_URL, - order: 9999, + order: 9998, title: $t('demos.vben.title'), }, name: 'VbenProject', path: '/vben-admin', children: [ - { - name: 'VbenAbout', - path: '/vben-admin/about', - component: () => import('#/views/_core/about/index.vue'), - meta: { - icon: 'lucide:copyright', - title: $t('demos.vben.about'), - }, - }, { name: 'VbenDocument', path: '/vben-admin/document', @@ -76,6 +66,16 @@ const routes: RouteRecordRaw[] = [ }, ], }, + { + name: 'VbenAbout', + path: '/vben-admin/about', + component: () => import('#/views/_core/about/index.vue'), + meta: { + icon: 'lucide:copyright', + title: $t('demos.vben.about'), + order: 9999, + }, + }, ]; export default routes; diff --git a/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue b/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue index fadfc917c..f1f0b232a 100644 --- a/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue +++ b/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue @@ -1,11 +1,9 @@ diff --git a/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue b/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue index 04885f157..fef6cb058 100644 --- a/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue +++ b/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue @@ -9,11 +9,12 @@ const [Drawer, drawerApi] = useVbenDrawer({ }); function open() { - drawerApi.setData({ - content: '外部传递的数据 content', - payload: '外部传递的数据 payload', - }); - drawerApi.open(); + drawerApi + .setData({ + content: '外部传递的数据 content', + payload: '外部传递的数据 payload', + }) + .open(); } diff --git a/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue b/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue index 718e532bc..1b0255459 100644 --- a/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue +++ b/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue @@ -13,8 +13,7 @@ function openModal() { } function handleUpdateTitle() { - modalApi.setState({ title: '外部动态标题' }); - modalApi.open(); + modalApi.setState({ title: '外部动态标题' }).open(); } diff --git a/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue b/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue index 58c35e24d..91afeb70d 100644 --- a/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue +++ b/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue @@ -9,11 +9,12 @@ const [Modal, modalApi] = useVbenModal({ }); function openModal() { - modalApi.setData({ - content: '外部传递的数据 content', - payload: '外部传递的数据 payload', - }); - modalApi.open(); + modalApi + .setData({ + content: '外部传递的数据 content', + payload: '外部传递的数据 payload', + }) + .open(); } diff --git a/apps/vben5/docs/src/en/guide/essentials/route.md b/apps/vben5/docs/src/en/guide/essentials/route.md index bef40d691..8fb0a6d1c 100644 --- a/apps/vben5/docs/src/en/guide/essentials/route.md +++ b/apps/vben5/docs/src/en/guide/essentials/route.md @@ -73,7 +73,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', badgeVariants: 'destructive', @@ -124,7 +123,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, @@ -249,7 +247,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'mdi:home', title: $t('page.home.title'), diff --git a/apps/vben5/docs/src/guide/essentials/route.md b/apps/vben5/docs/src/guide/essentials/route.md index 0eb74aea4..d8a938dda 100644 --- a/apps/vben5/docs/src/guide/essentials/route.md +++ b/apps/vben5/docs/src/guide/essentials/route.md @@ -62,12 +62,10 @@ import type { RouteRecordRaw } from 'vue-router'; import { VBEN_LOGO_URL } from '@vben/constants'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', badgeVariants: 'destructive', @@ -103,7 +101,6 @@ export default routes; ::: tip -- 多级路由的父级路由无需设置 `component` 属性,只需设置 `children` 属性即可。除非你真的需要在父级路由嵌套下显示内容。 - 如果没有特殊情况,父级路由的 `redirect` 属性,不需要指定,默认会指向第一个子路由。 ::: @@ -113,12 +110,10 @@ export default routes; ```ts import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, @@ -238,12 +233,10 @@ import type { RouteRecordRaw } from 'vue-router'; import { VBEN_LOGO_URL } from '@vben/constants'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'mdi:home', title: $t('page.home.title'), @@ -400,6 +393,10 @@ interface RouteMeta { * 菜单可以看到,但是访问会被重定向到403 */ menuVisibleWithForbidden?: boolean; + /** + * 当前路由不使用基础布局(仅在顶级生效) + */ + noBasicLayout?: boolean; /** * 在新窗口打开 */ @@ -584,6 +581,13 @@ _注意:_ 排序仅针对一级菜单有效,二级菜单的排序需要在对 用于配置页面的菜单参数,会在菜单中传递给页面。 +### noBasicLayout + +- 类型:`boolean` +- 默认值:`false` + +用于配置当前路由不使用基础布局,仅在顶级时生效。默认情况下,所有的路由都会被包裹在基础布局中(包含顶部以及侧边等导航部件),如果你的页面不需要这些部件,可以设置 `noBasicLayout` 为 `true`。 + ## 路由刷新 路由刷新方式如下: diff --git a/apps/vben5/docs/src/guide/essentials/server.md b/apps/vben5/docs/src/guide/essentials/server.md index 74a45d2ee..fedfbae25 100644 --- a/apps/vben5/docs/src/guide/essentials/server.md +++ b/apps/vben5/docs/src/guide/essentials/server.md @@ -231,19 +231,17 @@ function createRequestClient(baseURL: string) { }, }); - // response数据解构 - client.addResponseInterceptor({ - fulfilled: (response) => { - const { data: responseData, status } = response; - - const { code, data } = responseData; - - if (status >= 200 && status < 400 && code === 0) { - return data; - } - throw Object.assign({}, response, { response }); - }, - }); + // 处理返回的响应数据格式。会根据responseReturn指定的类型返回对应的数据 + client.addResponseInterceptor( + defaultResponseInterceptor({ + // 指定接口返回的数据中的 code 字段名 + codeField: 'code', + // 指定接口返回的数据中装载了主要数据的字段名 + dataField: 'data', + // 请求成功的 code 值,如果接口返回的 code 等于 successCode 则会认为是成功的请求 + successCode: 0, + }), + ); // token过期的处理 client.addResponseInterceptor( diff --git a/apps/vben5/docs/src/guide/in-depth/access.md b/apps/vben5/docs/src/guide/in-depth/access.md index c0c4bc991..be7d2ba0a 100644 --- a/apps/vben5/docs/src/guide/in-depth/access.md +++ b/apps/vben5/docs/src/guide/in-depth/access.md @@ -296,7 +296,7 @@ const { hasAccessByRoles } = useAccess(); #### 指令方式 -> 指令支持绑定单个或多个权限码。单个时可以直接传入字符串或数组中包含一个权限码,多个权限码则传入数组。 +> 指令支持绑定单个或多个角色。单个时可以直接传入字符串或数组中包含一个角色,多个角色均可访问则传入数组。 ```vue