befly-admin 3.13.18 → 3.13.19

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,7 +1,7 @@
1
1
  {
2
2
  "name": "befly-admin",
3
- "version": "3.13.18",
4
- "gitHead": "92ce66448bbb82aea5a864b0430c3b670c09f47f",
3
+ "version": "3.13.19",
4
+ "gitHead": "0690bdde6ac3f8c13ba8f580d39a7f2f6e31f10a",
5
5
  "private": false,
6
6
  "description": "Befly Admin - 基于 Vue3 + TDesign Vue Next 的后台管理系统",
7
7
  "files": [
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "axios": "^1.13.5",
32
- "befly-admin-ui": "1.8.23",
32
+ "befly-admin-ui": "1.8.24",
33
33
  "befly-vite": "^1.5.7",
34
34
  "pinia": "^3.0.4",
35
35
  "tdesign-icons-vue-next": "^0.4.0",
@@ -1,21 +1,10 @@
1
- /**
2
- * 内部配置
3
- * 存放框架内置的配置变量,不建议修改
4
- */
5
- /**
6
- * 内置配置对象
7
- */
8
1
  export const $Config = {
9
- /** 应用标题 */
10
- appTitle: import.meta.env.VITE_APP_TITLE || "野蜂飞舞",
11
- /**
12
- * 表格高度(有分页的页面)
13
- * 适用:存在底部分页栏(main-page/TPagination)的 page-table 列表页
14
- */
15
- tableHeightWithPagination: "calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)",
16
- /**
17
- * 表格高度(无分页的页面)
18
- * 适用:无底部分页栏,仅搜索栏 + 内容区的 page-table 列表页
19
- */
20
- tableHeightWithoutPagination: "calc(100vh - var(--search-height) - var(--layout-gap) * 2)"
2
+ appTitle: "野蜂飞舞",
3
+ appDesc: "轻量级业务快速开发框架",
4
+ loginFootnote: "",
5
+ tokenName: "befly-admin-token",
6
+ loginPath: "/core/login",
7
+ homePath: "/core",
8
+ uploadPath: "",
9
+ apiPath: import.meta.env.PROD ? "http://localhost:3000/api" : "http://localhost:3000/api"
21
10
  };
@@ -1,7 +1,6 @@
1
- const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
2
1
  async function requestPost(tokenGetter, url, data, dropValues, dropKeyValue) {
3
2
  try {
4
- const fullUrl = `${API_BASE_URL}${url}`;
3
+ const fullUrl = `${$Config.apiPath}${url}`;
5
4
  const isForm = data instanceof FormData;
6
5
  const dropList = Array.isArray(dropValues) ? dropValues : [null, undefined];
7
6
  const dropKeyMap = dropKeyValue && typeof dropKeyValue === "object" ? dropKeyValue : {};
@@ -84,9 +83,9 @@ async function requestPost(tokenGetter, url, data, dropValues, dropKeyValue) {
84
83
  }
85
84
  export const $Http = {
86
85
  json: async (url, data, dropValues, dropKeyValue) => {
87
- return requestPost(() => localStorage.getItem("yicode-token") ?? "", url, data ?? {}, dropValues, dropKeyValue);
86
+ return requestPost(() => localStorage.getItem($Config.tokenName) ?? "", url, data ?? {}, dropValues, dropKeyValue);
88
87
  },
89
88
  form: async (url, formData, dropValues, dropKeyValue) => {
90
- return requestPost(() => localStorage.getItem("yicode-token") ?? "", url, formData, dropValues, dropKeyValue);
89
+ return requestPost(() => localStorage.getItem($Config.tokenName) ?? "", url, formData, dropValues, dropKeyValue);
91
90
  }
92
91
  };
@@ -1,9 +1,10 @@
1
1
  import { Layouts } from "befly-vite";
2
2
  import { createRouter, createWebHashHistory } from "vue-router";
3
3
  import { routes } from "vue-router/auto-routes";
4
+ import { $Config } from "@/plugins/config.js";
4
5
 
5
6
  // 应用自定义布局系统(同时可选注入根路径重定向)
6
- const finalRoutes = Layouts(routes, import.meta.env.VITE_HOME_PATH, (layoutName) => {
7
+ const finalRoutes = Layouts(routes, $Config.homePath, (layoutName) => {
7
8
  if (layoutName === "default") {
8
9
  return () => import("befly-admin-ui/layouts/default.vue");
9
10
  }
@@ -26,12 +27,12 @@ export const $Router = createRouter({
26
27
 
27
28
  // 路由守卫 - 基础鉴权(最小实现:public 放行;未登录跳登录;已登录访问登录页跳首页)
28
29
  $Router.beforeEach((to, _from) => {
29
- const token = localStorage.getItem("yicode-token");
30
+ const token = localStorage.getItem($Config.tokenName);
30
31
  const toPath = to.path;
31
32
 
32
33
  // 根路径:按是否登录分流(兜底,避免 / 永远重定向到首页)
33
34
  if (toPath === "/") {
34
- return token ? import.meta.env.VITE_HOME_PATH : import.meta.env.VITE_LOGIN_PATH;
35
+ return token ? $Config.homePath : $Config.loginPath;
35
36
  }
36
37
 
37
38
  // 公开路由放行
@@ -40,13 +41,13 @@ $Router.beforeEach((to, _from) => {
40
41
  }
41
42
 
42
43
  // 未登录访问非公开路由 → 登录页
43
- if (!token && toPath !== import.meta.env.VITE_LOGIN_PATH) {
44
- return import.meta.env.VITE_LOGIN_PATH;
44
+ if (!token && toPath !== $Config.loginPath) {
45
+ return $Config.loginPath;
45
46
  }
46
47
 
47
48
  // 已登录访问登录页 → 首页
48
- if (token && toPath === import.meta.env.VITE_LOGIN_PATH) {
49
- return import.meta.env.VITE_HOME_PATH;
49
+ if (token && toPath === $Config.loginPath) {
50
+ return $Config.homePath;
50
51
  }
51
52
 
52
53
  return true;
@@ -55,7 +56,4 @@ $Router.beforeEach((to, _from) => {
55
56
  // 路由就绪后处理
56
57
  $Router.afterEach((_to) => {
57
58
  // 可以在这里添加页面访问统计等
58
- if (import.meta.env.DEV) {
59
- // 开发环境调试日志请使用更合适的日志方案(此处避免 console 触发 lint 门禁)
60
- }
61
59
  });
package/.env DELETED
@@ -1,7 +0,0 @@
1
- # 所有环境共享的基础配置
2
-
3
- # 应用标题
4
- VITE_APP_TITLE="野蜂飞舞"
5
- VITE_LOGIN_PATH="/core/login"
6
- VITE_HOME_PATH="/core"
7
- VITE_UPLOAD_PATH=""
package/.env.development DELETED
@@ -1,7 +0,0 @@
1
- # 开发环境配置
2
-
3
- # 接口请求地址
4
- VITE_API_BASE_URL="http://localhost:3000/api"
5
-
6
- # 存储命名空间
7
- VITE_STORAGE_NAMESPACE="befly_admin_dev"
package/.env.production DELETED
@@ -1,7 +0,0 @@
1
- # 生产环境配置
2
-
3
- # 接口请求地址(部署时修改为实际的生产环境地址)
4
- VITE_API_BASE_URL="http://localhost:3000/api"
5
-
6
- # 存储命名空间
7
- VITE_STORAGE_NAMESPACE="befly_admin_prod"