github-actions[bot] commited on
Commit
a828c95
·
1 Parent(s): 6c6d16c

Update from GitHub Actions

Browse files
Files changed (1) hide show
  1. src/views/MailView.vue +176 -193
src/views/MailView.vue CHANGED
@@ -30,11 +30,11 @@ const columns = [
30
 
31
  // 添加下拉菜单选项函数
32
  const actionOptions = (row: Account) => [
33
- { content: '查看认证', value: 'check', onClick: () => handleCheckAuth(row) },
34
- { content: '刷新认证', value: 'refresh', onClick: () => handleRefreshAuth(row) },
35
- { content: '最新邮件', value: 'latest', onClick: () => handleLatestMails(row) },
36
- { content: '所有邮件', value: 'all', onClick: () => handleAllMails(row) },
37
- { content: '发送邮件', value: 'send', onClick: () => handleSendMail(row) },
38
  ];
39
 
40
  // 实现处理函数
@@ -52,12 +52,12 @@ const handleRefreshAuth = async (row: Account) => {
52
  };
53
 
54
  interface ParsedEmail {
55
- subject: string;
56
- from: string;
57
- to: string[];
58
- date: string;
59
- text: string;
60
- html: string;
61
  }
62
 
63
  const showEmailDialog = ref(false);
@@ -73,7 +73,7 @@ const handleLatestMails = async (row: Account) => {
73
  } else {
74
  MessagePlugin.info('没有找到邮件');
75
  }
76
- } catch (error:any) {
77
  MessagePlugin.error(`${error.message}`);
78
  } finally {
79
  loading.value = false;
@@ -89,7 +89,7 @@ const handleAllMails = async (row: Account) => {
89
  try {
90
  mailsLoading.value = true;
91
  showAllMailsDialog.value = true;
92
- allMailsList.value= []
93
  const emails = await mailApi.getAllMails(row.email);
94
  allMailsList.value = emails;
95
  } catch (error: any) {
@@ -105,7 +105,7 @@ const viewMailDetail = (email: any) => {
105
  showEmailDialog.value = true;
106
  };
107
 
108
-
109
 
110
  // 添加发送邮件相关的状态
111
  const showSendDialog = ref(false);
@@ -132,7 +132,7 @@ const handleSendMail = async (row: Account) => {
132
  // 添加发送邮件提交函数
133
  const submitSendMail = async () => {
134
  if (!currentMailAccount.value) return;
135
-
136
  try {
137
  loading.value = true;
138
  await mailApi.sendMail({
@@ -157,18 +157,18 @@ const handleSort = (sortInfo: { sortBy: string; descending: boolean }) => {
157
  pagination.value.current = 1;
158
  };
159
 
160
-
161
  // 使用计算属性处理排序和分页
162
  const processedData = computed(() => {
163
  let result = [...allData.value];
164
 
165
  // 用户搜索过滤
166
  if (userSearch.value) {
167
- result = result.filter(log =>
168
  log.email.toLowerCase().includes(userSearch.value.toLowerCase())
169
  );
170
  }
171
-
172
  pagination.value.total = result.length; // 更新总数以反映过滤后的结果
173
 
174
  // 分页处理
@@ -202,11 +202,11 @@ const handleRefreshAll = async () => {
202
  loading.value = true;
203
  const emails = allData.value.map(account => account.email);
204
  const result = await mailApi.refreshAuthBatch(emails);
205
-
206
  // Count successes and failures
207
- const successes = result.filter((r:any) => r.success).length;
208
  const failures = result.length - successes;
209
-
210
  if (failures > 0) {
211
  MessagePlugin.warning(`刷新完成: ${successes}个成功, ${failures}个失败`);
212
  } else {
@@ -224,10 +224,10 @@ const handleRefreshPage = async () => {
224
  loading.value = true;
225
  const emails = processedData.value.map(account => account.email);
226
  const result = await mailApi.refreshAuthBatch(emails);
227
-
228
- const successes = result.filter((r:any) => r.success).length;
229
  const failures = result.length - successes;
230
-
231
  if (failures > 0) {
232
  MessagePlugin.warning(`刷新完成: ${successes}个成功, ${failures}个失败`);
233
  } else {
@@ -257,219 +257,202 @@ const handleCheckAuth = async (row: Account) => {
257
  }
258
  };
259
 
260
-
261
  </script>
262
 
263
  <template>
264
  <div class="w-full h-full flex flex-col p-2 md:p-5 gap-2 md:gap-5">
265
- <div class="flex flex-col md:flex-row md:items-center md:justify-between">
266
- <div class="flex flex-col md:flex-row md:items-center gap-4">
267
- <t-button @click="handleRefreshAll">刷新全部</t-button>
268
- <t-button @click="handleRefreshPage">刷新本页</t-button>
269
- <t-input v-model="userSearch" class="w-full md:w-40" placeholder="搜索用户" clearable />
270
- </div>
271
- </div>
272
-
273
- <div class="overflow-x-auto flex-1 overflow-y-auto">
274
- <t-table :data="processedData" :loading="loading" :columns="columns" row-key="datetime" hover
275
- :sort="sort" @sort-change="handleSort" size="small" class="min-w-full">
276
- <template #action="{ row }">
277
- <!-- 桌面端显示 -->
278
- <div class="hidden md:flex flex-wrap gap-2">
279
- <t-button size="small" variant="outline" @click="handleCheckAuth(row)">查看认证</t-button>
280
- <t-button size="small" variant="outline" @click="handleRefreshAuth(row)">刷新认证</t-button>
281
- <t-button size="small" variant="outline" @click="handleLatestMails(row)">最新邮件</t-button>
282
- <t-button size="small" variant="outline" @click="handleAllMails(row)">所有邮件</t-button>
283
- <t-button size="small" variant="outline" @click="handleSendMail(row)">发送邮件</t-button>
284
  </div>
285
-
286
- <!-- 移动端显示 -->
287
- <div class="md:hidden">
288
- <t-dropdown :options="actionOptions(row)">
289
- <t-button variant="outline" size="small">操作 <t-icon name="chevron-down" /></t-button>
290
- </t-dropdown>
291
- </div>
292
- </template>
293
- </t-table>
294
- </div>
295
-
296
- <div class="flex justify-end">
297
- <t-pagination v-model="pagination.current" :total="pagination.total" :page-size="pagination.pageSize"
298
- size="small" />
299
- </div>
300
-
301
- <!-- 邮件详情对话框 -->
302
- <t-dialog
303
- :visible="showEmailDialog"
304
- :header="currentEmail?.subject"
305
- @close="showEmailDialog = false"
306
- :width="800"
307
- :footer="false"
308
- class="email-detail-dialog"
309
- >
310
- <template v-if="currentEmail">
311
- <div class="email-details">
312
- <div class="email-meta">
313
- <p><strong>发件人:</strong> {{ currentEmail.from }}</p>
314
- <p><strong>收件人:</strong> {{ currentEmail.to?.join(', ') }}</p>
315
- <p><strong>时间:</strong> {{ new Date(currentEmail.date.received).toLocaleString() }}</p>
316
- <p v-if="currentEmail.metadata?.location"><strong>位置:</strong> {{ currentEmail.metadata.location }}</p>
317
- <p v-if="currentEmail.metadata?.ip"><strong>IP:</strong> {{ currentEmail.metadata.ip }}</p>
318
- <p v-if="currentEmail.metadata?.platform"><strong>平台:</strong> {{ currentEmail.metadata.platform }}</p>
319
- <p v-if="currentEmail.metadata?.browser"><strong>浏览器:</strong> {{ currentEmail.metadata.browser }}</p>
320
- <p><strong>重要性:</strong> {{ currentEmail.importance }}</p>
321
- <p><strong>状态:</strong> {{ currentEmail.isRead ? '已读' : '未读' }}</p>
322
- </div>
323
- <div class="email-content" v-html="currentEmail.html || currentEmail.text"></div>
324
- <div v-if="currentEmail.hasAttachments" class="email-attachments">包含附件</div>
325
- <div class="email-actions">
326
- <a :href="currentEmail.webLink" target="_blank">在Outlook中查看</a>
327
- </div>
328
- </div>
329
- </template>
330
- </t-dialog>
331
-
332
- <!-- 所有邮件列表对话框 -->
333
- <t-dialog
334
- :visible="showAllMailsDialog"
335
- header="所有邮件"
336
- @close="showAllMailsDialog = false"
337
- :width="900"
338
- :footer="false"
339
- >
340
- <t-loading :loading="mailsLoading">
341
- <div class="emails-list">
342
- <t-list>
343
- <t-list-item
344
- v-for="email in allMailsList"
345
- :key="email.id"
346
- @click="viewMailDetail(email)"
347
- class="email-list-item"
348
- >
349
- <div class="flex flex-col gap-1 w-full cursor-pointer hover:bg-gray-50 p-2">
350
- <div class="flex justify-between">
351
- <span class="font-medium">{{ email.subject || '(无主题)' }}</span>
352
- <span class="text-gray-500 text-sm">
353
- {{ new Date(email.date.received).toLocaleString() }}
354
- </span>
355
- </div>
356
- <div class="flex justify-between text-sm">
357
- <span class="text-gray-600">发件人: {{ email.from }}</span>
358
- <span :class="{'text-green-600': email.isRead, 'text-red-600': !email.isRead}">
359
- {{ email.isRead ? '已读' : '未读' }}
360
- </span>
361
- </div>
362
- </div>
363
- </t-list-item>
364
- </t-list>
365
- </div>
366
- </t-loading>
367
- </t-dialog>
368
-
369
- <!-- 发送邮件对话框 -->
370
- <t-dialog
371
- :visible="showSendDialog"
372
- header="发送邮件"
373
- @close="showSendDialog = false"
374
- :width="600"
375
- :footer="false"
376
- >
377
- <template v-if="currentMailAccount">
378
- <div class="send-mail-form">
379
- <t-form>
380
- <t-form-item label="发件人">
381
- <t-input disabled :value="currentMailAccount.email" />
382
- </t-form-item>
383
- <t-form-item label="收件人">
384
- <t-input v-model="sendMailForm.to" placeholder="多个收件人请用逗号分隔" />
385
- </t-form-item>
386
- <t-form-item label="主题">
387
- <t-input v-model="sendMailForm.subject" />
388
- </t-form-item>
389
- <t-form-item label="内容">
390
- <t-textarea v-model="sendMailForm.body" :rows="6" />
391
- </t-form-item>
392
- <t-form-item>
393
- <t-checkbox v-model="sendMailForm.isHtml">HTML 格式</t-checkbox>
394
- </t-form-item>
395
- <t-form-item>
396
- <div class="flex justify-end gap-2">
397
- <t-button theme="default" @click="showSendDialog = false">取消</t-button>
398
- <t-button theme="primary" @click="submitSendMail" :loading="loading">发送</t-button>
399
- </div>
400
- </t-form-item>
401
- </t-form>
402
- </div>
403
- </template>
404
- </t-dialog>
405
  </div>
406
  </template>
407
-
408
  <style scoped>
409
  @media (max-width: 768px) {
410
- :deep(.t-table__header) {
411
- font-size: 14px;
412
- }
413
 
414
- :deep(.t-table td) {
415
- font-size: 13px;
416
- }
417
  }
418
 
419
  .email-details {
420
- max-height: 60vh;
421
- overflow-y: auto;
422
- padding: 16px;
423
  }
424
 
425
  .email-content {
426
- margin-top: 16px;
427
- border-top: 1px solid #eee;
428
- padding-top: 16px;
429
  }
430
 
431
  .email-meta {
432
- background: #f5f5f5;
433
- padding: 12px;
434
- border-radius: 4px;
435
- margin-bottom: 16px;
436
  }
437
 
438
  .email-actions {
439
- margin-top: 16px;
440
- text-align: right;
441
  }
442
 
443
  .email-attachments {
444
- margin-top: 16px;
445
- color: #666;
446
- font-style: italic;
447
  }
448
 
449
  .send-mail-form {
450
- padding: 16px;
451
  }
452
 
453
  .emails-list {
454
- max-height: 60vh;
455
- overflow-y: auto;
456
  }
457
 
458
  .email-list-item {
459
- border-bottom: 1px solid #eee;
460
  }
461
 
462
  .email-list-item:last-child {
463
- border-bottom: none;
464
  }
465
 
466
  /* 添加以下CSS确保邮件详情弹窗总是显示在最上层 */
467
  :deep(.email-detail-dialog) {
468
- z-index: 3000 !important; /* 确保高于其他弹窗 */
 
469
  }
470
 
471
  /* 可能需要调整其他弹窗的z-index */
472
  :deep(.t-dialog) {
473
- z-index: 2000;
474
  }
475
  </style>
 
30
 
31
  // 添加下拉菜单选项函数
32
  const actionOptions = (row: Account) => [
33
+ { content: '查看认证', value: 'check', onClick: () => handleCheckAuth(row) },
34
+ { content: '刷新认证', value: 'refresh', onClick: () => handleRefreshAuth(row) },
35
+ { content: '最新邮件', value: 'latest', onClick: () => handleLatestMails(row) },
36
+ { content: '所有邮件', value: 'all', onClick: () => handleAllMails(row) },
37
+ { content: '发送邮件', value: 'send', onClick: () => handleSendMail(row) },
38
  ];
39
 
40
  // 实现处理函数
 
52
  };
53
 
54
  interface ParsedEmail {
55
+ subject: string;
56
+ from: string;
57
+ to: string[];
58
+ date: string;
59
+ text: string;
60
+ html: string;
61
  }
62
 
63
  const showEmailDialog = ref(false);
 
73
  } else {
74
  MessagePlugin.info('没有找到邮件');
75
  }
76
+ } catch (error: any) {
77
  MessagePlugin.error(`${error.message}`);
78
  } finally {
79
  loading.value = false;
 
89
  try {
90
  mailsLoading.value = true;
91
  showAllMailsDialog.value = true;
92
+ allMailsList.value = []
93
  const emails = await mailApi.getAllMails(row.email);
94
  allMailsList.value = emails;
95
  } catch (error: any) {
 
105
  showEmailDialog.value = true;
106
  };
107
 
108
+
109
 
110
  // 添加发送邮件相关的状态
111
  const showSendDialog = ref(false);
 
132
  // 添加发送邮件提交函数
133
  const submitSendMail = async () => {
134
  if (!currentMailAccount.value) return;
135
+
136
  try {
137
  loading.value = true;
138
  await mailApi.sendMail({
 
157
  pagination.value.current = 1;
158
  };
159
 
160
+
161
  // 使用计算属性处理排序和分页
162
  const processedData = computed(() => {
163
  let result = [...allData.value];
164
 
165
  // 用户搜索过滤
166
  if (userSearch.value) {
167
+ result = result.filter(log =>
168
  log.email.toLowerCase().includes(userSearch.value.toLowerCase())
169
  );
170
  }
171
+
172
  pagination.value.total = result.length; // 更新总数以反映过滤后的结果
173
 
174
  // 分页处理
 
202
  loading.value = true;
203
  const emails = allData.value.map(account => account.email);
204
  const result = await mailApi.refreshAuthBatch(emails);
205
+
206
  // Count successes and failures
207
+ const successes = result.filter((r: any) => r.success).length;
208
  const failures = result.length - successes;
209
+
210
  if (failures > 0) {
211
  MessagePlugin.warning(`刷新完成: ${successes}个成功, ${failures}个失败`);
212
  } else {
 
224
  loading.value = true;
225
  const emails = processedData.value.map(account => account.email);
226
  const result = await mailApi.refreshAuthBatch(emails);
227
+
228
+ const successes = result.filter((r: any) => r.success).length;
229
  const failures = result.length - successes;
230
+
231
  if (failures > 0) {
232
  MessagePlugin.warning(`刷新完成: ${successes}个成功, ${failures}个失败`);
233
  } else {
 
257
  }
258
  };
259
 
260
+
261
  </script>
262
 
263
  <template>
264
  <div class="w-full h-full flex flex-col p-2 md:p-5 gap-2 md:gap-5">
265
+ <div class="flex flex-col md:flex-row md:items-center md:justify-between">
266
+ <div class="flex flex-col md:flex-row md:items-center gap-4">
267
+ <t-button @click="handleRefreshAll"><span class=" text-xs px-2">刷新全部认证</span></t-button>
268
+ <t-button @click="handleRefreshPage"><span class=" text-xs px-2">刷新本页认证</span></t-button>
269
+ <t-input v-model="userSearch" class="w-full md:w-40" placeholder="搜索用户" clearable />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  </div>
271
+ </div>
272
+
273
+ <div class="overflow-x-auto flex-1 overflow-y-auto">
274
+ <t-table :data="processedData" :loading="loading" :columns="columns" row-key="datetime" hover :sort="sort"
275
+ @sort-change="handleSort" size="small" class="min-w-full">
276
+ <template #action="{ row }">
277
+ <!-- 桌面端显示 -->
278
+ <div class="hidden md:flex flex-wrap gap-2">
279
+ <t-button size="small" variant="outline" @click="handleCheckAuth(row)">查看认证</t-button>
280
+ <t-button size="small" variant="outline" @click="handleRefreshAuth(row)">刷新认证</t-button>
281
+ <t-button size="small" variant="outline" @click="handleLatestMails(row)">最新邮件</t-button>
282
+ <t-button size="small" variant="outline" @click="handleAllMails(row)">所有邮件</t-button>
283
+ <t-button size="small" variant="outline" @click="handleSendMail(row)">发送邮件</t-button>
284
+ </div>
285
+
286
+ <!-- 移动端显示 -->
287
+ <div class="md:hidden">
288
+ <t-dropdown :options="actionOptions(row)">
289
+ <t-button variant="outline" size="small">操作 <t-icon name="chevron-down" /></t-button>
290
+ </t-dropdown>
291
+ </div>
292
+ </template>
293
+ </t-table>
294
+ </div>
295
+
296
+ <div class="flex justify-end">
297
+ <t-pagination v-model="pagination.current" :total="pagination.total" :page-size="pagination.pageSize"
298
+ size="small" />
299
+ </div>
300
+
301
+ <!-- 邮件详情对话框 -->
302
+ <t-dialog :visible="showEmailDialog" :header="currentEmail?.subject" @close="showEmailDialog = false"
303
+ :width="800" :footer="false" class="email-detail-dialog">
304
+ <template v-if="currentEmail">
305
+ <div class="email-details">
306
+ <div class="email-meta">
307
+ <p><strong>发件人:</strong> {{ currentEmail.from }}</p>
308
+ <p><strong>收件人:</strong> {{ currentEmail.to?.join(', ') }}</p>
309
+ <p><strong>时间:</strong> {{ new Date(currentEmail.date.received).toLocaleString() }}</p>
310
+ <p v-if="currentEmail.metadata?.location"><strong>位置:</strong> {{ currentEmail.metadata.location
311
+ }}</p>
312
+ <p v-if="currentEmail.metadata?.ip"><strong>IP:</strong> {{ currentEmail.metadata.ip }}</p>
313
+ <p v-if="currentEmail.metadata?.platform"><strong>平台:</strong> {{ currentEmail.metadata.platform
314
+ }}</p>
315
+ <p v-if="currentEmail.metadata?.browser"><strong>浏览器:</strong> {{ currentEmail.metadata.browser
316
+ }}</p>
317
+ <p><strong>重要性:</strong> {{ currentEmail.importance }}</p>
318
+ <p><strong>状态:</strong> {{ currentEmail.isRead ? '已读' : '未读' }}</p>
319
+ </div>
320
+ <div class="email-content" v-html="currentEmail.html || currentEmail.text"></div>
321
+ <div v-if="currentEmail.hasAttachments" class="email-attachments">包含附件</div>
322
+ <div class="email-actions">
323
+ <a :href="currentEmail.webLink" target="_blank">在Outlook中查看</a>
324
+ </div>
325
+ </div>
326
+ </template>
327
+ </t-dialog>
328
+
329
+ <!-- 所有邮件列表对话框 -->
330
+ <t-dialog :visible="showAllMailsDialog" header="所有邮件" @close="showAllMailsDialog = false" :width="900"
331
+ :footer="false">
332
+ <t-loading :loading="mailsLoading">
333
+ <div class="emails-list">
334
+ <t-list>
335
+ <t-list-item v-for="email in allMailsList" :key="email.id" @click="viewMailDetail(email)"
336
+ class="email-list-item">
337
+ <div class="flex flex-col gap-1 w-full cursor-pointer hover:bg-gray-50 p-2">
338
+ <div class="flex justify-between">
339
+ <span class="font-medium">{{ email.subject || '(无主题)' }}</span>
340
+ <span class="text-gray-500 text-sm">
341
+ {{ new Date(email.date.received).toLocaleString() }}
342
+ </span>
343
+ </div>
344
+ <div class="flex justify-between text-sm">
345
+ <span class="text-gray-600">发件人: {{ email.from }}</span>
346
+ <span :class="{ 'text-green-600': email.isRead, 'text-red-600': !email.isRead }">
347
+ {{ email.isRead ? '已读' : '未读' }}
348
+ </span>
349
+ </div>
350
+ </div>
351
+ </t-list-item>
352
+ </t-list>
353
+ </div>
354
+ </t-loading>
355
+ </t-dialog>
356
+
357
+ <!-- 发送邮件对话框 -->
358
+ <t-dialog :visible="showSendDialog" header="发送邮件" @close="showSendDialog = false" :width="600" :footer="false">
359
+ <template v-if="currentMailAccount">
360
+ <div class="send-mail-form">
361
+ <t-form>
362
+ <t-form-item label="发件人">
363
+ <t-input disabled :value="currentMailAccount.email" />
364
+ </t-form-item>
365
+ <t-form-item label="收件人">
366
+ <t-input v-model="sendMailForm.to" placeholder="多个收件人请用逗号分隔" />
367
+ </t-form-item>
368
+ <t-form-item label="主题">
369
+ <t-input v-model="sendMailForm.subject" />
370
+ </t-form-item>
371
+ <t-form-item label="内容">
372
+ <t-textarea v-model="sendMailForm.body" :rows="6" />
373
+ </t-form-item>
374
+ <t-form-item>
375
+ <t-checkbox v-model="sendMailForm.isHtml">HTML 格式</t-checkbox>
376
+ </t-form-item>
377
+ <t-form-item>
378
+ <div class="flex justify-end gap-2">
379
+ <t-button theme="default" @click="showSendDialog = false">取消</t-button>
380
+ <t-button theme="primary" @click="submitSendMail" :loading="loading">发送</t-button>
381
+ </div>
382
+ </t-form-item>
383
+ </t-form>
384
+ </div>
385
+ </template>
386
+ </t-dialog>
 
 
 
 
387
  </div>
388
  </template>
389
+
390
  <style scoped>
391
  @media (max-width: 768px) {
392
+ :deep(.t-table__header) {
393
+ font-size: 14px;
394
+ }
395
 
396
+ :deep(.t-table td) {
397
+ font-size: 13px;
398
+ }
399
  }
400
 
401
  .email-details {
402
+ max-height: 60vh;
403
+ overflow-y: auto;
404
+ padding: 16px;
405
  }
406
 
407
  .email-content {
408
+ margin-top: 16px;
409
+ border-top: 1px solid #eee;
410
+ padding-top: 16px;
411
  }
412
 
413
  .email-meta {
414
+ background: #f5f5f5;
415
+ padding: 12px;
416
+ border-radius: 4px;
417
+ margin-bottom: 16px;
418
  }
419
 
420
  .email-actions {
421
+ margin-top: 16px;
422
+ text-align: right;
423
  }
424
 
425
  .email-attachments {
426
+ margin-top: 16px;
427
+ color: #666;
428
+ font-style: italic;
429
  }
430
 
431
  .send-mail-form {
432
+ padding: 16px;
433
  }
434
 
435
  .emails-list {
436
+ max-height: 60vh;
437
+ overflow-y: auto;
438
  }
439
 
440
  .email-list-item {
441
+ border-bottom: 1px solid #eee;
442
  }
443
 
444
  .email-list-item:last-child {
445
+ border-bottom: none;
446
  }
447
 
448
  /* 添加以下CSS确保邮件详情弹窗总是显示在最上层 */
449
  :deep(.email-detail-dialog) {
450
+ z-index: 3000 !important;
451
+ /* 确保高于其他弹窗 */
452
  }
453
 
454
  /* 可能需要调整其他弹窗的z-index */
455
  :deep(.t-dialog) {
456
+ z-index: 2000;
457
  }
458
  </style>