@befly-addon/admin 1.2.1 → 1.2.3

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 (36) hide show
  1. package/adminViews/403_1/index.vue +75 -0
  2. package/adminViews/config/dict/components/edit.vue +109 -0
  3. package/adminViews/config/dict/index.vue +266 -0
  4. package/adminViews/config/dictType/components/edit.vue +100 -0
  5. package/adminViews/config/dictType/index.vue +244 -0
  6. package/adminViews/config/index.vue +12 -0
  7. package/adminViews/config/system/components/edit.vue +171 -0
  8. package/adminViews/config/system/index.vue +286 -0
  9. package/adminViews/index/components/addonList.vue +132 -0
  10. package/adminViews/index/components/environmentInfo.vue +100 -0
  11. package/adminViews/index/components/operationLogs.vue +112 -0
  12. package/adminViews/index/components/performanceMetrics.vue +145 -0
  13. package/adminViews/index/components/quickActions.vue +30 -0
  14. package/adminViews/index/components/serviceStatus.vue +192 -0
  15. package/adminViews/index/components/systemNotifications.vue +137 -0
  16. package/adminViews/index/components/systemOverview.vue +190 -0
  17. package/adminViews/index/components/systemResources.vue +111 -0
  18. package/adminViews/index/components/userInfo.vue +204 -0
  19. package/adminViews/index/index.vue +74 -0
  20. package/adminViews/log/email/index.vue +292 -0
  21. package/adminViews/log/index.vue +12 -0
  22. package/adminViews/log/login/index.vue +187 -0
  23. package/adminViews/log/operate/index.vue +249 -0
  24. package/adminViews/login_1/index.vue +415 -0
  25. package/adminViews/people/admin/components/edit.vue +168 -0
  26. package/adminViews/people/admin/index.vue +240 -0
  27. package/adminViews/people/index.vue +12 -0
  28. package/adminViews/permission/api/index.vue +149 -0
  29. package/adminViews/permission/index.vue +12 -0
  30. package/adminViews/permission/menu/index.vue +130 -0
  31. package/adminViews/permission/role/components/api.vue +361 -0
  32. package/adminViews/permission/role/components/edit.vue +142 -0
  33. package/adminViews/permission/role/components/menu.vue +118 -0
  34. package/adminViews/permission/role/index.vue +263 -0
  35. package/package.json +12 -10
  36. package/tsconfig.json +15 -0
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div class="section-block">
3
+ <div class="section-header flex items-center gap-2">
4
+ <ILucideActivity />
5
+ <h2>系统资源</h2>
6
+ </div>
7
+ <div class="section-content">
8
+ <div class="resource-compact-list">
9
+ <div class="resource-compact-item">
10
+ <div class="resource-compact-header">
11
+ <ILucideCpu />
12
+ <span class="resource-label">CPU</span>
13
+ <span class="resource-value">{{ systemResources.cpu.usage }}%</span>
14
+ <span class="resource-desc">{{ systemResources.cpu.cores }}核心</span>
15
+ </div>
16
+ <TProgress :percentage="systemResources.cpu.usage" :status="getProgressColor(systemResources.cpu.usage)" />
17
+ </div>
18
+ <div class="resource-compact-item">
19
+ <div class="resource-compact-header">
20
+ <ILucideHardDrive />
21
+ <span class="resource-label">内存</span>
22
+ <span class="resource-value">{{ systemResources.memory.percentage }}%</span>
23
+ <span class="resource-desc">{{ systemResources.memory.used }}GB / {{ systemResources.memory.total }}GB</span>
24
+ </div>
25
+ <TProgress :percentage="systemResources.memory.percentage" :status="getProgressColor(systemResources.memory.percentage)" />
26
+ </div>
27
+ <div class="resource-compact-item">
28
+ <div class="resource-compact-header">
29
+ <ILucideDisc />
30
+ <span class="resource-label">磁盘</span>
31
+ <span class="resource-value">{{ systemResources.disk.percentage }}%</span>
32
+ <span class="resource-desc">{{ systemResources.disk.used }}GB / {{ systemResources.disk.total }}GB</span>
33
+ </div>
34
+ <TProgress :percentage="systemResources.disk.percentage" :status="getProgressColor(systemResources.disk.percentage)" />
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { Progress as TProgress } from "tdesign-vue-next";
43
+ import ILucideActivity from "~icons/lucide/activity";
44
+ import ILucideCpu from "~icons/lucide/cpu";
45
+ import ILucideHardDrive from "~icons/lucide/hard-drive";
46
+ import ILucideDisc from "~icons/lucide/disc";
47
+ import { $Http } from "@/plugins/http";
48
+
49
+ // 组件内部数据
50
+ const systemResources = $ref({
51
+ cpu: { usage: 0, cores: 0 },
52
+ memory: { used: 0, total: 0, percentage: 0 },
53
+ disk: { used: 0, total: 0, percentage: 0 }
54
+ });
55
+
56
+ // 获取数据
57
+ const fetchData = async () => {
58
+ try {
59
+ const { data } = await $Http("/addon/admin/dashboard/systemResources");
60
+ Object.assign(systemResources, data);
61
+ } catch (error) {
62
+ // 静默失败:不阻断页面展示
63
+ }
64
+ };
65
+
66
+ fetchData();
67
+
68
+ // 工具函数
69
+ const getProgressColor = (percentage) => {
70
+ if (percentage < 50) return "success";
71
+ if (percentage < 80) return "warning";
72
+ return "danger";
73
+ };
74
+ </script>
75
+
76
+ <style scoped lang="scss">
77
+ .resource-compact-list {
78
+ display: grid;
79
+ grid-template-columns: repeat(3, 1fr);
80
+ gap: var(--spacing-md);
81
+
82
+ .resource-compact-item {
83
+ .resource-compact-header {
84
+ display: flex;
85
+ align-items: center;
86
+ gap: 10px;
87
+ margin-bottom: 8px;
88
+
89
+ .resource-label {
90
+ font-size: 14px;
91
+ font-weight: 600;
92
+ color: var(--text-secondary);
93
+ min-width: 50px;
94
+ }
95
+
96
+ .resource-value {
97
+ font-size: 16px;
98
+ font-weight: 700;
99
+ color: var(--primary-color);
100
+ min-width: 60px;
101
+ }
102
+
103
+ .resource-desc {
104
+ font-size: 14px;
105
+ color: var(--text-placeholder);
106
+ flex: 1;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ </style>
@@ -0,0 +1,204 @@
1
+ <template>
2
+ <div class="section-block user-info-card">
3
+ <div class="user-header">
4
+ <div class="user-avatar">
5
+ <ILucideUser />
6
+ </div>
7
+ <div class="user-basic">
8
+ <div class="user-name">
9
+ {{ $Data.userInfo.nickname || $Data.userInfo.name || $Data.userInfo.username || "未设置" }}
10
+ </div>
11
+ <div class="user-role">{{ $Data.userInfo.role?.name || "普通用户" }}</div>
12
+ </div>
13
+ </div>
14
+ <div class="user-details">
15
+ <div class="detail-item">
16
+ <ILucideMail />
17
+ <span>{{ $Data.userInfo.email || "未设置" }}</span>
18
+ </div>
19
+ <div v-if="$Data.userInfo.phone" class="detail-item">
20
+ <ILucidePhone />
21
+ <span>{{ $Data.userInfo.phone }}</span>
22
+ </div>
23
+ <div v-if="$Data.userInfo.lastLoginTime" class="detail-item">
24
+ <ILucideClock />
25
+ <span>{{ $Method.formatTime($Data.userInfo.lastLoginTime) }}</span>
26
+ </div>
27
+ </div>
28
+
29
+ <!-- 仅 dev 角色显示刷新缓存按钮 -->
30
+ <div v-if="$Data.userInfo.roleCode === 'dev'" class="user-actions">
31
+ <TButton theme="primary" size="mini" :loading="$Data.refreshing" @click="$Method.handleRefreshCache">
32
+ <template #icon>
33
+ <ILucideRotateCw />
34
+ </template>
35
+ 刷新缓存
36
+ </TButton>
37
+ </div>
38
+ </div>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { Button as TButton, MessagePlugin } from "tdesign-vue-next";
43
+ import ILucideUser from "~icons/lucide/user";
44
+ import ILucideMail from "~icons/lucide/mail";
45
+ import ILucidePhone from "~icons/lucide/phone";
46
+ import ILucideClock from "~icons/lucide/clock";
47
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
48
+ import { $Http } from "@/plugins/http";
49
+
50
+ // 响应式数据
51
+ const $Data = $ref({
52
+ userInfo: {},
53
+ refreshing: false
54
+ });
55
+
56
+ // 方法集合
57
+ const $Method = {
58
+ // 获取数据
59
+ async fetchData() {
60
+ try {
61
+ const { data } = await $Http("/addon/admin/admin/detail");
62
+ Object.assign($Data.userInfo, data);
63
+ } catch (error) {
64
+ MessagePlugin.error("获取用户信息失败");
65
+ }
66
+ },
67
+
68
+ // 刷新缓存
69
+ async handleRefreshCache() {
70
+ try {
71
+ $Data.refreshing = true;
72
+ const result = await $Http("/addon/admin/admin/cacheRefresh");
73
+
74
+ if (result.code === 0) {
75
+ const { apis, menus, roles } = result.data;
76
+ const messages = [];
77
+
78
+ if (apis.success) {
79
+ messages.push(`接口缓存: ${apis.count} 个`);
80
+ }
81
+ if (menus.success) {
82
+ messages.push(`菜单缓存: ${menus.count} 个`);
83
+ }
84
+ if (roles.success) {
85
+ messages.push(`角色缓存: ${roles.count} 个`);
86
+ }
87
+
88
+ MessagePlugin.success(`缓存刷新成功!${messages.join(",")}`);
89
+ } else {
90
+ MessagePlugin.warning(result.msg || "部分缓存刷新失败");
91
+ }
92
+ } catch (error) {
93
+ MessagePlugin.error("刷新缓存失败,请稍后重试");
94
+ } finally {
95
+ $Data.refreshing = false;
96
+ }
97
+ },
98
+
99
+ // 格式化时间
100
+ formatTime(timestamp) {
101
+ if (!timestamp) return "";
102
+ const date = new Date(Number(timestamp));
103
+ const now = new Date();
104
+ const diff = now - date;
105
+
106
+ // 小于1分钟
107
+ if (diff < 60000) {
108
+ return "刚刚";
109
+ }
110
+ // 小于1小时
111
+ if (diff < 3600000) {
112
+ return `${Math.floor(diff / 60000)}分钟前`;
113
+ }
114
+ // 小于24小时
115
+ if (diff < 86400000) {
116
+ return `${Math.floor(diff / 3600000)}小时前`;
117
+ }
118
+ // 小于7天
119
+ if (diff < 604800000) {
120
+ return `${Math.floor(diff / 86400000)}天前`;
121
+ }
122
+ // 超过7天显示具体日期
123
+ return `${date.getMonth() + 1}月${date.getDate()}日`;
124
+ }
125
+ };
126
+
127
+ // 初始化
128
+ $Method.fetchData();
129
+ </script>
130
+
131
+ <style scoped lang="scss">
132
+ .user-info-card {
133
+ background-color: #fff;
134
+ padding: 15px;
135
+ .user-header {
136
+ display: flex;
137
+ align-items: center;
138
+ gap: 12px;
139
+ padding-bottom: 12px;
140
+ border-bottom: 1px solid var(--border-color);
141
+
142
+ .user-avatar {
143
+ width: 48px;
144
+ height: 48px;
145
+ background: linear-gradient(135deg, var(--primary-color), #764ba2);
146
+ border-radius: 50%;
147
+ display: flex;
148
+ align-items: center;
149
+ justify-content: center;
150
+ color: white;
151
+ flex-shrink: 0;
152
+ }
153
+
154
+ .user-basic {
155
+ flex: 1;
156
+ min-width: 0;
157
+
158
+ .user-name {
159
+ font-size: 16px;
160
+ font-weight: 600;
161
+ color: var(--text-primary);
162
+ margin-bottom: 4px;
163
+ overflow: hidden;
164
+ text-overflow: ellipsis;
165
+ white-space: nowrap;
166
+ }
167
+
168
+ .user-role {
169
+ font-size: 12px;
170
+ color: var(--text-secondary);
171
+ }
172
+ }
173
+ }
174
+
175
+ .user-details {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 8px;
179
+ margin-top: 12px;
180
+
181
+ .detail-item {
182
+ display: flex;
183
+ align-items: center;
184
+ gap: 8px;
185
+ font-size: 12px;
186
+ color: var(--text-secondary);
187
+
188
+ span {
189
+ overflow: hidden;
190
+ text-overflow: ellipsis;
191
+ white-space: nowrap;
192
+ }
193
+ }
194
+ }
195
+
196
+ .user-actions {
197
+ margin-top: 16px;
198
+ padding-top: 12px;
199
+ border-top: 1px solid var(--border-color);
200
+ display: flex;
201
+ justify-content: center;
202
+ }
203
+ }
204
+ </style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div class="dashboard-container">
3
+ <!-- 第一行:系统概览(全宽) -->
4
+ <div class="dashboard-row full-width">
5
+ <SystemOverview />
6
+ </div>
7
+
8
+ <!-- 第二行:服务状态 + 系统资源 -->
9
+ <div class="dashboard-row two-columns">
10
+ <ServiceStatus />
11
+ <SystemResources />
12
+ </div>
13
+
14
+ <!-- 第三行:性能指标 + 环境信息 -->
15
+ <div class="dashboard-row two-columns">
16
+ <PerformanceMetrics />
17
+ <EnvironmentInfo />
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup>
23
+ import SystemOverview from "./components/systemOverview.vue";
24
+ import ServiceStatus from "./components/serviceStatus.vue";
25
+ import SystemResources from "./components/systemResources.vue";
26
+ import PerformanceMetrics from "./components/performanceMetrics.vue";
27
+ import EnvironmentInfo from "./components/environmentInfo.vue";
28
+
29
+ definePage({
30
+ meta: {
31
+ title: "首页",
32
+ order: 1
33
+ }
34
+ });
35
+ </script>
36
+
37
+ <style scoped lang="scss">
38
+ .dashboard-container {
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: var(--layout-gap);
42
+ overflow-y: auto;
43
+ height: 100%;
44
+ padding: 0;
45
+
46
+ .dashboard-row {
47
+ display: flex;
48
+ gap: var(--layout-gap);
49
+
50
+ &.full-width {
51
+ > * {
52
+ flex: 1;
53
+ }
54
+ }
55
+
56
+ &.two-columns {
57
+ > * {
58
+ flex: 1;
59
+ min-width: 0;
60
+ }
61
+ }
62
+ }
63
+
64
+ // 每个组件都是独立的卡片
65
+ :deep(.section-block) {
66
+ background: var(--bg-color-container);
67
+ border-radius: var(--card-radius);
68
+ box-shadow: var(--shadow-1);
69
+ padding: var(--spacing-md);
70
+ border: none;
71
+ height: 100%;
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,292 @@
1
+ <template>
2
+ <div class="page-email page-table">
3
+ <div class="main-tool">
4
+ <div class="left">
5
+ <TButton theme="primary" @click="$Method.openSendDialog">
6
+ <template #icon>
7
+ <ILucideSend />
8
+ </template>
9
+ 发送邮件
10
+ </TButton>
11
+ <TButton variant="outline" @click="$Method.onVerify">
12
+ <template #icon>
13
+ <ILucideCheckCircle />
14
+ </template>
15
+ 验证配置
16
+ </TButton>
17
+ </div>
18
+ <div class="right">
19
+ <TButton shape="circle" @click="$Method.handleRefresh">
20
+ <template #icon>
21
+ <ILucideRotateCw />
22
+ </template>
23
+ </TButton>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="main-content">
28
+ <div class="main-table">
29
+ <TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="100%" active-row-type="single" @active-change="$Method.onActiveChange">
30
+ <template #sendResult="{ row }">
31
+ <TTag v-if="row.sendResult === 1" shape="round" theme="success" variant="light-outline">成功</TTag>
32
+ <TTag v-else shape="round" theme="danger" variant="light-outline">失败</TTag>
33
+ </template>
34
+ <template #sendTime="{ row }">
35
+ {{ $Method.formatTime(row.sendTime) }}
36
+ </template>
37
+ </TTable>
38
+ </div>
39
+
40
+ <div class="main-detail">
41
+ <DetailPanel :data="$Data.currentRow" :fields="$Data.detailFields">
42
+ <template #sendResult="{ value }">
43
+ <TTag v-if="value === 1" shape="round" theme="success" variant="light-outline">成功</TTag>
44
+ <TTag v-else shape="round" theme="danger" variant="light-outline">失败</TTag>
45
+ </template>
46
+ <template #sendTime="{ value }">
47
+ {{ $Method.formatTime(value) }}
48
+ </template>
49
+ <template #content="{ value }">
50
+ <div class="email-content" v-html="value"></div>
51
+ </template>
52
+ </DetailPanel>
53
+ </div>
54
+ </div>
55
+
56
+ <div class="main-page">
57
+ <TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
58
+ </div>
59
+
60
+ <!-- 发送邮件弹框 -->
61
+ <TDialog v-model:visible="$Data.sendDialogVisible" header="发送邮件" :footer="false" width="600px">
62
+ <TForm ref="sendFormRef" :data="$Data.sendForm" :rules="$Data.sendRules" label-width="80px">
63
+ <TFormItem label="收件人" name="to">
64
+ <TInput v-model="$Data.sendForm.to" placeholder="请输入收件人邮箱" />
65
+ </TFormItem>
66
+ <TFormItem label="抄送" name="cc">
67
+ <TInput v-model="$Data.sendForm.cc" placeholder="多个邮箱用逗号分隔(可选)" />
68
+ </TFormItem>
69
+ <TFormItem label="主题" name="subject">
70
+ <TInput v-model="$Data.sendForm.subject" placeholder="请输入邮件主题" />
71
+ </TFormItem>
72
+ <TFormItem label="内容" name="content">
73
+ <TTextarea v-model="$Data.sendForm.content" placeholder="请输入邮件内容(支持HTML)" :autosize="{ minRows: 6, maxRows: 12 }" />
74
+ </TFormItem>
75
+ <TFormItem>
76
+ <TSpace>
77
+ <TButton theme="primary" :loading="$Data.sending" @click="$Method.onSend">发送</TButton>
78
+ <TButton variant="outline" @click="$Data.sendDialogVisible = false">取消</TButton>
79
+ </TSpace>
80
+ </TFormItem>
81
+ </TForm>
82
+ </TDialog>
83
+ </div>
84
+ </template>
85
+
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-vite/utils/withDefaultColumns";
94
+
95
+ definePage({
96
+ meta: {
97
+ title: "邮件日志",
98
+ order: 2
99
+ }
100
+ });
101
+
102
+ const sendFormRef = $ref(null);
103
+
104
+ // 响应式数据
105
+ const $Data = $ref({
106
+ tableData: [],
107
+ loading: false,
108
+ columns: withDefaultColumns([
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: "发送结果" }
115
+ ]),
116
+ detailFields: [
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: "失败原因" }
128
+ ],
129
+ pagerConfig: {
130
+ currentPage: 1,
131
+ limit: 30,
132
+ total: 0
133
+ },
134
+ currentRow: null,
135
+ activeRowKeys: [],
136
+ sendDialogVisible: false,
137
+ sending: false,
138
+ sendForm: {
139
+ to: "",
140
+ cc: "",
141
+ subject: "",
142
+ content: ""
143
+ },
144
+ sendRules: {
145
+ to: [{ required: true, message: "请输入收件人邮箱", trigger: "blur" }],
146
+ subject: [{ required: true, message: "请输入邮件主题", trigger: "blur" }],
147
+ content: [{ required: true, message: "请输入邮件内容", trigger: "blur" }]
148
+ }
149
+ });
150
+
151
+ // 方法
152
+ const $Method = {
153
+ async initData() {
154
+ await $Method.apiEmailLogList();
155
+ },
156
+
157
+ // 加载邮件日志列表
158
+ async apiEmailLogList() {
159
+ $Data.loading = true;
160
+ try {
161
+ const res = await $Http("/addon/admin/email/logList", {
162
+ page: $Data.pagerConfig.currentPage,
163
+ limit: $Data.pagerConfig.limit
164
+ });
165
+ $Data.tableData = res.data.lists || [];
166
+ $Data.pagerConfig.total = res.data.total || 0;
167
+
168
+ if ($Data.tableData.length > 0) {
169
+ $Data.currentRow = $Data.tableData[0];
170
+ $Data.activeRowKeys = [$Data.tableData[0].id];
171
+ } else {
172
+ $Data.currentRow = null;
173
+ $Data.activeRowKeys = [];
174
+ }
175
+ } catch (error) {
176
+ MessagePlugin.error("加载数据失败");
177
+ } finally {
178
+ $Data.loading = false;
179
+ }
180
+ },
181
+
182
+ // 打开发送弹框
183
+ openSendDialog() {
184
+ $Data.sendForm = {
185
+ to: "",
186
+ cc: "",
187
+ subject: "",
188
+ content: ""
189
+ };
190
+ $Data.sendDialogVisible = true;
191
+ },
192
+
193
+ // 发送邮件
194
+ async onSend() {
195
+ const valid = await sendFormRef?.validate();
196
+ if (valid !== true) return;
197
+
198
+ $Data.sending = true;
199
+ try {
200
+ const res = await $Http("/addon/admin/email/send", {
201
+ to: $Data.sendForm.to,
202
+ subject: $Data.sendForm.subject,
203
+ content: $Data.sendForm.content,
204
+ cc: $Data.sendForm.cc || undefined,
205
+ isHtml: true
206
+ });
207
+
208
+ if (res.code === 0) {
209
+ MessagePlugin.success("发送成功");
210
+ $Data.sendDialogVisible = false;
211
+ $Method.apiEmailLogList();
212
+ } else {
213
+ MessagePlugin.error(res.msg || "发送失败");
214
+ }
215
+ } catch (error) {
216
+ MessagePlugin.error("发送失败");
217
+ } finally {
218
+ $Data.sending = false;
219
+ }
220
+ },
221
+
222
+ // 验证配置
223
+ async onVerify() {
224
+ try {
225
+ const res = await $Http("/addon/admin/email/verify");
226
+ if (res.code === 0) {
227
+ MessagePlugin.success("邮件服务配置正常");
228
+ } else {
229
+ MessagePlugin.error(res.msg || "配置异常");
230
+ }
231
+ } catch (error) {
232
+ MessagePlugin.error("验证失败");
233
+ }
234
+ },
235
+
236
+ // 刷新
237
+ handleRefresh() {
238
+ $Method.apiEmailLogList();
239
+ },
240
+
241
+ // 分页改变
242
+ onPageChange(currentPage) {
243
+ $Data.pagerConfig.currentPage = currentPage;
244
+ $Method.apiEmailLogList();
245
+ },
246
+
247
+ // 每页条数改变
248
+ handleSizeChange(pageSize) {
249
+ $Data.pagerConfig.limit = pageSize;
250
+ $Data.pagerConfig.currentPage = 1;
251
+ $Method.apiEmailLogList();
252
+ },
253
+
254
+ // 高亮行变化
255
+ onActiveChange(value, context) {
256
+ if (value.length === 0 && $Data.activeRowKeys.length > 0) {
257
+ return;
258
+ }
259
+ $Data.activeRowKeys = value;
260
+ if (context.activeRowList && context.activeRowList.length > 0) {
261
+ $Data.currentRow = context.activeRowList[0].row;
262
+ }
263
+ },
264
+
265
+ // 格式化时间
266
+ formatTime(timestamp) {
267
+ if (!timestamp) return "-";
268
+ const date = new Date(timestamp);
269
+ const year = date.getFullYear();
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");
275
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
276
+ }
277
+ };
278
+
279
+ $Method.initData();
280
+ </script>
281
+
282
+ <style scoped lang="scss">
283
+ .email-content {
284
+ max-height: 300px;
285
+ overflow-y: auto;
286
+ padding: 8px;
287
+ background: #f5f5f5;
288
+ border-radius: 4px;
289
+ font-size: 13px;
290
+ line-height: 1.6;
291
+ }
292
+ </style>
@@ -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>