@befly-addon/admin 1.1.30 → 1.1.32

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.
Files changed (111) hide show
  1. package/apis/admin/cacheRefresh.ts +29 -21
  2. package/apis/admin/del.ts +10 -10
  3. package/apis/admin/detail.ts +7 -7
  4. package/apis/admin/ins.ts +11 -11
  5. package/apis/admin/list.ts +10 -10
  6. package/apis/admin/upd.ts +14 -14
  7. package/apis/api/all.ts +8 -8
  8. package/apis/api/list.ts +10 -10
  9. package/apis/auth/login.ts +43 -43
  10. package/apis/auth/sendSmsCode.ts +6 -6
  11. package/apis/dashboard/configStatus.ts +18 -18
  12. package/apis/dashboard/environmentInfo.ts +12 -12
  13. package/apis/dashboard/performanceMetrics.ts +5 -5
  14. package/apis/dashboard/permissionStats.ts +7 -7
  15. package/apis/dashboard/serviceStatus.ts +29 -29
  16. package/apis/dashboard/systemInfo.ts +5 -5
  17. package/apis/dashboard/systemOverview.ts +7 -7
  18. package/apis/dashboard/systemResources.ts +8 -8
  19. package/apis/dict/all.ts +16 -16
  20. package/apis/dict/del.ts +6 -6
  21. package/apis/dict/detail.ts +19 -19
  22. package/apis/dict/ins.ts +9 -9
  23. package/apis/dict/items.ts +8 -8
  24. package/apis/dict/list.ts +22 -22
  25. package/apis/dict/upd.ts +11 -11
  26. package/apis/dictType/all.ts +5 -5
  27. package/apis/dictType/del.ts +8 -8
  28. package/apis/dictType/detail.ts +6 -6
  29. package/apis/dictType/ins.ts +7 -7
  30. package/apis/dictType/list.ts +8 -10
  31. package/apis/dictType/upd.ts +8 -8
  32. package/apis/email/config.ts +4 -4
  33. package/apis/email/logList.ts +8 -8
  34. package/apis/email/send.ts +18 -18
  35. package/apis/email/verify.ts +5 -5
  36. package/apis/loginLog/list.ts +8 -8
  37. package/apis/menu/all.ts +16 -18
  38. package/apis/menu/list.ts +12 -12
  39. package/apis/operateLog/list.ts +8 -8
  40. package/apis/role/all.ts +7 -7
  41. package/apis/role/apiSave.ts +10 -13
  42. package/apis/role/apis.ts +7 -12
  43. package/apis/role/del.ts +14 -14
  44. package/apis/role/detail.ts +6 -6
  45. package/apis/role/ins.ts +10 -10
  46. package/apis/role/list.ts +11 -11
  47. package/apis/role/menuSave.ts +8 -11
  48. package/apis/role/menus.ts +7 -12
  49. package/apis/role/save.ts +12 -12
  50. package/apis/role/upd.ts +10 -10
  51. package/apis/sysConfig/all.ts +5 -5
  52. package/apis/sysConfig/del.ts +9 -9
  53. package/apis/sysConfig/get.ts +9 -9
  54. package/apis/sysConfig/ins.ts +11 -11
  55. package/apis/sysConfig/list.ts +9 -9
  56. package/apis/sysConfig/upd.ts +10 -10
  57. package/libs/emailHelper.ts +7 -7
  58. package/package.json +46 -34
  59. package/plugins/email.ts +9 -9
  60. package/tables/role.json +4 -2
  61. package/views/403_1/index.vue +19 -3
  62. package/views/config/dict/components/edit.vue +26 -28
  63. package/views/config/dict/index.vue +88 -52
  64. package/views/config/dictType/components/edit.vue +22 -23
  65. package/views/config/dictType/index.vue +82 -46
  66. package/views/config/index.vue +12 -0
  67. package/views/config/system/components/edit.vue +36 -36
  68. package/views/config/system/index.vue +79 -50
  69. package/views/index/components/addonList.vue +3 -3
  70. package/views/index/components/environmentInfo.vue +10 -10
  71. package/views/index/components/operationLogs.vue +10 -10
  72. package/views/index/components/performanceMetrics.vue +8 -8
  73. package/views/index/components/quickActions.vue +3 -3
  74. package/views/index/components/serviceStatus.vue +19 -19
  75. package/views/index/components/systemNotifications.vue +12 -12
  76. package/views/index/components/systemOverview.vue +7 -7
  77. package/views/index/components/systemResources.vue +11 -11
  78. package/views/index/components/userInfo.vue +20 -19
  79. package/views/index/index.vue +12 -5
  80. package/views/log/email/index.vue +58 -51
  81. package/views/log/index.vue +12 -0
  82. package/views/log/login/index.vue +45 -38
  83. package/views/log/operate/index.vue +55 -48
  84. package/views/login_1/index.vue +25 -18
  85. package/views/people/admin/components/edit.vue +25 -26
  86. package/views/people/admin/index.vue +76 -40
  87. package/views/people/index.vue +12 -0
  88. package/views/permission/api/index.vue +21 -15
  89. package/views/permission/index.vue +12 -0
  90. package/views/permission/menu/index.vue +31 -16
  91. package/views/permission/role/components/api.vue +21 -21
  92. package/views/permission/role/components/edit.vue +18 -18
  93. package/views/permission/role/components/menu.vue +14 -16
  94. package/views/permission/role/index.vue +84 -49
  95. package/views/403_1/meta.json +0 -4
  96. package/views/config/dict/meta.json +0 -4
  97. package/views/config/dictType/meta.json +0 -4
  98. package/views/config/meta.json +0 -4
  99. package/views/config/system/meta.json +0 -4
  100. package/views/index/meta.json +0 -4
  101. package/views/log/email/meta.json +0 -4
  102. package/views/log/login/meta.json +0 -4
  103. package/views/log/meta.json +0 -4
  104. package/views/log/operate/meta.json +0 -4
  105. package/views/login_1/meta.json +0 -4
  106. package/views/people/admin/meta.json +0 -4
  107. package/views/people/meta.json +0 -4
  108. package/views/permission/api/meta.json +0 -4
  109. package/views/permission/menu/meta.json +0 -4
  110. package/views/permission/meta.json +0 -4
  111. package/views/permission/role/meta.json +0 -4
@@ -84,13 +84,20 @@
84
84
  </template>
85
85
 
86
86
  <script setup>
87
- import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, Space as TSpace, MessagePlugin } from 'tdesign-vue-next';
88
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
89
- import ILucideSend from '~icons/lucide/send';
90
- import ILucideCheckCircle from '~icons/lucide/check-circle';
91
- import DetailPanel from '@/components/DetailPanel.vue';
92
- import { $Http } from '@/plugins/http';
93
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
87
+ import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, Space as TSpace, MessagePlugin } from "tdesign-vue-next";
88
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
89
+ import ILucideSend from "~icons/lucide/send";
90
+ import ILucideCheckCircle from "~icons/lucide/check-circle";
91
+ import DetailPanel from "@/components/DetailPanel.vue";
92
+ import { $Http } from "@/plugins/http";
93
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
94
+
95
+ definePage({
96
+ meta: {
97
+ title: "邮件日志",
98
+ order: 2
99
+ }
100
+ });
94
101
 
95
102
  const sendFormRef = $ref(null);
96
103
 
@@ -99,25 +106,25 @@ const $Data = $ref({
99
106
  tableData: [],
100
107
  loading: false,
101
108
  columns: withDefaultColumns([
102
- { colKey: 'username', title: '发送人', fixed: 'left' },
103
- { colKey: 'id', title: '序号' },
104
- { colKey: 'toEmail', title: '收件人' },
105
- { colKey: 'subject', title: '主题' },
106
- { colKey: 'sendTime', title: '发送时间' },
107
- { colKey: 'sendResult', title: '发送结果' }
109
+ { colKey: "username", title: "发送人", fixed: "left" },
110
+ { colKey: "id", title: "序号" },
111
+ { colKey: "toEmail", title: "收件人" },
112
+ { colKey: "subject", title: "主题" },
113
+ { colKey: "sendTime", title: "发送时间" },
114
+ { colKey: "sendResult", title: "发送结果" }
108
115
  ]),
109
116
  detailFields: [
110
- { colKey: 'username', title: '发送人账号' },
111
- { colKey: 'nickname', title: '发送人昵称' },
112
- { colKey: 'toEmail', title: '收件人' },
113
- { colKey: 'ccEmail', title: '抄送' },
114
- { colKey: 'bccEmail', title: '密送' },
115
- { colKey: 'subject', title: '主题' },
116
- { colKey: 'content', title: '内容' },
117
- { colKey: 'sendTime', title: '发送时间' },
118
- { colKey: 'sendResult', title: '发送结果' },
119
- { colKey: 'messageId', title: '消息ID' },
120
- { colKey: 'failReason', title: '失败原因' }
117
+ { colKey: "username", title: "发送人账号" },
118
+ { colKey: "nickname", title: "发送人昵称" },
119
+ { colKey: "toEmail", title: "收件人" },
120
+ { colKey: "ccEmail", title: "抄送" },
121
+ { colKey: "bccEmail", title: "密送" },
122
+ { colKey: "subject", title: "主题" },
123
+ { colKey: "content", title: "内容" },
124
+ { colKey: "sendTime", title: "发送时间" },
125
+ { colKey: "sendResult", title: "发送结果" },
126
+ { colKey: "messageId", title: "消息ID" },
127
+ { colKey: "failReason", title: "失败原因" }
121
128
  ],
122
129
  pagerConfig: {
123
130
  currentPage: 1,
@@ -129,15 +136,15 @@ const $Data = $ref({
129
136
  sendDialogVisible: false,
130
137
  sending: false,
131
138
  sendForm: {
132
- to: '',
133
- cc: '',
134
- subject: '',
135
- content: ''
139
+ to: "",
140
+ cc: "",
141
+ subject: "",
142
+ content: ""
136
143
  },
137
144
  sendRules: {
138
- to: [{ required: true, message: '请输入收件人邮箱', trigger: 'blur' }],
139
- subject: [{ required: true, message: '请输入邮件主题', trigger: 'blur' }],
140
- content: [{ required: true, message: '请输入邮件内容', trigger: 'blur' }]
145
+ to: [{ required: true, message: "请输入收件人邮箱", trigger: "blur" }],
146
+ subject: [{ required: true, message: "请输入邮件主题", trigger: "blur" }],
147
+ content: [{ required: true, message: "请输入邮件内容", trigger: "blur" }]
141
148
  }
142
149
  });
143
150
 
@@ -151,7 +158,7 @@ const $Method = {
151
158
  async apiEmailLogList() {
152
159
  $Data.loading = true;
153
160
  try {
154
- const res = await $Http('/addon/admin/email/logList', {
161
+ const res = await $Http("/addon/admin/email/logList", {
155
162
  page: $Data.pagerConfig.currentPage,
156
163
  limit: $Data.pagerConfig.limit
157
164
  });
@@ -166,7 +173,7 @@ const $Method = {
166
173
  $Data.activeRowKeys = [];
167
174
  }
168
175
  } catch (error) {
169
- MessagePlugin.error('加载数据失败');
176
+ MessagePlugin.error("加载数据失败");
170
177
  } finally {
171
178
  $Data.loading = false;
172
179
  }
@@ -175,10 +182,10 @@ const $Method = {
175
182
  // 打开发送弹框
176
183
  openSendDialog() {
177
184
  $Data.sendForm = {
178
- to: '',
179
- cc: '',
180
- subject: '',
181
- content: ''
185
+ to: "",
186
+ cc: "",
187
+ subject: "",
188
+ content: ""
182
189
  };
183
190
  $Data.sendDialogVisible = true;
184
191
  },
@@ -190,7 +197,7 @@ const $Method = {
190
197
 
191
198
  $Data.sending = true;
192
199
  try {
193
- const res = await $Http('/addon/admin/email/send', {
200
+ const res = await $Http("/addon/admin/email/send", {
194
201
  to: $Data.sendForm.to,
195
202
  subject: $Data.sendForm.subject,
196
203
  content: $Data.sendForm.content,
@@ -199,14 +206,14 @@ const $Method = {
199
206
  });
200
207
 
201
208
  if (res.code === 0) {
202
- MessagePlugin.success('发送成功');
209
+ MessagePlugin.success("发送成功");
203
210
  $Data.sendDialogVisible = false;
204
211
  $Method.apiEmailLogList();
205
212
  } else {
206
- MessagePlugin.error(res.msg || '发送失败');
213
+ MessagePlugin.error(res.msg || "发送失败");
207
214
  }
208
215
  } catch (error) {
209
- MessagePlugin.error('发送失败');
216
+ MessagePlugin.error("发送失败");
210
217
  } finally {
211
218
  $Data.sending = false;
212
219
  }
@@ -215,14 +222,14 @@ const $Method = {
215
222
  // 验证配置
216
223
  async onVerify() {
217
224
  try {
218
- const res = await $Http('/addon/admin/email/verify');
225
+ const res = await $Http("/addon/admin/email/verify");
219
226
  if (res.code === 0) {
220
- MessagePlugin.success('邮件服务配置正常');
227
+ MessagePlugin.success("邮件服务配置正常");
221
228
  } else {
222
- MessagePlugin.error(res.msg || '配置异常');
229
+ MessagePlugin.error(res.msg || "配置异常");
223
230
  }
224
231
  } catch (error) {
225
- MessagePlugin.error('验证失败');
232
+ MessagePlugin.error("验证失败");
226
233
  }
227
234
  },
228
235
 
@@ -257,14 +264,14 @@ const $Method = {
257
264
 
258
265
  // 格式化时间
259
266
  formatTime(timestamp) {
260
- if (!timestamp) return '-';
267
+ if (!timestamp) return "-";
261
268
  const date = new Date(timestamp);
262
269
  const year = date.getFullYear();
263
- const month = String(date.getMonth() + 1).padStart(2, '0');
264
- const day = String(date.getDate()).padStart(2, '0');
265
- const hours = String(date.getHours()).padStart(2, '0');
266
- const minutes = String(date.getMinutes()).padStart(2, '0');
267
- const seconds = String(date.getSeconds()).padStart(2, '0');
270
+ const month = String(date.getMonth() + 1).padStart(2, "0");
271
+ const day = String(date.getDate()).padStart(2, "0");
272
+ const hours = String(date.getHours()).padStart(2, "0");
273
+ const minutes = String(date.getMinutes()).padStart(2, "0");
274
+ const seconds = String(date.getSeconds()).padStart(2, "0");
268
275
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
269
276
  }
270
277
  };
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <RouterView />
3
+ </template>
4
+
5
+ <script setup>
6
+ definePage({
7
+ meta: {
8
+ title: "日志管理",
9
+ order: 40
10
+ }
11
+ });
12
+ </script>
@@ -22,7 +22,7 @@
22
22
  {{ $Method.formatTime(row.loginTime) }}
23
23
  </template>
24
24
  <template #deviceType="{ row }">
25
- <TTag shape="round" variant="light-outline">{{ row.deviceType || 'desktop' }}</TTag>
25
+ <TTag shape="round" variant="light-outline">{{ row.deviceType || "desktop" }}</TTag>
26
26
  </template>
27
27
  </TTable>
28
28
  </div>
@@ -37,7 +37,7 @@
37
37
  {{ $Method.formatTime(value) }}
38
38
  </template>
39
39
  <template #deviceType="{ value }">
40
- <TTag shape="round" variant="light-outline">{{ value || 'desktop' }}</TTag>
40
+ <TTag shape="round" variant="light-outline">{{ value || "desktop" }}</TTag>
41
41
  </template>
42
42
  </DetailPanel>
43
43
  </div>
@@ -50,43 +50,50 @@
50
50
  </template>
51
51
 
52
52
  <script setup>
53
- import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, MessagePlugin } from 'tdesign-vue-next';
54
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
55
- import DetailPanel from '@/components/DetailPanel.vue';
56
- import { $Http } from '@/plugins/http';
57
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
53
+ import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, MessagePlugin } from "tdesign-vue-next";
54
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
55
+ import DetailPanel from "@/components/DetailPanel.vue";
56
+ import { $Http } from "@/plugins/http";
57
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
58
+
59
+ definePage({
60
+ meta: {
61
+ title: "登录日志",
62
+ order: 1
63
+ }
64
+ });
58
65
 
59
66
  // 响应式数据
60
67
  const $Data = $ref({
61
68
  tableData: [],
62
69
  loading: false,
63
70
  columns: withDefaultColumns([
64
- { colKey: 'username', title: '用户名', fixed: 'left' },
65
- { colKey: 'id', title: '序号' },
66
- { colKey: 'ip', title: '登录IP' },
67
- { colKey: 'browserName', title: '浏览器' },
68
- { colKey: 'osName', title: '操作系统' },
69
- { colKey: 'deviceType', title: '设备类型' },
70
- { colKey: 'loginTime', title: '登录时间' },
71
- { colKey: 'loginResult', title: '登录结果' }
71
+ { colKey: "username", title: "用户名", fixed: "left" },
72
+ { colKey: "id", title: "序号" },
73
+ { colKey: "ip", title: "登录IP" },
74
+ { colKey: "browserName", title: "浏览器" },
75
+ { colKey: "osName", title: "操作系统" },
76
+ { colKey: "deviceType", title: "设备类型" },
77
+ { colKey: "loginTime", title: "登录时间" },
78
+ { colKey: "loginResult", title: "登录结果" }
72
79
  ]),
73
80
  // 详情面板显示更多字段
74
81
  detailFields: [
75
- { colKey: 'username', title: '用户名' },
76
- { colKey: 'nickname', title: '昵称' },
77
- { colKey: 'ip', title: '登录IP' },
78
- { colKey: 'browserName', title: '浏览器' },
79
- { colKey: 'browserVersion', title: '浏览器版本' },
80
- { colKey: 'osName', title: '操作系统' },
81
- { colKey: 'osVersion', title: '系统版本' },
82
- { colKey: 'deviceType', title: '设备类型' },
83
- { colKey: 'deviceVendor', title: '设备厂商' },
84
- { colKey: 'deviceModel', title: '设备型号' },
85
- { colKey: 'engineName', title: '渲染引擎' },
86
- { colKey: 'cpuArchitecture', title: 'CPU架构' },
87
- { colKey: 'loginTime', title: '登录时间' },
88
- { colKey: 'loginResult', title: '登录结果' },
89
- { colKey: 'failReason', title: '失败原因' }
82
+ { colKey: "username", title: "用户名" },
83
+ { colKey: "nickname", title: "昵称" },
84
+ { colKey: "ip", title: "登录IP" },
85
+ { colKey: "browserName", title: "浏览器" },
86
+ { colKey: "browserVersion", title: "浏览器版本" },
87
+ { colKey: "osName", title: "操作系统" },
88
+ { colKey: "osVersion", title: "系统版本" },
89
+ { colKey: "deviceType", title: "设备类型" },
90
+ { colKey: "deviceVendor", title: "设备厂商" },
91
+ { colKey: "deviceModel", title: "设备型号" },
92
+ { colKey: "engineName", title: "渲染引擎" },
93
+ { colKey: "cpuArchitecture", title: "CPU架构" },
94
+ { colKey: "loginTime", title: "登录时间" },
95
+ { colKey: "loginResult", title: "登录结果" },
96
+ { colKey: "failReason", title: "失败原因" }
90
97
  ],
91
98
  pagerConfig: {
92
99
  currentPage: 1,
@@ -107,7 +114,7 @@ const $Method = {
107
114
  async apiLoginLogList() {
108
115
  $Data.loading = true;
109
116
  try {
110
- const res = await $Http('/addon/admin/loginLog/list', {
117
+ const res = await $Http("/addon/admin/loginLog/list", {
111
118
  page: $Data.pagerConfig.currentPage,
112
119
  limit: $Data.pagerConfig.limit
113
120
  });
@@ -123,7 +130,7 @@ const $Method = {
123
130
  $Data.activeRowKeys = [];
124
131
  }
125
132
  } catch (error) {
126
- MessagePlugin.error('加载数据失败');
133
+ MessagePlugin.error("加载数据失败");
127
134
  } finally {
128
135
  $Data.loading = false;
129
136
  }
@@ -160,14 +167,14 @@ const $Method = {
160
167
 
161
168
  // 格式化时间
162
169
  formatTime(timestamp) {
163
- if (!timestamp) return '-';
170
+ if (!timestamp) return "-";
164
171
  const date = new Date(timestamp);
165
172
  const year = date.getFullYear();
166
- const month = String(date.getMonth() + 1).padStart(2, '0');
167
- const day = String(date.getDate()).padStart(2, '0');
168
- const hours = String(date.getHours()).padStart(2, '0');
169
- const minutes = String(date.getMinutes()).padStart(2, '0');
170
- const seconds = String(date.getSeconds()).padStart(2, '0');
173
+ const month = String(date.getMonth() + 1).padStart(2, "0");
174
+ const day = String(date.getDate()).padStart(2, "0");
175
+ const hours = String(date.getHours()).padStart(2, "0");
176
+ const minutes = String(date.getMinutes()).padStart(2, "0");
177
+ const seconds = String(date.getSeconds()).padStart(2, "0");
171
178
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
172
179
  }
173
180
  };
@@ -70,41 +70,48 @@
70
70
  </template>
71
71
 
72
72
  <script setup>
73
- import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Select as TSelect, Option as TOption, MessagePlugin } from 'tdesign-vue-next';
74
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
75
- import DetailPanel from '@/components/DetailPanel.vue';
76
- import { $Http } from '@/plugins/http';
77
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
73
+ import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
74
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
75
+ import DetailPanel from "@/components/DetailPanel.vue";
76
+ import { $Http } from "@/plugins/http";
77
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
78
+
79
+ definePage({
80
+ meta: {
81
+ title: "操作日志",
82
+ order: 3
83
+ }
84
+ });
78
85
 
79
86
  // 响应式数据
80
87
  const $Data = $ref({
81
88
  tableData: [],
82
89
  loading: false,
83
90
  columns: withDefaultColumns([
84
- { colKey: 'username', title: '操作人', fixed: 'left', width: 100 },
85
- { colKey: 'id', title: '序号', width: 80 },
86
- { colKey: 'module', title: '模块', width: 100 },
87
- { colKey: 'action', title: '操作', width: 80 },
88
- { colKey: 'path', title: '请求路径', ellipsis: true },
89
- { colKey: 'ip', title: 'IP地址', width: 130 },
90
- { colKey: 'duration', title: '耗时', width: 100 },
91
- { colKey: 'operateTime', title: '操作时间', width: 170 },
92
- { colKey: 'result', title: '结果', width: 80 }
91
+ { colKey: "username", title: "操作人", fixed: "left", width: 100 },
92
+ { colKey: "id", title: "序号", width: 80 },
93
+ { colKey: "module", title: "模块", width: 100 },
94
+ { colKey: "action", title: "操作", width: 80 },
95
+ { colKey: "path", title: "请求路径", ellipsis: true },
96
+ { colKey: "ip", title: "IP地址", width: 130 },
97
+ { colKey: "duration", title: "耗时", width: 100 },
98
+ { colKey: "operateTime", title: "操作时间", width: 170 },
99
+ { colKey: "result", title: "结果", width: 80 }
93
100
  ]),
94
101
  detailFields: [
95
- { colKey: 'username', title: '操作人账号' },
96
- { colKey: 'nickname', title: '操作人昵称' },
97
- { colKey: 'module', title: '操作模块' },
98
- { colKey: 'action', title: '操作类型' },
99
- { colKey: 'method', title: '请求方法' },
100
- { colKey: 'path', title: '请求路径' },
101
- { colKey: 'ip', title: 'IP地址' },
102
- { colKey: 'params', title: '请求参数' },
103
- { colKey: 'response', title: '响应内容' },
104
- { colKey: 'duration', title: '耗时' },
105
- { colKey: 'operateTime', title: '操作时间' },
106
- { colKey: 'result', title: '操作结果' },
107
- { colKey: 'remark', title: '备注' }
102
+ { colKey: "username", title: "操作人账号" },
103
+ { colKey: "nickname", title: "操作人昵称" },
104
+ { colKey: "module", title: "操作模块" },
105
+ { colKey: "action", title: "操作类型" },
106
+ { colKey: "method", title: "请求方法" },
107
+ { colKey: "path", title: "请求路径" },
108
+ { colKey: "ip", title: "IP地址" },
109
+ { colKey: "params", title: "请求参数" },
110
+ { colKey: "response", title: "响应内容" },
111
+ { colKey: "duration", title: "耗时" },
112
+ { colKey: "operateTime", title: "操作时间" },
113
+ { colKey: "result", title: "操作结果" },
114
+ { colKey: "remark", title: "备注" }
108
115
  ],
109
116
  pagerConfig: {
110
117
  currentPage: 1,
@@ -114,22 +121,22 @@ const $Data = $ref({
114
121
  currentRow: null,
115
122
  activeRowKeys: [],
116
123
  filter: {
117
- module: '',
118
- action: '',
124
+ module: "",
125
+ action: "",
119
126
  result: null
120
127
  },
121
128
  moduleOptions: [
122
- { label: '管理员', value: '管理员' },
123
- { label: '角色', value: '角色' },
124
- { label: '菜单', value: '菜单' },
125
- { label: '接口', value: '接口' },
126
- { label: '字典', value: '字典' }
129
+ { label: "管理员", value: "管理员" },
130
+ { label: "角色", value: "角色" },
131
+ { label: "菜单", value: "菜单" },
132
+ { label: "接口", value: "接口" },
133
+ { label: "字典", value: "字典" }
127
134
  ],
128
135
  actionOptions: [
129
- { label: '新增', value: '新增' },
130
- { label: '编辑', value: '编辑' },
131
- { label: '删除', value: '删除' },
132
- { label: '查询', value: '查询' }
136
+ { label: "新增", value: "新增" },
137
+ { label: "编辑", value: "编辑" },
138
+ { label: "删除", value: "删除" },
139
+ { label: "查询", value: "查询" }
133
140
  ]
134
141
  });
135
142
 
@@ -143,7 +150,7 @@ const $Method = {
143
150
  async apiOperateLogList() {
144
151
  $Data.loading = true;
145
152
  try {
146
- const res = await $Http('/addon/admin/operateLog/list', {
153
+ const res = await $Http("/addon/admin/operateLog/list", {
147
154
  page: $Data.pagerConfig.currentPage,
148
155
  limit: $Data.pagerConfig.limit
149
156
  });
@@ -158,7 +165,7 @@ const $Method = {
158
165
  $Data.activeRowKeys = [];
159
166
  }
160
167
  } catch (error) {
161
- MessagePlugin.error('加载数据失败');
168
+ MessagePlugin.error("加载数据失败");
162
169
  } finally {
163
170
  $Data.loading = false;
164
171
  }
@@ -201,22 +208,22 @@ const $Method = {
201
208
 
202
209
  // 格式化时间
203
210
  formatTime(timestamp) {
204
- if (!timestamp) return '-';
211
+ if (!timestamp) return "-";
205
212
  const date = new Date(timestamp);
206
213
  const year = date.getFullYear();
207
- const month = String(date.getMonth() + 1).padStart(2, '0');
208
- const day = String(date.getDate()).padStart(2, '0');
209
- const hours = String(date.getHours()).padStart(2, '0');
210
- const minutes = String(date.getMinutes()).padStart(2, '0');
211
- const seconds = String(date.getSeconds()).padStart(2, '0');
214
+ const month = String(date.getMonth() + 1).padStart(2, "0");
215
+ const day = String(date.getDate()).padStart(2, "0");
216
+ const hours = String(date.getHours()).padStart(2, "0");
217
+ const minutes = String(date.getMinutes()).padStart(2, "0");
218
+ const seconds = String(date.getSeconds()).padStart(2, "0");
212
219
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
213
220
  },
214
221
 
215
222
  // 格式化 JSON
216
223
  formatJson(value) {
217
- if (!value) return '-';
224
+ if (!value) return "-";
218
225
  try {
219
- const obj = typeof value === 'string' ? JSON.parse(value) : value;
226
+ const obj = typeof value === "string" ? JSON.parse(value) : value;
220
227
  return JSON.stringify(obj, null, 2);
221
228
  } catch {
222
229
  return value;
@@ -64,13 +64,20 @@
64
64
  </template>
65
65
 
66
66
  <script setup>
67
- import { useRouter } from 'vue-router';
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';
69
- import ILucideUser from '~icons/lucide/user';
70
- import ILucideLock from '~icons/lucide/lock';
71
- import { $Http } from '@/plugins/http';
72
- import { $Storage } from '@/plugins/storage';
73
- import { hashPassword } from 'befly-shared/hashPassword';
67
+ import { useRouter } from "vue-router";
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";
69
+ import ILucideUser from "~icons/lucide/user";
70
+ import ILucideLock from "~icons/lucide/lock";
71
+ import { $Http } from "@/plugins/http";
72
+ import { $Storage } from "@/plugins/storage";
73
+ import { hashPassword } from "befly-vite/utils/hashPassword";
74
+
75
+ definePage({
76
+ meta: {
77
+ title: "登录页",
78
+ order: 100
79
+ }
80
+ });
74
81
 
75
82
  const router = useRouter();
76
83
 
@@ -84,16 +91,16 @@ const $Data = $ref({
84
91
  loading: false,
85
92
  rememberMe: false,
86
93
  formData: {
87
- loginType: 'username',
88
- account: '',
89
- password: ''
94
+ loginType: "username",
95
+ account: "",
96
+ password: ""
90
97
  }
91
98
  });
92
99
 
93
100
  const $Data2 = $shallowRef({
94
101
  formRules: {
95
- account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
96
- password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
102
+ account: [{ required: true, message: "请输入账号", trigger: "blur" }],
103
+ password: [{ required: true, message: "请输入密码", trigger: "blur" }]
97
104
  }
98
105
  });
99
106
 
@@ -108,26 +115,26 @@ const $Method = {
108
115
  // 对密码进行 SHA-256 加密
109
116
  const hashedPassword = await hashPassword($Data.formData.password);
110
117
 
111
- const res = await $Http('/addon/admin/auth/login', {
118
+ const res = await $Http("/addon/admin/auth/login", {
112
119
  loginType: $Data.formData.loginType,
113
120
  account: $Data.formData.account,
114
121
  password: hashedPassword
115
122
  });
116
123
 
117
124
  // 先保存 token
118
- $Storage.local.set('token', res.data.token);
125
+ $Storage.local.set("token", res.data.token);
119
126
 
120
127
  // 如果返回用户信息,也可以存储
121
128
  if (res.data.userInfo) {
122
- $Storage.local.set('userInfo', res.data.userInfo);
129
+ $Storage.local.set("userInfo", res.data.userInfo);
123
130
  }
124
131
 
125
- MessagePlugin.success(res.msg || '登录成功');
132
+ MessagePlugin.success(res.msg || "登录成功");
126
133
 
127
134
  // 跳转到首页,路由守卫会自动加载菜单
128
- await router.push('/');
135
+ await router.push("/");
129
136
  } catch (error) {
130
- console.log('🔥[ error ]-77', error);
137
+ MessagePlugin.error("登录失败");
131
138
  } finally {
132
139
  $Data.loading = false;
133
140
  }