befly-admin-ui 1.8.23 → 1.8.25

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.
@@ -353,7 +353,7 @@ async function loadList(options) {
353
353
  }
354
354
  }
355
355
 
356
- const res = await $Http.json(listEndpoint.path, data, listEndpoint.dropValues, listEndpoint.dropKeyValue);
356
+ const res = await $Http(listEndpoint.path, data, listEndpoint.dropValues, listEndpoint.dropKeyValue);
357
357
 
358
358
  // 并发保护:旧请求返回后不应覆盖新请求的状态
359
359
  if (seq !== requestSeq) {
@@ -517,7 +517,7 @@ async function deleteRow(row) {
517
517
  }
518
518
  }
519
519
 
520
- await $Http.json(ep.path, data, ep.dropValues, ep.dropKeyValue);
520
+ await $Http(ep.path, data, ep.dropValues, ep.dropKeyValue);
521
521
 
522
522
  MessagePlugin.success("删除成功");
523
523
  destroy();
@@ -7,7 +7,7 @@
7
7
  <div class="logo-icon">
8
8
  <AppIcon style="width: 24px; height: 24px; color: var(--primary-color)" />
9
9
  </div>
10
- <h2>{{ appTitle }}</h2>
10
+ <h2>{{ $Config.appTitle }}</h2>
11
11
  </div>
12
12
 
13
13
  <!-- 菜单区域 -->
@@ -45,7 +45,7 @@
45
45
  <span>系统设置</span>
46
46
  </div>
47
47
  <div class="footer-user">
48
- <t-upload :action="uploadPath" :headers="uploadHeaders" :show-upload-list="false" accept="image/*" @success="onAvatarUploadSuccess">
48
+ <t-upload :action="$Config.uploadPath" :headers="uploadHeaders" :show-upload-list="false" accept="image/*" @success="onAvatarUploadSuccess">
49
49
  <div class="user-avatar" :class="{ 'has-avatar': $Data.userInfo.avatar }">
50
50
  <img v-if="$Data.userInfo.avatar" :src="$Data.userInfo.avatar" alt="avatar" />
51
51
  <UserIcon v-else style="width: 16px; height: 16px; color: #fff" />
@@ -82,14 +82,11 @@ import { CloudIcon, CloseCircleIcon, CodeIcon, LinkIcon, MenuIcon, SettingIcon,
82
82
  import { reactive, watch } from "vue";
83
83
  import { useRoute, useRouter } from "vue-router";
84
84
  import { $Http } from "@/plugins/http.js";
85
+ import { $Config } from "@/plugins/config.js";
85
86
 
86
87
  const router = useRouter();
87
88
  const route = useRoute();
88
- const uploadHeaders = { Authorization: localStorage.getItem("yicode-token") || "" };
89
-
90
- const loginPath = "/core/login";
91
- const appTitle = import.meta.env.VITE_APP_TITLE;
92
- const uploadPath = import.meta.env.VITE_UPLOAD_PATH;
89
+ const uploadHeaders = { Authorization: localStorage.getItem($Config.tokenName) || "" };
93
90
 
94
91
  function isString(value) {
95
92
  return typeof value === "string";
@@ -139,7 +136,7 @@ const $Data = reactive({
139
136
 
140
137
  async function fetchUserMenus() {
141
138
  try {
142
- const { data } = await $Http.json("/core/menu/all");
139
+ const { data } = await $Http("/core/menu/all");
143
140
  const lists = Array.isArray(data?.lists) ? data.lists : [];
144
141
 
145
142
  const normalizedLists = lists.map((menu) => {
@@ -223,8 +220,8 @@ async function handleLogout() {
223
220
  }
224
221
 
225
222
  try {
226
- localStorage.removeItem("yicode-token");
227
- await router.push(loginPath);
223
+ localStorage.removeItem($Config.tokenName);
224
+ await router.push($Config.loginPath);
228
225
  MessagePlugin.success("退出成功");
229
226
  destroy();
230
227
  } catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly-admin-ui",
3
- "version": "1.8.23",
4
- "gitHead": "92ce66448bbb82aea5a864b0430c3b670c09f47f",
3
+ "version": "1.8.25",
4
+ "gitHead": "51060719cdf19c3190a4e5c635a0ca3ae0bfd16a",
5
5
  "private": false,
6
6
  "description": "Befly - 管理后台功能组件",
7
7
  "keywords": [
@@ -45,8 +45,5 @@
45
45
  "dev": "vite",
46
46
  "build": "vite build",
47
47
  "preview": "vite preview"
48
- },
49
- "peerDependencies": {
50
- "tdesign-icons-vue-next": "^0.4.0"
51
48
  }
52
49
  }
@@ -83,7 +83,7 @@ async function handleSubmit() {
83
83
  params["id"] = row["id"];
84
84
  }
85
85
 
86
- await $Http.json(apiUrl, params);
86
+ await $Http(apiUrl, params);
87
87
  MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
88
88
  visible.value = false;
89
89
  $Emit("success");
@@ -115,7 +115,7 @@ async function initData() {
115
115
 
116
116
  async function apiDictTypeAll() {
117
117
  try {
118
- const res = await $Http.json("/core/dictType/all", {}, [""]);
118
+ const res = await $Http("/core/dictType/all", {}, [""]);
119
119
  $Data.typeList = res.data.lists || [];
120
120
  } catch (error) {
121
121
  MessagePlugin.error(error.msg || error.message || "加载数据失败");
@@ -75,7 +75,7 @@ async function handleSubmit() {
75
75
  params["id"] = row["id"];
76
76
  }
77
77
 
78
- await $Http.json(apiUrl, params);
78
+ await $Http(apiUrl, params);
79
79
  MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
80
80
  visible.value = false;
81
81
  $Emit("success");
@@ -149,7 +149,7 @@ async function onSubmit(context) {
149
149
  $Data.submitting = true;
150
150
  try {
151
151
  const api = $Prop.actionType === "upd" ? "/core/sysConfig/upd" : "/core/sysConfig/ins";
152
- await $Http.json(api, $Data.formData);
152
+ await $Http(api, $Data.formData);
153
153
 
154
154
  MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
155
155
  $Emit("success");
@@ -35,7 +35,7 @@ const addonList = reactive([]);
35
35
  // 获取数据
36
36
  const fetchData = async () => {
37
37
  try {
38
- const res = await $Http.json("/core/dashboard/addonList", {}, [""]);
38
+ const res = await $Http("/core/dashboard/addonList", {}, [""]);
39
39
  addonList.splice(0, addonList.length, ...res.data);
40
40
  } catch (_error) {
41
41
  // 静默失败:不阻断页面展示
@@ -53,7 +53,7 @@ const environmentInfo = reactive({
53
53
  // 获取数据
54
54
  const fetchData = async () => {
55
55
  try {
56
- const res = await $Http.json("/core/dashboard/environmentInfo", {}, [""]);
56
+ const res = await $Http("/core/dashboard/environmentInfo", {}, [""]);
57
57
  Object.assign(environmentInfo, res.data);
58
58
  } catch (_error) {
59
59
  // 静默失败:不阻断页面展示
@@ -69,7 +69,7 @@ const performanceMetrics = reactive({
69
69
  // 获取数据
70
70
  const fetchData = async () => {
71
71
  try {
72
- const res = await $Http.json("/core/dashboard/performanceMetrics", {}, [""]);
72
+ const res = await $Http("/core/dashboard/performanceMetrics", {}, [""]);
73
73
  Object.assign(performanceMetrics, res.data);
74
74
  } catch (_error) {
75
75
  // 静默失败:不阻断页面展示
@@ -45,7 +45,7 @@ const services = reactive([]);
45
45
  // 获取数据
46
46
  const fetchData = async () => {
47
47
  try {
48
- const res = await $Http.json("/core/dashboard/serviceStatus", {}, [""]);
48
+ const res = await $Http("/core/dashboard/serviceStatus", {}, [""]);
49
49
  services.splice(0, services.length, ...res.data.services);
50
50
  } catch (_error) {
51
51
  // 静默失败:不阻断页面展示
@@ -49,7 +49,7 @@ const permissionStats = reactive({
49
49
  // 获取数据
50
50
  const fetchData = async () => {
51
51
  try {
52
- const res = await $Http.json("/core/dashboard/systemOverview", {}, [""]);
52
+ const res = await $Http("/core/dashboard/systemOverview", {}, [""]);
53
53
  Object.assign(permissionStats, res.data);
54
54
  } catch (_error) {
55
55
  // 静默失败:不阻断页面展示
@@ -54,7 +54,7 @@ const systemResources = reactive({
54
54
  // 获取数据
55
55
  const fetchData = async () => {
56
56
  try {
57
- const res = await $Http.json("/core/dashboard/systemResources", {}, [""]);
57
+ const res = await $Http("/core/dashboard/systemResources", {}, [""]);
58
58
  Object.assign(systemResources, res.data);
59
59
  } catch (_error) {
60
60
  // 静默失败:不阻断页面展示
@@ -52,7 +52,7 @@ const $Data = reactive({
52
52
 
53
53
  async function fetchData() {
54
54
  try {
55
- const res = await $Http.json("/core/admin/detail", {}, [""]);
55
+ const res = await $Http("/core/admin/detail", {}, [""]);
56
56
  Object.assign($Data.userInfo, res.data);
57
57
  } catch (error) {
58
58
  MessagePlugin.error(error.msg || error.message || "获取用户信息失败");
@@ -62,7 +62,7 @@ async function fetchData() {
62
62
  async function handleRefreshCache() {
63
63
  try {
64
64
  $Data.refreshing = true;
65
- const result = await $Http.json("/core/admin/cacheRefresh");
65
+ const result = await $Http("/core/admin/cacheRefresh");
66
66
 
67
67
  const apis = result.data.apis;
68
68
  const menus = result.data.menus;
@@ -145,7 +145,7 @@ async function onSend(reload, context) {
145
145
 
146
146
  $Data.sending = true;
147
147
  try {
148
- const res = await $Http.json("/core/email/send", {
148
+ const res = await $Http("/core/email/send", {
149
149
  to: $Data.sendForm.to,
150
150
  subject: $Data.sendForm.subject,
151
151
  content: $Data.sendForm.content,
@@ -171,7 +171,7 @@ async function onSend(reload, context) {
171
171
 
172
172
  async function onVerify() {
173
173
  try {
174
- await $Http.json("/core/email/verify");
174
+ await $Http("/core/email/verify");
175
175
  MessagePlugin.success("邮件服务配置正常");
176
176
  } catch (error) {
177
177
  MessagePlugin.error(error.msg || error.message || "验证失败");
@@ -8,8 +8,8 @@
8
8
  <div class="circle circle-3"></div>
9
9
  </div>
10
10
  <div class="welcome-content">
11
- <h1 class="brand-title">Befly</h1>
12
- <p class="brand-subtitle">轻量级业务快速开发框架</p>
11
+ <h1 class="brand-title">{{ $Config.appTitle }}</h1>
12
+ <p class="brand-subtitle">{{ $Config.appDesc }}</p>
13
13
  </div>
14
14
  </div>
15
15
 
@@ -18,7 +18,6 @@
18
18
  <div class="login-box">
19
19
  <div class="login-header">
20
20
  <h2 class="login-title">欢迎回来</h2>
21
- <p class="login-subtitle">请登录您的账户</p>
22
21
  </div>
23
22
 
24
23
  <TForm :model="$Data.formData" :rules="$Data.formRules" ref="formRef" class="login-form" :show-message="false" label-width="0">
@@ -56,7 +55,7 @@
56
55
  </TForm>
57
56
 
58
57
  <div class="login-footer">
59
- <p class="copyright" 2024 Befly. All rights reserved.</p>
58
+ <p class="copyright">{{ $Config.loginFootnote }}</p>
60
59
  </div>
61
60
  </div>
62
61
  </div>
@@ -68,8 +67,9 @@ import { reactive, ref } from "vue";
68
67
  import { useRouter } from "vue-router";
69
68
  import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, InputAdornment as TInputAdornment, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
70
69
  import { LockOnIcon, UserIcon } from "tdesign-icons-vue-next";
71
- import { $Http } from "@/plugins/http";
72
70
  import { hashPassword } from "befly-admin-ui/utils/hashPassword";
71
+ import { $Http } from "@/plugins/http.js";
72
+ import { $Config } from "@/plugins/config.js";
73
73
 
74
74
  const router = useRouter();
75
75
 
@@ -103,21 +103,17 @@ async function apiLogin() {
103
103
 
104
104
  const hashedPassword = await hashPassword($Data.formData.password);
105
105
 
106
- const res = await $Http.json("/core/auth/login", {
106
+ const res = await $Http("/core/auth/login", {
107
107
  loginType: $Data.formData.loginType,
108
108
  account: $Data.formData.account,
109
109
  password: hashedPassword
110
110
  });
111
111
 
112
- localStorage.setItem("yicode-token", res.data.token);
113
-
114
- if (res.data.userInfo) {
115
- localStorage.setItem("yicode-userInfo", JSON.stringify(res.data.userInfo));
116
- }
112
+ localStorage.setItem($Config.tokenName, res.data.token);
117
113
 
118
114
  MessagePlugin.success(res.msg || "登录成功");
119
115
 
120
- await router.push(import.meta.env.VITE_HOME_PATH);
116
+ await router.push($Config.homePath);
121
117
  } catch (error) {
122
118
  MessagePlugin.error(error.msg || error.message || "登录失败");
123
119
  } finally {
@@ -108,7 +108,7 @@ async function initData() {
108
108
 
109
109
  async function apiRoleLists() {
110
110
  try {
111
- const result = await $Http.json("/core/role/all", {}, [""]);
111
+ const result = await $Http("/core/role/all", {}, [""]);
112
112
  $Data.allRoleLists = result.data || [];
113
113
  } catch (error) {
114
114
  MessagePlugin.error(error.msg || error.message || "加载角色列表失败");
@@ -134,7 +134,7 @@ async function onSubmit(context) {
134
134
  formData["password"] = await hashPassword(password);
135
135
  }
136
136
 
137
- const result = await $Http.json($Prop.actionType === "upd" ? "/core/admin/upd" : "/core/admin/ins", formData);
137
+ const result = await $Http($Prop.actionType === "upd" ? "/core/admin/upd" : "/core/admin/ins", formData);
138
138
 
139
139
  MessagePlugin.success(result.msg);
140
140
  $Emit("success");
@@ -90,7 +90,7 @@ async function initData() {
90
90
  async function loadApiAll() {
91
91
  $Data.loading = true;
92
92
  try {
93
- const res = await $Http.json("/core/api/all", {}, [""]);
93
+ const res = await $Http("/core/api/all", {}, [""]);
94
94
  const list = res.data?.lists || [];
95
95
  $Data.allData = list;
96
96
  $Data.tableData = list;
@@ -60,7 +60,7 @@ async function initData() {
60
60
  async function apiMenuList() {
61
61
  $Data.loading = true;
62
62
  try {
63
- const res = await $Http.json("/core/menu/all", {}, [""]);
63
+ const res = await $Http("/core/menu/all", {}, [""]);
64
64
  const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
65
65
 
66
66
  const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
@@ -99,7 +99,7 @@ async function initData() {
99
99
 
100
100
  async function apiApiAll() {
101
101
  try {
102
- const res = await $Http.json("/core/api/all", {}, [""]);
102
+ const res = await $Http("/core/api/all", {}, [""]);
103
103
 
104
104
  const apiMap = new Map();
105
105
 
@@ -160,7 +160,7 @@ async function apiRoleApiDetail() {
160
160
  if (!$Prop.rowData.id) return;
161
161
 
162
162
  try {
163
- const res = await $Http.json(
163
+ const res = await $Http(
164
164
  "/core/role/apis",
165
165
  {
166
166
  roleCode: $Prop.rowData.code
@@ -207,7 +207,7 @@ async function onSubmit(context) {
207
207
  try {
208
208
  $Data.submitting = true;
209
209
 
210
- const res = await $Http.json("/core/role/apiSave", {
210
+ const res = await $Http("/core/role/apiSave", {
211
211
  roleCode: $Prop.rowData.code,
212
212
  apiPaths: $Data.checkedApiPaths
213
213
  });
@@ -113,7 +113,7 @@ async function onSubmit(context) {
113
113
 
114
114
  $Data.submitting = true;
115
115
  const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
116
- const res = await $Http.json($Prop.actionType === "upd" ? "/core/role/upd" : "/core/role/ins", formData);
116
+ const res = await $Http($Prop.actionType === "upd" ? "/core/role/upd" : "/core/role/ins", formData);
117
117
 
118
118
  MessagePlugin.success(res.msg);
119
119
  $Emit("success");
@@ -76,7 +76,7 @@ async function initData() {
76
76
 
77
77
  async function apiMenuAll() {
78
78
  try {
79
- const res = await $Http.json("/core/menu/all", {}, [""]);
79
+ const res = await $Http("/core/menu/all", {}, [""]);
80
80
  const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
81
81
 
82
82
  const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
@@ -130,7 +130,7 @@ async function apiRoleMenuDetail() {
130
130
  if (!$Prop.rowData.id) return;
131
131
 
132
132
  try {
133
- const res = await $Http.json(
133
+ const res = await $Http(
134
134
  "/core/role/menus",
135
135
  {
136
136
  roleCode: $Prop.rowData.code
@@ -175,7 +175,7 @@ async function onSubmit(context) {
175
175
  try {
176
176
  $Data.submitting = true;
177
177
 
178
- const res = await $Http.json("/core/role/menuSave", {
178
+ const res = await $Http("/core/role/menuSave", {
179
179
  roleCode: $Prop.rowData.code,
180
180
  menuPaths: $Data.checkedMenuPaths
181
181
  });