()
| 494 | |
| 495 | // Outlook 导入 |
| 496 | async function handleOutlookImport() { |
| 497 | const data = elements.outlookImportData.value.trim(); |
| 498 | if (!data) { toast.error('请输入导入数据'); return; } |
| 499 | |
| 500 | elements.outlookImportBtn.disabled = true; |
| 501 | elements.outlookImportBtn.textContent = '导入中...'; |
| 502 | |
| 503 | try { |
| 504 | const result = await api.post('/email-services/outlook/batch-import', { |
| 505 | data: data, |
| 506 | enabled: elements.outlookImportEnabled.checked, |
| 507 | priority: parseInt(elements.outlookImportPriority.value) || 0 |
| 508 | }); |
| 509 | |
| 510 | elements.importResult.style.display = 'block'; |
| 511 | elements.importResult.innerHTML = ` |
| 512 | <div class="import-stats"> |
| 513 | <span>✅ 成功导入: <strong>${result.success || 0}</strong></span> |
| 514 | <span>❌ 失败: <strong>${result.failed || 0}</strong></span> |
| 515 | </div> |
| 516 | ${result.errors?.length ? `<div class="import-errors" style="margin-top: var(--spacing-sm);"><strong>错误详情:</strong><ul>${result.errors.map(e => `<li>${escapeHtml(e)}</li>`).join('')}</ul></div>` : ''} |
| 517 | `; |
| 518 | |
| 519 | if (result.success > 0) { |
| 520 | toast.success(`成功导入 ${result.success} 个账户`); |
| 521 | loadOutlookServices(); |
| 522 | loadStats(); |
| 523 | elements.outlookImportData.value = ''; |
| 524 | } |
| 525 | } catch (error) { |
| 526 | toast.error('导入失败: ' + error.message); |
| 527 | } finally { |
| 528 | elements.outlookImportBtn.disabled = false; |
| 529 | elements.outlookImportBtn.textContent = '📥 开始导入'; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | // 添加自定义邮箱服务(根据子类型区分) |
| 534 | async function handleAddCustom(e) { |
nothing calls this directly
no test coverage detected