befly-admin 3.4.6 → 3.4.8
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/.gitignore +2 -0
- package/index.html +2 -2
- package/package.json +8 -8
- package/src/config/{internal/index.ts → index.ts} +1 -1
- package/src/layouts/{internal/0.vue → default.vue} +49 -20
- package/src/main.ts +3 -5
- package/src/plugins/{internal/global.ts → global.ts} +1 -11
- package/src/plugins/{internal/http.ts → http.ts} +1 -1
- package/src/{plugins/internal/router.ts → router/index.ts} +22 -15
- package/src/styles/{internal/index.scss → global.scss} +29 -29
- package/src/types/auto-imports.d.ts +90 -645
- package/src/types/components.d.ts +8 -12
- package/src/types/typed-router.d.ts +32 -0
- package/src/utils/index.ts +21 -9
- package/src/views/index.vue +27 -0
- package/src/views/internal/login.vue +73 -0
- package/src/views/test.vue +60 -0
- package/tsconfig.json +4 -4
- package/vite.config.ts +131 -44
- package/src/components/internal/README.md +0 -27
- package/src/layouts/4.vue +0 -17
- package/src/layouts/internal/1.vue +0 -22
- package/src/layouts/internal/2.vue +0 -169
- package/src/layouts/internal/README.md +0 -27
- package/src/plugins/internal/README.md +0 -36
- package/src/styles/internal/README.md +0 -27
- package/src/styles/internal/mixins.scss +0 -98
- package/src/types/env.d.ts +0 -23
- package/src/utils/README.md +0 -37
- package/src/utils/internal/README.md +0 -21
- package/src/utils/internal/index.ts +0 -30
- package/src/views/internal/403/403.vue +0 -66
- package/src/views/internal/README.md +0 -27
- package/src/views/internal/admin/components/edit.vue +0 -147
- package/src/views/internal/admin/components/role.vue +0 -135
- package/src/views/internal/admin/index.vue +0 -176
- package/src/views/internal/dict/components/edit.vue +0 -156
- package/src/views/internal/dict/index.vue +0 -159
- package/src/views/internal/index/components/addonList.vue +0 -125
- package/src/views/internal/index/components/environmentInfo.vue +0 -97
- package/src/views/internal/index/components/operationLogs.vue +0 -112
- package/src/views/internal/index/components/performanceMetrics.vue +0 -148
- package/src/views/internal/index/components/quickActions.vue +0 -27
- package/src/views/internal/index/components/serviceStatus.vue +0 -181
- package/src/views/internal/index/components/systemNotifications.vue +0 -130
- package/src/views/internal/index/components/systemOverview.vue +0 -188
- package/src/views/internal/index/components/systemResources.vue +0 -104
- package/src/views/internal/index/components/userInfo.vue +0 -202
- package/src/views/internal/index/index.vue +0 -62
- package/src/views/internal/login/components/emailLoginForm.vue +0 -163
- package/src/views/internal/login/components/registerForm.vue +0 -168
- package/src/views/internal/login/components/welcomePanel.vue +0 -61
- package/src/views/internal/login/index_1.vue +0 -189
- package/src/views/internal/menu/components/edit.vue +0 -150
- package/src/views/internal/menu/index.vue +0 -168
- package/src/views/internal/news/detail/detail_2.vue +0 -26
- package/src/views/internal/news/detail/index.vue +0 -26
- package/src/views/internal/news/news.vue +0 -26
- package/src/views/internal/role/components/api.vue +0 -280
- package/src/views/internal/role/components/edit.vue +0 -129
- package/src/views/internal/role/components/menu.vue +0 -143
- package/src/views/internal/role/index.vue +0 -179
- package/src/views/internal/user/user.vue +0 -320
- /package/src/plugins/{internal/storage.ts → storage.ts} +0 -0
- /package/src/styles/{internal/variables.scss → variables.scss} +0 -0
|
@@ -11,12 +11,11 @@ export {}
|
|
|
11
11
|
/* prettier-ignore */
|
|
12
12
|
declare module 'vue' {
|
|
13
13
|
export interface GlobalComponents {
|
|
14
|
-
Icon: typeof import('./../components/internal/Icon.vue')['default']
|
|
15
14
|
'ILucide:activity': typeof import('~icons/lucide/activity')['default']
|
|
16
15
|
'ILucide:alertCircle': typeof import('~icons/lucide/alert-circle')['default']
|
|
17
16
|
'ILucide:alertTriangle': typeof import('~icons/lucide/alert-triangle')['default']
|
|
18
|
-
'ILucide:box': typeof import('~icons/lucide/box')['default']
|
|
19
17
|
'ILucide:checkCircle': typeof import('~icons/lucide/check-circle')['default']
|
|
18
|
+
'ILucide:chevronDown': typeof import('~icons/lucide/chevron-down')['default']
|
|
20
19
|
'ILucide:circle': typeof import('~icons/lucide/circle')['default']
|
|
21
20
|
'ILucide:clock': typeof import('~icons/lucide/clock')['default']
|
|
22
21
|
'ILucide:cloud': typeof import('~icons/lucide/cloud')['default']
|
|
@@ -25,14 +24,16 @@ declare module 'vue' {
|
|
|
25
24
|
'ILucide:disc': typeof import('~icons/lucide/disc')['default']
|
|
26
25
|
'ILucide:hardDrive': typeof import('~icons/lucide/hard-drive')['default']
|
|
27
26
|
'ILucide:info': typeof import('~icons/lucide/info')['default']
|
|
27
|
+
'ILucide:logOut': typeof import('~icons/lucide/log-out')['default']
|
|
28
28
|
'ILucide:mail': typeof import('~icons/lucide/mail')['default']
|
|
29
29
|
'ILucide:menu': typeof import('~icons/lucide/menu')['default']
|
|
30
|
-
'ILucide:
|
|
31
|
-
'ILucide:
|
|
30
|
+
'ILucide:pencil': typeof import('~icons/lucide/pencil')['default']
|
|
31
|
+
'ILucide:plus': typeof import('~icons/lucide/plus')['default']
|
|
32
32
|
'ILucide:rotateCw': typeof import('~icons/lucide/rotate-cw')['default']
|
|
33
33
|
'ILucide:server': typeof import('~icons/lucide/server')['default']
|
|
34
34
|
'ILucide:settings': typeof import('~icons/lucide/settings')['default']
|
|
35
35
|
'ILucide:square': typeof import('~icons/lucide/square')['default']
|
|
36
|
+
'ILucide:trash2': typeof import('~icons/lucide/trash2')['default']
|
|
36
37
|
'ILucide:trendingUp': typeof import('~icons/lucide/trending-up')['default']
|
|
37
38
|
'ILucide:user': typeof import('~icons/lucide/user')['default']
|
|
38
39
|
'ILucide:users': typeof import('~icons/lucide/users')['default']
|
|
@@ -41,12 +42,9 @@ declare module 'vue' {
|
|
|
41
42
|
'ILucide:zap': typeof import('~icons/lucide/zap')['default']
|
|
42
43
|
RouterLink: typeof import('vue-router')['RouterLink']
|
|
43
44
|
RouterView: typeof import('vue-router')['RouterView']
|
|
45
|
+
TinyAvatar: typeof import('@opentiny/vue-avatar')['default']
|
|
44
46
|
TinyButton: typeof import('@opentiny/vue-button')['default']
|
|
45
|
-
TinyCheckbox: typeof import('@opentiny/vue-checkbox')['default']
|
|
46
|
-
TinyCheckboxGroup: typeof import('@opentiny/vue-checkbox-group')['default']
|
|
47
47
|
TinyCol: typeof import('@opentiny/vue-col')['default']
|
|
48
|
-
TinyCollapse: typeof import('@opentiny/vue-collapse')['default']
|
|
49
|
-
TinyCollapseItem: typeof import('@opentiny/vue-collapse-item')['default']
|
|
50
48
|
TinyDialogBox: typeof import('@opentiny/vue-dialog-box')['default']
|
|
51
49
|
TinyDivider: typeof import('@opentiny/vue-divider')['default']
|
|
52
50
|
TinyDropdown: typeof import('@opentiny/vue-dropdown')['default']
|
|
@@ -59,15 +57,13 @@ declare module 'vue' {
|
|
|
59
57
|
TinyInput: typeof import('@opentiny/vue-input')['default']
|
|
60
58
|
TinyNumeric: typeof import('@opentiny/vue-numeric')['default']
|
|
61
59
|
TinyPager: typeof import('@opentiny/vue-pager')['default']
|
|
60
|
+
TinyPopover: typeof import('@opentiny/vue-popover')['default']
|
|
62
61
|
TinyProgress: typeof import('@opentiny/vue-progress')['default']
|
|
63
|
-
TinyQrcode: typeof import('@opentiny/vue-qrcode')['default']
|
|
64
62
|
TinyRadio: typeof import('@opentiny/vue-radio')['default']
|
|
65
63
|
TinyRadioGroup: typeof import('@opentiny/vue-radio-group')['default']
|
|
66
64
|
TinyRow: typeof import('@opentiny/vue-row')['default']
|
|
67
|
-
TinySearch: typeof import('@opentiny/vue-search')['default']
|
|
68
|
-
TinySelect: typeof import('@opentiny/vue-select')['default']
|
|
69
65
|
TinyTag: typeof import('@opentiny/vue-tag')['default']
|
|
70
|
-
TinyTree: typeof import('@opentiny/vue-tree')['default']
|
|
71
66
|
TinyTreeMenu: typeof import('@opentiny/vue-tree-menu')['default']
|
|
67
|
+
TinyUserHead: typeof import('@opentiny/vue-user-head')['default']
|
|
72
68
|
}
|
|
73
69
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️
|
|
5
|
+
// It's recommended to commit this file.
|
|
6
|
+
// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
|
|
7
|
+
|
|
8
|
+
declare module 'vue-router/auto-routes' {
|
|
9
|
+
import type {
|
|
10
|
+
RouteRecordInfo,
|
|
11
|
+
ParamValue,
|
|
12
|
+
ParamValueOneOrMore,
|
|
13
|
+
ParamValueZeroOrMore,
|
|
14
|
+
ParamValueZeroOrOne,
|
|
15
|
+
} from 'vue-router'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Route name map generated by unplugin-vue-router
|
|
19
|
+
*/
|
|
20
|
+
export interface RouteNamedMap {
|
|
21
|
+
'/addon/admin//': RouteRecordInfo<'/addon/admin//', '/addon/admin', Record<never, never>, Record<never, never>>,
|
|
22
|
+
'/addon/admin/403/': RouteRecordInfo<'/addon/admin/403/', '/addon/admin/403', Record<never, never>, Record<never, never>>,
|
|
23
|
+
'/addon/admin/admin/': RouteRecordInfo<'/addon/admin/admin/', '/addon/admin/admin', Record<never, never>, Record<never, never>>,
|
|
24
|
+
'/addon/admin/dict/': RouteRecordInfo<'/addon/admin/dict/', '/addon/admin/dict', Record<never, never>, Record<never, never>>,
|
|
25
|
+
'/addon/admin/login/': RouteRecordInfo<'/addon/admin/login/', '/addon/admin/login', Record<never, never>, Record<never, never>>,
|
|
26
|
+
'/addon/admin/menu/': RouteRecordInfo<'/addon/admin/menu/', '/addon/admin/menu', Record<never, never>, Record<never, never>>,
|
|
27
|
+
'/addon/admin/news/': RouteRecordInfo<'/addon/admin/news/', '/addon/admin/news', Record<never, never>, Record<never, never>>,
|
|
28
|
+
'/addon/admin/news/detail/': RouteRecordInfo<'/addon/admin/news/detail/', '/addon/admin/news/detail', Record<never, never>, Record<never, never>>,
|
|
29
|
+
'/addon/admin/role/': RouteRecordInfo<'/addon/admin/role/', '/addon/admin/role', Record<never, never>, Record<never, never>>,
|
|
30
|
+
'/addon/admin/user/': RouteRecordInfo<'/addon/admin/user/', '/addon/admin/user', Record<never, never>, Record<never, never>>,
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* export function formatDate(date: Date): string {
|
|
7
|
-
* return date.toISOString().split('T')[0];
|
|
8
|
-
* }
|
|
2
|
+
* 将一维数组转换为树形结构
|
|
3
|
+
* @param items 一维数组
|
|
4
|
+
* @param pid 父节点ID,默认为0
|
|
5
|
+
* @returns 树形结构数组
|
|
9
6
|
*/
|
|
7
|
+
export function arrayToTree<T extends { id: number; pid: number; children?: T[] }>(items: T[], pid = 0): T[] {
|
|
8
|
+
const tree: T[] = [];
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
for (const item of items) {
|
|
11
|
+
if (item.pid === pid) {
|
|
12
|
+
const children = arrayToTree(items, item.id);
|
|
13
|
+
const node = { ...item };
|
|
14
|
+
|
|
15
|
+
if (children.length > 0) {
|
|
16
|
+
node.children = children;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
tree.push(node);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return tree;
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-home">
|
|
3
|
+
<h1>首页</h1>
|
|
4
|
+
<p>这是使用 default 布局的首页</p>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<route lang="yaml">
|
|
9
|
+
meta:
|
|
10
|
+
layout: default
|
|
11
|
+
title: 首页
|
|
12
|
+
</route>
|
|
13
|
+
|
|
14
|
+
<style lang="scss" scoped>
|
|
15
|
+
.page-home {
|
|
16
|
+
padding: 20px;
|
|
17
|
+
|
|
18
|
+
h1 {
|
|
19
|
+
color: $primary-color;
|
|
20
|
+
margin-bottom: 16px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
p {
|
|
24
|
+
color: $text-color-secondary;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-login">
|
|
3
|
+
<div class="login-box">
|
|
4
|
+
<h1>登录</h1>
|
|
5
|
+
<tiny-form ref="formRef" :model="$Data.form" label-position="top">
|
|
6
|
+
<tiny-form-item label="用户名" prop="username">
|
|
7
|
+
<tiny-input v-model="$Data.form.username" placeholder="请输入用户名" />
|
|
8
|
+
</tiny-form-item>
|
|
9
|
+
<tiny-form-item label="密码" prop="password">
|
|
10
|
+
<tiny-input v-model="$Data.form.password" type="password" placeholder="请输入密码" />
|
|
11
|
+
</tiny-form-item>
|
|
12
|
+
<tiny-form-item>
|
|
13
|
+
<tiny-button type="primary" @click="$Method.handleLogin">登录</tiny-button>
|
|
14
|
+
</tiny-form-item>
|
|
15
|
+
</tiny-form>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
const router = useRouter();
|
|
22
|
+
|
|
23
|
+
const $Data = $ref({
|
|
24
|
+
form: {
|
|
25
|
+
username: '',
|
|
26
|
+
password: ''
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const $Method = {
|
|
31
|
+
async handleLogin() {
|
|
32
|
+
// 模拟登录
|
|
33
|
+
$Storage.local.set('token', 'mock-token-123');
|
|
34
|
+
Modal.message({ message: '登录成功', status: 'success' });
|
|
35
|
+
router.push('/');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<route lang="yaml">
|
|
41
|
+
meta:
|
|
42
|
+
layout: blank
|
|
43
|
+
public: true
|
|
44
|
+
title: 登录
|
|
45
|
+
</route>
|
|
46
|
+
|
|
47
|
+
<style lang="scss" scoped>
|
|
48
|
+
.page-login {
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
|
|
55
|
+
.login-box {
|
|
56
|
+
width: 400px;
|
|
57
|
+
padding: 40px;
|
|
58
|
+
background: #fff;
|
|
59
|
+
border-radius: 8px;
|
|
60
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
61
|
+
|
|
62
|
+
h1 {
|
|
63
|
+
text-align: center;
|
|
64
|
+
margin-bottom: 30px;
|
|
65
|
+
color: $primary-color;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tiny-button {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="test-page">
|
|
3
|
+
<h1>TinyVue 自动导入测试</h1>
|
|
4
|
+
|
|
5
|
+
<div class="button-group">
|
|
6
|
+
<tiny-button type="primary" @click="testModal">测试 Modal</tiny-button>
|
|
7
|
+
<tiny-button type="success" @click="testMessage">测试 Message</tiny-button>
|
|
8
|
+
<tiny-button type="warning" @click="testNotify">测试 Notify</tiny-button>
|
|
9
|
+
<tiny-button type="info" @click="testMessageBox">测试 MessageBox</tiny-button>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
// 无需导入,已自动导入:Modal, Message, Notify, MessageBox, Loading
|
|
16
|
+
|
|
17
|
+
const testModal = () => {
|
|
18
|
+
Modal.message({
|
|
19
|
+
message: '这是一个成功提示',
|
|
20
|
+
status: 'success'
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const testMessage = () => {
|
|
25
|
+
Message.success('成功消息');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const testNotify = () => {
|
|
29
|
+
Notify.success({
|
|
30
|
+
title: '成功通知',
|
|
31
|
+
message: '这是一个成功通知的内容'
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const testMessageBox = () => {
|
|
36
|
+
MessageBox.alert('这是一个提示框', '提示');
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<route lang="yaml">
|
|
41
|
+
meta:
|
|
42
|
+
layout: default
|
|
43
|
+
title: 自动导入测试
|
|
44
|
+
</route>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.test-page {
|
|
48
|
+
padding: 20px;
|
|
49
|
+
|
|
50
|
+
h1 {
|
|
51
|
+
color: $primary-color;
|
|
52
|
+
margin-bottom: 24px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.button-group {
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: 12px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</style>
|
package/tsconfig.json
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
/* Linting */
|
|
17
17
|
"strict": true,
|
|
18
|
-
"noUnusedLocals":
|
|
19
|
-
"noUnusedParameters":
|
|
18
|
+
"noUnusedLocals": false,
|
|
19
|
+
"noUnusedParameters": false,
|
|
20
20
|
"noFallthroughCasesInSwitch": true,
|
|
21
21
|
"noUncheckedSideEffectImports": true,
|
|
22
22
|
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/* Type definitions */
|
|
30
|
-
"types": ["vite/client", "node"]
|
|
30
|
+
"types": ["vite/client", "node", "unplugin-vue-router/client", "vite-plugin-vue-layouts-next/client"]
|
|
31
31
|
},
|
|
32
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
32
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "src/types/**/*.d.ts", "./src/types/typed-router.d.ts"],
|
|
33
33
|
"exclude": ["node_modules", "dist"]
|
|
34
34
|
}
|
package/vite.config.ts
CHANGED
|
@@ -1,95 +1,182 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import
|
|
3
|
+
import VueRouter from 'unplugin-vue-router/vite';
|
|
4
|
+
import { VueRouterAutoImports } from 'unplugin-vue-router';
|
|
5
|
+
import Layouts from 'vite-plugin-vue-layouts-next';
|
|
6
|
+
import VueDevTools from 'vite-plugin-vue-devtools';
|
|
4
7
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
5
8
|
import Components from 'unplugin-vue-components/vite';
|
|
6
9
|
import Icons from 'unplugin-icons/vite';
|
|
7
10
|
import IconsResolver from 'unplugin-icons/resolver';
|
|
11
|
+
import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
|
|
8
12
|
import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
13
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
14
|
+
import { readdirSync, existsSync } from 'node:fs';
|
|
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
|
+
}
|
|
50
|
+
|
|
51
|
+
const routesFolders = scanBeflyAddonViews();
|
|
11
52
|
|
|
12
53
|
export default defineConfig({
|
|
13
|
-
|
|
14
|
-
base: './',
|
|
54
|
+
// 插件配置
|
|
15
55
|
plugins: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
56
|
+
// Vue DevTools(仅开发环境)
|
|
57
|
+
VueDevTools(),
|
|
58
|
+
|
|
59
|
+
// VueRouter 必须在 Vue 插件之前
|
|
60
|
+
VueRouter({
|
|
61
|
+
routesFolder: routesFolders,
|
|
62
|
+
dts: './src/types/typed-router.d.ts',
|
|
63
|
+
extensions: ['.vue'],
|
|
64
|
+
importMode: 'async',
|
|
65
|
+
// 全局排除 components 目录
|
|
66
|
+
exclude: ['**/components/**']
|
|
67
|
+
}),
|
|
68
|
+
|
|
69
|
+
// 布局系统
|
|
70
|
+
Layouts({
|
|
71
|
+
layoutsDirs: 'src/layouts',
|
|
72
|
+
defaultLayout: 'default'
|
|
73
|
+
}),
|
|
74
|
+
|
|
75
|
+
// Vue 插件
|
|
76
|
+
vue({
|
|
77
|
+
script: {
|
|
78
|
+
defineModel: true,
|
|
79
|
+
propsDestructure: true
|
|
80
|
+
}
|
|
24
81
|
}),
|
|
82
|
+
|
|
83
|
+
// Vue Reactivity Transform 支持
|
|
84
|
+
ReactivityTransform(),
|
|
85
|
+
|
|
86
|
+
// API 自动导入
|
|
25
87
|
AutoImport({
|
|
26
88
|
imports: [
|
|
27
89
|
'vue',
|
|
28
|
-
'vue-router',
|
|
29
90
|
'pinia',
|
|
91
|
+
VueRouterAutoImports,
|
|
30
92
|
{
|
|
31
|
-
'@opentiny/vue': ['Modal', 'Notify', '
|
|
93
|
+
'@opentiny/vue': ['Modal', 'Notify', 'Message', 'MessageBox', 'Loading']
|
|
32
94
|
}
|
|
33
95
|
],
|
|
34
|
-
resolvers: [TinyVueSingleResolver, IconsResolver({})],
|
|
35
|
-
vueTemplate: true,
|
|
36
|
-
dirsScanOptions: {
|
|
37
|
-
filePatterns: ['*.ts'],
|
|
38
|
-
fileFilter: (file) => file.endsWith('.ts'),
|
|
39
|
-
types: true
|
|
40
|
-
},
|
|
41
|
-
dirs: ['./src/plugins/**', './src/config/**'],
|
|
42
96
|
dts: 'src/types/auto-imports.d.ts',
|
|
43
|
-
|
|
97
|
+
dirs: ['src/utils', 'src/plugins', 'src/config'],
|
|
98
|
+
vueTemplate: true
|
|
44
99
|
}),
|
|
100
|
+
|
|
101
|
+
// 组件自动导入
|
|
45
102
|
Components({
|
|
46
103
|
resolvers: [TinyVueSingleResolver, IconsResolver({})],
|
|
47
104
|
dirs: ['src/components'],
|
|
48
105
|
deep: true,
|
|
49
|
-
version: 3,
|
|
50
106
|
dts: 'src/types/components.d.ts'
|
|
107
|
+
}),
|
|
108
|
+
|
|
109
|
+
// 图标
|
|
110
|
+
Icons({
|
|
111
|
+
compiler: 'vue3',
|
|
112
|
+
autoInstall: true,
|
|
113
|
+
defaultClass: 'icon-befly',
|
|
114
|
+
defaultStyle: 'margin-right: 8px; vertical-align: middle;'
|
|
51
115
|
})
|
|
52
116
|
],
|
|
117
|
+
|
|
118
|
+
// 路径别名
|
|
53
119
|
resolve: {
|
|
54
120
|
alias: {
|
|
55
121
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
56
122
|
}
|
|
57
123
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
css: {
|
|
62
|
-
preprocessorOptions: {
|
|
63
|
-
scss: {
|
|
64
|
-
additionalData: `@use "@/styles/internal/variables.scss" as *;`,
|
|
65
|
-
api: 'modern-compiler'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
124
|
+
|
|
125
|
+
// 服务器配置
|
|
69
126
|
server: {
|
|
70
|
-
host: '0.0.0.0',
|
|
71
127
|
port: 5600,
|
|
128
|
+
host: '0.0.0.0',
|
|
72
129
|
strictPort: true,
|
|
73
|
-
open: false
|
|
74
|
-
|
|
75
|
-
logLevel: 'info',
|
|
76
|
-
optimizeDeps: {
|
|
77
|
-
include: ['vue', 'vue-router', 'pinia', '@opentiny/vue', 'axios']
|
|
130
|
+
open: false,
|
|
131
|
+
hmr: true
|
|
78
132
|
},
|
|
133
|
+
|
|
134
|
+
// 构建配置
|
|
79
135
|
build: {
|
|
80
|
-
target: '
|
|
136
|
+
target: 'es2020',
|
|
81
137
|
outDir: 'dist',
|
|
82
138
|
assetsDir: 'assets',
|
|
83
139
|
sourcemap: false,
|
|
84
140
|
minify: 'esbuild',
|
|
85
|
-
chunkSizeWarningLimit: 1000,
|
|
86
141
|
rollupOptions: {
|
|
87
142
|
output: {
|
|
143
|
+
chunkFileNames: 'assets/[name]-[hash].js',
|
|
144
|
+
entryFileNames: 'assets/[name]-[hash].js',
|
|
145
|
+
assetFileNames: 'assets/[name]-[hash].[ext]',
|
|
88
146
|
manualChunks: {
|
|
89
147
|
vue: ['vue', 'vue-router', 'pinia'],
|
|
90
148
|
opentiny: ['@opentiny/vue']
|
|
91
149
|
}
|
|
92
150
|
}
|
|
93
151
|
}
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// CSS 配置
|
|
155
|
+
css: {
|
|
156
|
+
preprocessorOptions: {
|
|
157
|
+
scss: {
|
|
158
|
+
api: 'modern-compiler',
|
|
159
|
+
// 自动导入全局 SCSS 变量
|
|
160
|
+
additionalData: `@use "@/styles/variables.scss" as *;`
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// 定义全局变量
|
|
166
|
+
define: {
|
|
167
|
+
__DEV__: JSON.stringify(process.env.NODE_ENV !== 'production')
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
// 优化依赖预构建
|
|
171
|
+
optimizeDeps: {
|
|
172
|
+
include: [
|
|
173
|
+
'vue',
|
|
174
|
+
'vue-router',
|
|
175
|
+
'pinia',
|
|
176
|
+
'axios',
|
|
177
|
+
// OpenTiny Vue 组件(使用正则匹配所有子包)
|
|
178
|
+
'@opentiny/vue'
|
|
179
|
+
// 注意:unplugin-tiny-vue 会自动处理按需导入,无需手动列出所有组件
|
|
180
|
+
]
|
|
94
181
|
}
|
|
95
182
|
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Internal 目录说明
|
|
2
|
-
|
|
3
|
-
⚠️ **重要提示**
|
|
4
|
-
|
|
5
|
-
此目录下的所有文件由 **befly-admin** 框架管理,请勿修改!
|
|
6
|
-
|
|
7
|
-
## 自动更新
|
|
8
|
-
|
|
9
|
-
运行以下命令会自动更新此目录:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
befly sync:admin
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 注意事项
|
|
16
|
-
|
|
17
|
-
1. ❌ **请勿修改** internal 目录下的任何文件
|
|
18
|
-
2. ❌ **请勿删除** internal 目录
|
|
19
|
-
3. ✅ 如需自定义组件,请在 internal 目录外创建文件
|
|
20
|
-
|
|
21
|
-
## 文件用途
|
|
22
|
-
|
|
23
|
-
此目录包含框架核心组件,确保管理系统的基础功能正常运行。
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
📚 更多信息请查看项目文档
|
package/src/layouts/4.vue
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="custom-layout-0">
|
|
3
|
-
<h1>这是用户自定义的布局 0(覆盖 internal)</h1>
|
|
4
|
-
<RouterView />
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup>
|
|
9
|
-
// 测试用户自定义布局是否能覆盖 internal 布局
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<style scoped>
|
|
13
|
-
.custom-layout-0 {
|
|
14
|
-
background-color: #f0f0f0;
|
|
15
|
-
padding: 20px;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="layout-container">
|
|
3
|
-
<RouterView />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup>
|
|
8
|
-
const router = useRouter();
|
|
9
|
-
const route = useRoute();
|
|
10
|
-
|
|
11
|
-
// 响应式数据
|
|
12
|
-
const $Data = $ref({});
|
|
13
|
-
|
|
14
|
-
// 方法
|
|
15
|
-
const $Method = {};
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<style scoped lang="scss">
|
|
19
|
-
.layout-container {
|
|
20
|
-
height: 100vh;
|
|
21
|
-
}
|
|
22
|
-
</style>
|