befly-admin 3.4.28 → 3.4.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-admin",
3
- "version": "3.4.28",
3
+ "version": "3.4.30",
4
4
  "description": "Befly Admin - 基于 Vue3 + OpenTiny Vue 的后台管理系统",
5
5
  "type": "module",
6
6
  "private": false,
@@ -29,16 +29,14 @@
29
29
  "sync:admin": "bunx befly sync:admin"
30
30
  },
31
31
  "dependencies": {
32
- "@opentiny/vue": "^3.27.0",
33
32
  "axios": "^1.13.2",
34
33
  "pinia": "^3.0.4",
35
34
  "vue": "^3.5.22",
36
35
  "vue-router": "^4.6.3"
37
36
  },
38
37
  "devDependencies": {
39
- "@befly-addon/admin": "1.0.30",
38
+ "@befly-addon/admin": "1.0.32",
40
39
  "@iconify-json/lucide": "^1.2.72",
41
- "@opentiny/unplugin-tiny-vue": "^1.0.0",
42
40
  "@unocss/preset-attributify": "^66.5.6",
43
41
  "@unocss/preset-uno": "^66.5.6",
44
42
  "@vitejs/plugin-vue": "^6.0.1",
@@ -58,5 +56,5 @@
58
56
  "node": ">=24.0.0",
59
57
  "pnpm": ">=10.0.0"
60
58
  },
61
- "gitHead": "178b2045d0a76ba734ec623b7e478b3024a58e6d"
59
+ "gitHead": "7f8bd9dc5342e59953997d58e6abf6ca2469b211"
62
60
  }
@@ -122,13 +122,13 @@ const $Method = {
122
122
 
123
123
  // 处理退出登录
124
124
  handleLogout() {
125
- Modal.confirm({
126
- message: '确定要退出登录吗?',
127
- title: '确认',
125
+ DialogPlugin.confirm({
126
+ body: '确定要退出登录吗?',
127
+ header: '确认',
128
128
  onConfirm: () => {
129
129
  $Storage.local.remove('token');
130
130
  router.push('/internal/login');
131
- Message.success('退出成功');
131
+ MessagePlugin.success('退出成功');
132
132
  }
133
133
  });
134
134
  }
package/src/main.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import App from './App.vue';
2
2
 
3
+ // 引入 TDesign 样式
4
+ import 'tdesign-vue-next/es/style/index.css';
5
+
3
6
  // 引入 UnoCSS 样式
4
7
  import 'virtual:uno.css';
5
8
 
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { Modal } from '@opentiny/vue';
2
+ import { MessagePlugin } from 'tdesign-vue-next';
3
3
  import { $Storage } from './storage';
4
4
 
5
5
  /**
@@ -49,17 +49,14 @@ request.interceptors.response.use(
49
49
 
50
50
  // 如果code不是0,说明业务失败
51
51
  if (res.code !== 0) {
52
- Modal.message({
53
- message: res.msg || '请求失败',
54
- status: 'error'
55
- });
52
+ MessagePlugin.error(res.msg || '请求失败');
56
53
  return Promise.reject(res.data);
57
54
  }
58
55
 
59
56
  return res;
60
57
  },
61
58
  (error) => {
62
- Modal.message({ message: '网络连接失败', status: 'error' });
59
+ MessagePlugin.error('网络连接失败');
63
60
  return Promise.reject(error);
64
61
  }
65
62
  );
@@ -9,12 +9,9 @@ declare global {
9
9
  const $Config: typeof import('../config/index.js').$Config
10
10
  const $Http: typeof import('../plugins/http.js').$Http
11
11
  const $Storage: typeof import('../plugins/storage.js').$Storage
12
+ const DialogPlugin: typeof import('tdesign-vue-next').DialogPlugin
12
13
  const EffectScope: typeof import('vue').EffectScope
13
- const Loading: typeof import('@opentiny/vue').Loading
14
- const Message: typeof import('@opentiny/vue').Message
15
- const MessageBox: typeof import('@opentiny/vue').MessageBox
16
- const Modal: typeof import('@opentiny/vue').Modal
17
- const Notify: typeof import('@opentiny/vue').Notify
14
+ const MessagePlugin: typeof import('tdesign-vue-next').MessagePlugin
18
15
  const acceptHMRUpdate: typeof import('pinia').acceptHMRUpdate
19
16
  const arrayToTree: typeof import('../utils/index.js').arrayToTree
20
17
  const computed: typeof import('vue').computed
@@ -23,7 +20,6 @@ declare global {
23
20
  const customRef: typeof import('vue').customRef
24
21
  const defineAsyncComponent: typeof import('vue').defineAsyncComponent
25
22
  const defineComponent: typeof import('vue').defineComponent
26
- const definePage: typeof import('unplugin-vue-router/runtime').definePage
27
23
  const defineStore: typeof import('pinia').defineStore
28
24
  const effectScope: typeof import('vue').effectScope
29
25
  const getActivePinia: typeof import('pinia').getActivePinia
@@ -108,11 +104,7 @@ declare module 'vue' {
108
104
  readonly $Http: UnwrapRef<typeof import('../plugins/http.js')['$Http']>
109
105
  readonly $Storage: UnwrapRef<typeof import('../plugins/storage.js')['$Storage']>
110
106
  readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
111
- readonly Loading: UnwrapRef<typeof import('@opentiny/vue')['Loading']>
112
- readonly Message: UnwrapRef<typeof import('@opentiny/vue')['Message']>
113
- readonly MessageBox: UnwrapRef<typeof import('@opentiny/vue')['MessageBox']>
114
- readonly Modal: UnwrapRef<typeof import('@opentiny/vue')['Modal']>
115
- readonly Notify: UnwrapRef<typeof import('@opentiny/vue')['Notify']>
107
+ readonly MessagePlugin: UnwrapRef<typeof import('tdesign-vue-next')['MessagePlugin']>
116
108
  readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
117
109
  readonly arrayToTree: UnwrapRef<typeof import('../utils/index.js')['arrayToTree']>
118
110
  readonly computed: UnwrapRef<typeof import('vue')['computed']>
@@ -16,8 +16,24 @@ declare module 'vue' {
16
16
  'ILucide:home': typeof import('~icons/lucide/home')['default']
17
17
  RouterLink: typeof import('vue-router')['RouterLink']
18
18
  RouterView: typeof import('vue-router')['RouterView']
19
- TinyButton: typeof import('@opentiny/vue-button')['default']
20
- TinyTag: typeof import('@opentiny/vue-tag')['default']
21
- TinyTreeMenu: typeof import('@opentiny/vue-tree-menu')['default']
19
+ TButton: typeof import('tdesign-vue-next')['Button']
20
+ TDialog: typeof import('tdesign-vue-next')['Dialog']
21
+ TDivider: typeof import('tdesign-vue-next')['Divider']
22
+ TDropdown: typeof import('tdesign-vue-next')['Dropdown']
23
+ TDropdownItem: typeof import('tdesign-vue-next')['DropdownItem']
24
+ TDropdownMenu: typeof import('tdesign-vue-next')['DropdownMenu']
25
+ TForm: typeof import('tdesign-vue-next')['Form']
26
+ TFormItem: typeof import('tdesign-vue-next')['FormItem']
27
+ TInput: typeof import('tdesign-vue-next')['Input']
28
+ TInputNumber: typeof import('tdesign-vue-next')['InputNumber']
29
+ TLink: typeof import('tdesign-vue-next')['Link']
30
+ TPagination: typeof import('tdesign-vue-next')['Pagination']
31
+ TRadio: typeof import('tdesign-vue-next')['Radio']
32
+ TRadioGroup: typeof import('tdesign-vue-next')['RadioGroup']
33
+ TSelect: typeof import('tdesign-vue-next')['Select']
34
+ TSpace: typeof import('tdesign-vue-next')['Space']
35
+ TTable: typeof import('tdesign-vue-next')['Table']
36
+ TTag: typeof import('tdesign-vue-next')['Tag']
37
+ TTree: typeof import('tdesign-vue-next')['Tree']
22
38
  }
23
39
  }
@@ -31,7 +31,7 @@ const $Method = {
31
31
  async handleLogin() {
32
32
  // 模拟登录
33
33
  $Storage.local.set('token', 'mock-token-123');
34
- Modal.message({ message: '登录成功', status: 'success' });
34
+ MessagePlugin.success('登录成功');
35
35
  router.push('/');
36
36
  }
37
37
  };
@@ -12,13 +12,10 @@
12
12
  </template>
13
13
 
14
14
  <script setup>
15
- // 无需导入,已自动导入:Modal, Message, Notify, MessageBox, Loading
15
+ // 无需导入,已自动导入:MessagePlugin, DialogPlugin, NotificationPlugin, LoadingPlugin
16
16
 
17
17
  const testModal = () => {
18
- Modal.message({
19
- message: '这是一个成功提示',
20
- status: 'success'
21
- });
18
+ MessagePlugin.success('这是一个成功提示');
22
19
  };
23
20
 
24
21
  const testMessage = () => {
package/vite.config.js CHANGED
@@ -5,10 +5,10 @@ import { VueRouterAutoImports } from 'unplugin-vue-router';
5
5
  import VueDevTools from 'vite-plugin-vue-devtools';
6
6
  import AutoImport from 'unplugin-auto-import/vite';
7
7
  import Components from 'unplugin-vue-components/vite';
8
+ import { TDesignResolver } from 'unplugin-vue-components/resolvers';
8
9
  import Icons from 'unplugin-icons/vite';
9
10
  import IconsResolver from 'unplugin-icons/resolver';
10
11
  import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
11
- import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
12
12
  import UnoCSS from 'unocss/vite';
13
13
  import { fileURLToPath, URL } from 'node:url';
14
14
  import { scanBeflyAddonViews } from '@befly-addon/admin/utils/scanBeflyAddonViews';
@@ -48,13 +48,11 @@ export default defineConfig({
48
48
 
49
49
  // API 自动导入
50
50
  AutoImport({
51
- imports: [
52
- 'vue',
53
- 'pinia',
54
- VueRouterAutoImports,
55
- {
56
- '@opentiny/vue': ['Modal', 'Notify', 'Message', 'MessageBox', 'Loading']
57
- }
51
+ imports: ['vue', 'pinia', VueRouterAutoImports],
52
+ resolvers: [
53
+ TDesignResolver({
54
+ library: 'vue-next'
55
+ })
58
56
  ],
59
57
  dts: 'src/types/auto-imports.d.ts',
60
58
  dirs: ['src/utils', 'src/plugins', 'src/config'],
@@ -63,7 +61,12 @@ export default defineConfig({
63
61
 
64
62
  // 组件自动导入
65
63
  Components({
66
- resolvers: [TinyVueSingleResolver, IconsResolver({})],
64
+ resolvers: [
65
+ TDesignResolver({
66
+ library: 'vue-next'
67
+ }),
68
+ IconsResolver({})
69
+ ],
67
70
  dirs: ['src/components'],
68
71
  deep: true,
69
72
  dts: 'src/types/components.d.ts'
@@ -72,7 +75,7 @@ export default defineConfig({
72
75
  // 图标
73
76
  Icons({
74
77
  compiler: 'vue3',
75
- autoInstall: true,
78
+ autoInstall: false,
76
79
  defaultClass: 'icon-befly',
77
80
  defaultStyle: 'margin-right: 8px; vertical-align: middle;'
78
81
  })
@@ -101,18 +104,90 @@ export default defineConfig({
101
104
  assetsDir: 'assets',
102
105
  sourcemap: false,
103
106
  minify: 'esbuild',
107
+ chunkSizeWarningLimit: 1000,
104
108
  rollupOptions: {
105
109
  output: {
106
110
  chunkFileNames: 'assets/js/[name]-[hash].js',
107
111
  entryFileNames: 'assets/js/[name]-[hash].js',
108
112
  assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
109
- manualChunks: {
110
- // Vue 核心
111
- 'vue-vendor': ['vue', 'vue-router', 'pinia'],
112
- // UI 组件库
113
- 'ui-vendor': ['@opentiny/vue'],
114
- // 工具库
115
- 'utils-vendor': ['axios']
113
+ manualChunks: (id) => {
114
+ // Vue 核心框架(独立文件)
115
+ if (id.includes('node_modules/vue/') || id.includes('node_modules/@vue/')) {
116
+ return 'framework-vue';
117
+ }
118
+ if (id.includes('node_modules/vue-router/')) {
119
+ return 'framework-vue-router';
120
+ }
121
+ if (id.includes('node_modules/pinia/')) {
122
+ return 'framework-pinia';
123
+ }
124
+
125
+ // TinyVue 细粒度拆分
126
+ if (id.includes('@opentiny/vue-renderless/src/grid')) {
127
+ return 'tiny-grid';
128
+ }
129
+ if (id.includes('@opentiny/vue-renderless/src/table')) {
130
+ return 'tiny-table';
131
+ }
132
+ if (id.includes('@opentiny/vue-renderless/src/tree')) {
133
+ return 'tiny-tree';
134
+ }
135
+ if (id.includes('@opentiny/vue-renderless/src/form')) {
136
+ return 'tiny-form';
137
+ }
138
+ if (id.includes('node_modules/@opentiny/vue-renderless/')) {
139
+ return 'tiny-renderless';
140
+ }
141
+ if (id.includes('node_modules/@opentiny/vue-theme/')) {
142
+ return 'tiny-theme';
143
+ }
144
+ if (id.includes('node_modules/@opentiny/vue-locale/')) {
145
+ return 'tiny-locale';
146
+ }
147
+ if (id.includes('node_modules/@opentiny/vue-common/')) {
148
+ return 'tiny-common';
149
+ }
150
+ if (id.includes('node_modules/@opentiny/vue-icon/')) {
151
+ return 'tiny-icon';
152
+ }
153
+
154
+ // 工具库(独立文件)
155
+ if (id.includes('node_modules/axios/')) {
156
+ return 'lib-axios';
157
+ }
158
+
159
+ // lodash-es 独立拆分(体积较大)
160
+ if (id.includes('node_modules/lodash-es/') || id.includes('node_modules/.bun/lodash-es')) {
161
+ return 'lib-lodash';
162
+ }
163
+
164
+ // echarts 及相关库(TinyVue 图表组件依赖)
165
+ if (id.includes('node_modules/echarts/') || id.includes('node_modules/.bun/echarts')) {
166
+ return 'lib-echarts';
167
+ }
168
+ if (id.includes('node_modules/zrender/') || id.includes('node_modules/.bun/zrender')) {
169
+ return 'lib-zrender';
170
+ }
171
+
172
+ // Lucide 图标
173
+ if (id.includes('node_modules/@iconify/') || id.includes('~icons/')) {
174
+ return 'icons';
175
+ }
176
+
177
+ // Vue Macros
178
+ if (id.includes('node_modules/@vue-macros/') || id.includes('node_modules/vue-macros/')) {
179
+ return 'vue-macros';
180
+ }
181
+
182
+ // befly-addon
183
+ if (id.includes('@befly-addon/')) {
184
+ return 'befly-addon';
185
+ }
186
+
187
+ // 其他 node_modules 依赖
188
+ if (id.includes('node_modules/')) {
189
+ return 'vendor';
190
+ }
116
191
  }
117
192
  }
118
193
  }
@@ -131,6 +206,15 @@ export default defineConfig({
131
206
 
132
207
  // 优化配置
133
208
  optimizeDeps: {
134
- include: ['vue', 'vue-router', 'pinia', 'axios', '@opentiny/vue', 'vue-macros/macros']
209
+ include: [
210
+ // Vue 核心框架
211
+ 'vue',
212
+ 'vue-router',
213
+ 'pinia',
214
+ 'axios',
215
+ 'vue-macros/macros',
216
+ // TDesign Vue Next(按需加载,无需预配置)
217
+ 'tdesign-vue-next'
218
+ ]
135
219
  }
136
220
  });