befly-admin 3.6.14 → 3.6.16
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 +7 -7
- package/src/main.js +0 -2
- package/src/plugins/router.js +34 -13
- package/vite.config.js +1 -5
- package/uno.config.js +0 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-admin",
|
|
3
|
-
"version": "3.6.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "3.6.16",
|
|
4
|
+
"gitHead": "f5d17c019a58e82cfacec5ce3a1f04e3225ba838",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly Admin - 基于 Vue3 + TDesign Vue Next 的后台管理系统",
|
|
7
7
|
"files": [
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"index.html",
|
|
14
14
|
"package.json",
|
|
15
15
|
"README.md",
|
|
16
|
-
"uno.config.js",
|
|
17
16
|
"vite.config.js",
|
|
18
17
|
"public/",
|
|
19
18
|
"src/"
|
|
@@ -29,14 +28,15 @@
|
|
|
29
28
|
"preview": "vite preview"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
|
-
"@befly-addon/admin": "^1.2.
|
|
31
|
+
"@befly-addon/admin": "^1.2.16",
|
|
33
32
|
"@iconify-json/lucide": "^1.2.82",
|
|
34
33
|
"axios": "^1.13.2",
|
|
35
|
-
"befly-shared": "^1.3.
|
|
36
|
-
"befly-vite": "^1.2.
|
|
34
|
+
"befly-shared": "^1.3.9",
|
|
35
|
+
"befly-vite": "^1.2.11",
|
|
36
|
+
"esbuild": "^0.25.0",
|
|
37
37
|
"pinia": "^3.0.4",
|
|
38
38
|
"tdesign-vue-next": "^1.17.7",
|
|
39
|
-
"unplugin-vue-router": "^0.19.
|
|
39
|
+
"unplugin-vue-router": "^0.19.2",
|
|
40
40
|
"vite": "^8.0.0-beta.5",
|
|
41
41
|
"vue": "^3.5.26",
|
|
42
42
|
"vue-router": "^4.6.4"
|
package/src/main.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import { Table as TTable } from "tdesign-vue-next";
|
|
3
3
|
// 引入 TDesign 样式
|
|
4
4
|
import "tdesign-vue-next/es/style/index.css";
|
|
5
|
-
// 引入 UnoCSS 样式
|
|
6
|
-
import "virtual:uno.css";
|
|
7
5
|
// 引入 addonAdmin 的 CSS 变量
|
|
8
6
|
import "@befly-addon/admin/styles/variables.scss";
|
|
9
7
|
// 引入全局基础样式(reset、通用类、滚动条等)
|
package/src/plugins/router.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { $Storage } from "@/plugins/storage";
|
|
2
|
-
import {
|
|
2
|
+
import { Layouts } from "befly-vite";
|
|
3
3
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
4
4
|
import { routes } from "vue-router/auto-routes";
|
|
5
5
|
|
|
6
6
|
// 应用自定义布局系统
|
|
7
|
-
const layoutRoutes =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
);
|
|
7
|
+
const layoutRoutes = Layouts(routes, (layoutName) => {
|
|
8
|
+
if (layoutName === "default") {
|
|
9
|
+
return () => import("@/layouts/default.vue");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return () => import(`@/layouts/${layoutName}.vue`);
|
|
13
|
+
});
|
|
14
14
|
|
|
15
15
|
// 添加根路径重定向
|
|
16
16
|
const finalRoutes = [
|
|
@@ -29,11 +29,32 @@ export const router = createRouter({
|
|
|
29
29
|
routes: finalRoutes
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
// 路由守卫 -
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// 路由守卫 - 基础鉴权(最小实现:public 放行;未登录跳登录;已登录访问登录页跳首页)
|
|
33
|
+
router.beforeEach((to, _from, next) => {
|
|
34
|
+
const token = $Storage.local.get("token");
|
|
35
|
+
const toPath = to.path;
|
|
36
|
+
|
|
37
|
+
// 根路径:按是否登录分流(兜底,避免 / 永远重定向到首页)
|
|
38
|
+
if (toPath === "/") {
|
|
39
|
+
return next(token ? $Config.homePath : $Config.loginPath);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 公开路由放行
|
|
43
|
+
if (to.meta?.public === true) {
|
|
44
|
+
return next();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 未登录访问非公开路由 → 登录页
|
|
48
|
+
if (!token && toPath !== $Config.loginPath) {
|
|
49
|
+
return next($Config.loginPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 已登录访问登录页 → 首页
|
|
53
|
+
if (token && toPath === $Config.loginPath) {
|
|
54
|
+
return next($Config.homePath);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
next();
|
|
37
58
|
});
|
|
38
59
|
|
|
39
60
|
// 路由就绪后处理
|
package/vite.config.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
|
|
3
3
|
import { createBeflyViteConfig } from "befly-vite";
|
|
4
|
-
import { scanViews } from "befly-vite/utils/scanViews";
|
|
5
4
|
|
|
6
5
|
export default createBeflyViteConfig({
|
|
7
6
|
root: fileURLToPath(new URL(".", import.meta.url)),
|
|
8
|
-
|
|
9
|
-
optimizeDeps: {
|
|
10
|
-
include: []
|
|
11
|
-
}
|
|
7
|
+
addonView: "adminViews"
|
|
12
8
|
});
|
package/uno.config.js
DELETED