@befly-addon/admin 1.0.43 → 1.0.45
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/apis/dashboard/serviceStatus.ts +2 -2
- package/package.json +4 -4
- package/utils/layouts.js +0 -77
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Yes
|
|
1
|
+
import { Yes } from 'befly';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: '获取服务状态',
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Redis 状态
|
|
28
|
-
if (
|
|
28
|
+
if (befly.redis) {
|
|
29
29
|
try {
|
|
30
30
|
const startTime = Date.now();
|
|
31
31
|
await befly.redis.ping();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@befly-addon/admin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "Befly - 管理后台功能组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"url": "https://github.com/chenbimo/befly.git",
|
|
41
41
|
"directory": "packages/addon-admin"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e43aefa3abeda7a35669778793d39b23b4180c4e",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"befly": "3.8.
|
|
46
|
-
"befly-util": "0.1.
|
|
45
|
+
"befly": "3.8.20",
|
|
46
|
+
"befly-util": "0.1.2"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/utils/layouts.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 布局配置接口
|
|
3
|
-
* @typedef {Object} LayoutConfig
|
|
4
|
-
* @property {string} path - 路径
|
|
5
|
-
* @property {string} layoutName - 布局名称
|
|
6
|
-
* @property {import('vue-router').Component} component - 组件
|
|
7
|
-
* @property {LayoutConfig[]} [children] - 子配置
|
|
8
|
-
* @property {Record<string, any>} [meta] - 元信息
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 自定义布局处理函数
|
|
13
|
-
* 根据文件名后缀判断使用哪个布局
|
|
14
|
-
* @param {import('vue-router').RouteRecordRaw[]} routes - 原始路由配置
|
|
15
|
-
* @param {string} inheritLayout - 继承的布局名称(来自父级目录)
|
|
16
|
-
* @returns {LayoutConfig[]} 处理后的布局配置(不包含实际的布局组件导入)
|
|
17
|
-
*/
|
|
18
|
-
export function Layouts(routes, inheritLayout = '') {
|
|
19
|
-
const result = [];
|
|
20
|
-
|
|
21
|
-
for (const route of routes) {
|
|
22
|
-
const currentPath = route.path || '';
|
|
23
|
-
|
|
24
|
-
// 检查当前路径是否有 _数字 格式
|
|
25
|
-
const pathMatch = currentPath.match(/_(\d+)$/);
|
|
26
|
-
const currentLayout = pathMatch ? pathMatch[1] : inheritLayout;
|
|
27
|
-
|
|
28
|
-
// 如果有子路由,说明这是中间节点(目录),不包裹布局,只递归处理子路由
|
|
29
|
-
if (route.children && route.children.length > 0) {
|
|
30
|
-
// 清理路径:如果是 xxx_数字 格式,去掉 _数字
|
|
31
|
-
const cleanPath = pathMatch ? currentPath.replace(/_\d+$/, '') : currentPath;
|
|
32
|
-
|
|
33
|
-
// 直接递归处理子路由,不添加当前层级到结果
|
|
34
|
-
const childConfigs = Layouts(route.children, currentLayout);
|
|
35
|
-
|
|
36
|
-
// 将子路由的路径前缀加上当前路径
|
|
37
|
-
for (const child of childConfigs) {
|
|
38
|
-
result.push({
|
|
39
|
-
...child,
|
|
40
|
-
path: cleanPath ? `${cleanPath}/${child.path}`.replace(/\/+/g, '/') : child.path
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 没有子路由的叶子节点,需要包裹布局
|
|
47
|
-
const lastPart = currentPath;
|
|
48
|
-
|
|
49
|
-
// 匹配 _数字 格式(如 index_1, news_2)
|
|
50
|
-
const match = lastPart.match(/_(\d+)$/);
|
|
51
|
-
// 优先使用文件自己的布局,其次使用继承的布局,最后使用 default
|
|
52
|
-
const layoutName = match ? match[1] : currentLayout || 'default';
|
|
53
|
-
|
|
54
|
-
// 计算清理后的路径
|
|
55
|
-
let cleanPath;
|
|
56
|
-
if (lastPart === 'index' || (lastPart.startsWith('index_') && match)) {
|
|
57
|
-
// index 或 index_数字 → 改为空路径(由父级路径表示)
|
|
58
|
-
cleanPath = '';
|
|
59
|
-
} else if (match) {
|
|
60
|
-
// xxx_数字 → 去掉 _数字 后缀
|
|
61
|
-
cleanPath = lastPart.replace(/_\d+$/, '');
|
|
62
|
-
} else {
|
|
63
|
-
// 其他 → 保持原样
|
|
64
|
-
cleanPath = lastPart;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 返回布局配置(不执行实际导入)
|
|
68
|
-
result.push({
|
|
69
|
-
path: cleanPath,
|
|
70
|
-
layoutName: layoutName,
|
|
71
|
-
component: route.component,
|
|
72
|
-
meta: route.meta
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return result;
|
|
77
|
-
}
|