befly-admin 3.4.21 → 3.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/router/index.ts +40 -10
- package/src/types/components.d.ts +0 -57
- package/vite.config.ts +1 -36
- package/src/router/1.json +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-admin",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.23",
|
|
4
4
|
"description": "Befly Admin - 基于 Vue3 + OpenTiny Vue 的后台管理系统",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vue-router": "^4.6.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@befly-addon/admin": "1.0.
|
|
39
|
+
"@befly-addon/admin": "1.0.26",
|
|
40
40
|
"@iconify-json/lucide": "^1.2.72",
|
|
41
41
|
"@opentiny/unplugin-tiny-vue": "^1.0.0",
|
|
42
42
|
"@unocss/preset-attributify": "^66.5.6",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"node": ">=24.0.0",
|
|
59
59
|
"pnpm": ">=10.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ca96814c3b67376809086cd8bef8e7816b736483"
|
|
62
62
|
}
|
package/src/router/index.ts
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
1
|
import { createRouter, createWebHashHistory } from 'vue-router';
|
|
2
|
-
import
|
|
3
|
-
import { routes, handleHotUpdate } from 'vue-router/auto-routes';
|
|
2
|
+
import { routes } from 'vue-router/auto-routes';
|
|
4
3
|
import { $Storage } from '@/plugins/storage';
|
|
5
|
-
import { Layouts } from '@befly-addon/admin/
|
|
4
|
+
import { Layouts } from '@befly-addon/admin/utils/layouts';
|
|
5
|
+
import type { RouteRecordRaw } from 'vue-router';
|
|
6
|
+
import type { LayoutConfig } from '@befly-addon/admin/utils/layouts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 将布局配置转换为实际的路由配置
|
|
10
|
+
* 在这里执行实际的布局组件导入
|
|
11
|
+
*/
|
|
12
|
+
function applyLayouts(configs: LayoutConfig[]): RouteRecordRaw[] {
|
|
13
|
+
return configs.map((config) => {
|
|
14
|
+
// 根据布局名称加载对应的布局组件
|
|
15
|
+
const layoutComponent = config.layoutName === 'default' ? () => import('@/layouts/default.vue') : () => import(`@/layouts/${config.layoutName}.vue`);
|
|
16
|
+
|
|
17
|
+
// 所有配置都是叶子节点(Layouts 函数已经扁平化处理)
|
|
18
|
+
// 直接包裹布局
|
|
19
|
+
return {
|
|
20
|
+
path: config.path,
|
|
21
|
+
component: layoutComponent,
|
|
22
|
+
meta: config.meta,
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
path: '',
|
|
26
|
+
component: config.component
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
6
32
|
|
|
7
33
|
// 应用自定义布局系统
|
|
8
|
-
const layoutRoutes = Layouts(routes);
|
|
34
|
+
const layoutRoutes = applyLayouts(Layouts(routes));
|
|
35
|
+
|
|
36
|
+
// 添加根路径重定向
|
|
37
|
+
const finalRoutes: RouteRecordRaw[] = [
|
|
38
|
+
{
|
|
39
|
+
path: '/',
|
|
40
|
+
redirect: '/addon/admin'
|
|
41
|
+
},
|
|
42
|
+
...layoutRoutes
|
|
43
|
+
];
|
|
9
44
|
|
|
10
45
|
/**
|
|
11
46
|
* 创建并导出路由实例
|
|
@@ -13,14 +48,9 @@ const layoutRoutes = Layouts(routes);
|
|
|
13
48
|
*/
|
|
14
49
|
export const router = createRouter({
|
|
15
50
|
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
16
|
-
routes:
|
|
51
|
+
routes: finalRoutes
|
|
17
52
|
});
|
|
18
53
|
|
|
19
|
-
// HMR 支持
|
|
20
|
-
if (import.meta.hot) {
|
|
21
|
-
handleHotUpdate(router);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
54
|
// 路由守卫 - 基础验证
|
|
25
55
|
router.beforeEach(async (to, from, next) => {
|
|
26
56
|
const token = $Storage.local.get('token');
|
|
@@ -11,70 +11,13 @@ export {}
|
|
|
11
11
|
/* prettier-ignore */
|
|
12
12
|
declare module 'vue' {
|
|
13
13
|
export interface GlobalComponents {
|
|
14
|
-
'ILucide:activity': typeof import('~icons/lucide/activity')['default']
|
|
15
|
-
'ILucide:alertCircle': typeof import('~icons/lucide/alert-circle')['default']
|
|
16
|
-
'ILucide:alertTriangle': typeof import('~icons/lucide/alert-triangle')['default']
|
|
17
|
-
'ILucide:checkCircle': typeof import('~icons/lucide/check-circle')['default']
|
|
18
|
-
'ILucide:chevronDown': typeof import('~icons/lucide/chevron-down')['default']
|
|
19
|
-
'ILucide:circle': typeof import('~icons/lucide/circle')['default']
|
|
20
|
-
'ILucide:clock': typeof import('~icons/lucide/clock')['default']
|
|
21
|
-
'ILucide:cloud': typeof import('~icons/lucide/cloud')['default']
|
|
22
|
-
'ILucide:code': typeof import('~icons/lucide/code')['default']
|
|
23
|
-
'ILucide:cpu': typeof import('~icons/lucide/cpu')['default']
|
|
24
|
-
'ILucide:database': typeof import('~icons/lucide/database')['default']
|
|
25
|
-
'ILucide:disc': typeof import('~icons/lucide/disc')['default']
|
|
26
14
|
'ILucide:fileText': typeof import('~icons/lucide/file-text')['default']
|
|
27
15
|
'ILucide:folder': typeof import('~icons/lucide/folder')['default']
|
|
28
|
-
'ILucide:hardDrive': typeof import('~icons/lucide/hard-drive')['default']
|
|
29
16
|
'ILucide:home': typeof import('~icons/lucide/home')['default']
|
|
30
|
-
'ILucide:info': typeof import('~icons/lucide/info')['default']
|
|
31
|
-
'ILucide:lock': typeof import('~icons/lucide/lock')['default']
|
|
32
|
-
'ILucide:logOut': typeof import('~icons/lucide/log-out')['default']
|
|
33
|
-
'ILucide:mail': typeof import('~icons/lucide/mail')['default']
|
|
34
|
-
'ILucide:menu': typeof import('~icons/lucide/menu')['default']
|
|
35
|
-
'ILucide:pencil': typeof import('~icons/lucide/pencil')['default']
|
|
36
|
-
'ILucide:plus': typeof import('~icons/lucide/plus')['default']
|
|
37
|
-
'ILucide:rotateCw': typeof import('~icons/lucide/rotate-cw')['default']
|
|
38
|
-
'ILucide:server': typeof import('~icons/lucide/server')['default']
|
|
39
|
-
'ILucide:settings': typeof import('~icons/lucide/settings')['default']
|
|
40
|
-
'ILucide:smile': typeof import('~icons/lucide/smile')['default']
|
|
41
|
-
'ILucide:square': typeof import('~icons/lucide/square')['default']
|
|
42
|
-
'ILucide:trash2': typeof import('~icons/lucide/trash2')['default']
|
|
43
|
-
'ILucide:trendingUp': typeof import('~icons/lucide/trending-up')['default']
|
|
44
|
-
'ILucide:user': typeof import('~icons/lucide/user')['default']
|
|
45
|
-
'ILucide:users': typeof import('~icons/lucide/users')['default']
|
|
46
|
-
'ILucide:webhook': typeof import('~icons/lucide/webhook')['default']
|
|
47
|
-
'ILucide:xCircle': typeof import('~icons/lucide/x-circle')['default']
|
|
48
|
-
'ILucide:zap': typeof import('~icons/lucide/zap')['default']
|
|
49
17
|
RouterLink: typeof import('vue-router')['RouterLink']
|
|
50
18
|
RouterView: typeof import('vue-router')['RouterView']
|
|
51
|
-
TinyAvatar: typeof import('@opentiny/vue-avatar')['default']
|
|
52
19
|
TinyButton: typeof import('@opentiny/vue-button')['default']
|
|
53
|
-
TinyCheckbox: typeof import('@opentiny/vue-checkbox')['default']
|
|
54
|
-
TinyCheckboxGroup: typeof import('@opentiny/vue-checkbox-group')['default']
|
|
55
|
-
TinyCol: typeof import('@opentiny/vue-col')['default']
|
|
56
|
-
TinyDialogBox: typeof import('@opentiny/vue-dialog-box')['default']
|
|
57
|
-
TinyDivider: typeof import('@opentiny/vue-divider')['default']
|
|
58
|
-
TinyDropdown: typeof import('@opentiny/vue-dropdown')['default']
|
|
59
|
-
TinyDropdownItem: typeof import('@opentiny/vue-dropdown-item')['default']
|
|
60
|
-
TinyDropdownMenu: typeof import('@opentiny/vue-dropdown-menu')['default']
|
|
61
|
-
TinyForm: typeof import('@opentiny/vue-form')['default']
|
|
62
|
-
TinyFormItem: typeof import('@opentiny/vue-form-item')['default']
|
|
63
|
-
TinyGrid: typeof import('@opentiny/vue-grid')['default']
|
|
64
|
-
TinyGridColumn: typeof import('@opentiny/vue-grid-column')['default']
|
|
65
|
-
TinyInput: typeof import('@opentiny/vue-input')['default']
|
|
66
|
-
TinyNumeric: typeof import('@opentiny/vue-numeric')['default']
|
|
67
|
-
TinyPager: typeof import('@opentiny/vue-pager')['default']
|
|
68
|
-
TinyPopover: typeof import('@opentiny/vue-popover')['default']
|
|
69
|
-
TinyProgress: typeof import('@opentiny/vue-progress')['default']
|
|
70
|
-
TinyRadio: typeof import('@opentiny/vue-radio')['default']
|
|
71
|
-
TinyRadioGroup: typeof import('@opentiny/vue-radio-group')['default']
|
|
72
|
-
TinyRow: typeof import('@opentiny/vue-row')['default']
|
|
73
|
-
TinySearch: typeof import('@opentiny/vue-search')['default']
|
|
74
|
-
TinySelect: typeof import('@opentiny/vue-select')['default']
|
|
75
20
|
TinyTag: typeof import('@opentiny/vue-tag')['default']
|
|
76
|
-
TinyTree: typeof import('@opentiny/vue-tree')['default']
|
|
77
21
|
TinyTreeMenu: typeof import('@opentiny/vue-tree-menu')['default']
|
|
78
|
-
TinyUserHead: typeof import('@opentiny/vue-user-head')['default']
|
|
79
22
|
}
|
|
80
23
|
}
|
package/vite.config.ts
CHANGED
|
@@ -11,42 +11,7 @@ import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
|
|
|
11
11
|
import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
|
|
12
12
|
import UnoCSS from 'unocss/vite';
|
|
13
13
|
import { fileURLToPath, URL } from 'node:url';
|
|
14
|
-
import {
|
|
15
|
-
import { join } from 'node:path';
|
|
16
|
-
|
|
17
|
-
// 动态扫描所有 @befly-addon 包的 views 目录
|
|
18
|
-
function scanBeflyAddonViews() {
|
|
19
|
-
const addonBasePath = 'node_modules/@befly-addon';
|
|
20
|
-
const routesFolders: any[] = [];
|
|
21
|
-
|
|
22
|
-
if (!existsSync(addonBasePath)) {
|
|
23
|
-
return routesFolders;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const addonDirs = readdirSync(addonBasePath);
|
|
28
|
-
|
|
29
|
-
for (const addonName of addonDirs) {
|
|
30
|
-
const addonPath = join(addonBasePath, addonName);
|
|
31
|
-
|
|
32
|
-
// 检查是否为目录(包括符号链接)
|
|
33
|
-
if (!existsSync(addonPath)) continue;
|
|
34
|
-
|
|
35
|
-
const viewsPath = join(addonPath, 'views');
|
|
36
|
-
|
|
37
|
-
if (existsSync(viewsPath)) {
|
|
38
|
-
routesFolders.push({
|
|
39
|
-
src: viewsPath,
|
|
40
|
-
path: `addon/${addonName}/`
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error('扫描 @befly-addon 目录失败:', error);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return routesFolders;
|
|
49
|
-
}
|
|
14
|
+
import { scanBeflyAddonViews } from '@befly-addon/admin/utils/scanBeflyAddonViews';
|
|
50
15
|
|
|
51
16
|
const routesFolders = scanBeflyAddonViews();
|
|
52
17
|
|
package/src/router/1.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"path": "/addon",
|
|
4
|
-
"children": [
|
|
5
|
-
{
|
|
6
|
-
"path": "admin",
|
|
7
|
-
"children": [
|
|
8
|
-
{ "path": "", "children": [{ "path": "", "name": "/addon/admin//" }] },
|
|
9
|
-
{ "path": "403", "children": [{ "path": "", "name": "/addon/admin/403/" }] },
|
|
10
|
-
{ "path": "admin", "children": [{ "path": "", "name": "/addon/admin/admin/" }] },
|
|
11
|
-
{ "path": "dict", "children": [{ "path": "", "name": "/addon/admin/dict/" }] },
|
|
12
|
-
{ "path": "login", "children": [{ "path": "index_1", "name": "/addon/admin/login/index_1" }] },
|
|
13
|
-
{ "path": "menu", "children": [{ "path": "", "name": "/addon/admin/menu/", "meta": { "layout": "default", "title": "菜单管理" } }] },
|
|
14
|
-
{
|
|
15
|
-
"path": "news",
|
|
16
|
-
"children": [
|
|
17
|
-
{ "path": "", "name": "/addon/admin/news/" },
|
|
18
|
-
{ "path": "detail", "children": [{ "path": "", "name": "/addon/admin/news/detail/" }] }
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
{ "path": "role", "children": [{ "path": "", "name": "/addon/admin/role/" }] },
|
|
22
|
-
{ "path": "user", "children": [{ "path": "", "name": "/addon/admin/user/" }] }
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
]
|