修改日志显示,合并同一轮中对应的邮箱和手机号

This commit is contained in:
QLHazyCoder
2026-05-05 03:59:09 +08:00
parent c62e1746f8
commit 24f5b79bf1
14 changed files with 377 additions and 42 deletions
+80 -9
View File
@@ -72,8 +72,15 @@
if (rawRecordId) {
return rawRecordId.toLowerCase();
}
const identifierType = String(record.accountIdentifierType || '').trim().toLowerCase() === 'phone'
|| (!record.email && (record.accountIdentifier || record.phoneNumber))
const rawIdentifierType = String(record.accountIdentifierType || '').trim().toLowerCase();
const hasPhoneOnlyIdentifier = !record.email && (
record.phoneNumber
|| record.phone
|| record.number
|| (record.accountIdentifier && !/@/.test(String(record.accountIdentifier || '')))
);
const identifierType = rawIdentifierType === 'phone'
|| (!rawIdentifierType && hasPhoneOnlyIdentifier)
? 'phone'
: 'email';
const identifier = String(
@@ -89,12 +96,71 @@
: identifier.toLowerCase();
}
function getRecordPrimaryIdentifier(record = {}) {
const email = String(record.email || '').trim();
if (email) {
return email;
function getRecordIdentifierType(record = {}) {
const rawType = String(record.accountIdentifierType || '').trim().toLowerCase();
if (rawType === 'phone') {
return 'phone';
}
return String(record.accountIdentifier || record.phoneNumber || record.phone || record.number || '').trim();
if (rawType === 'email') {
return 'email';
}
if (!record.email && (record.phoneNumber || record.phone || record.number)) {
return 'phone';
}
if (!record.email && record.accountIdentifier && !/@/.test(String(record.accountIdentifier || ''))) {
return 'phone';
}
return 'email';
}
function getRecordEmail(record = {}) {
const identifierType = getRecordIdentifierType(record);
return String(
record.email
|| (identifierType === 'email' ? record.accountIdentifier : '')
|| ''
).trim();
}
function getRecordPhoneNumber(record = {}) {
const identifierType = getRecordIdentifierType(record);
return String(
record.phoneNumber
|| record.phone
|| record.number
|| (identifierType === 'phone' ? record.accountIdentifier : '')
|| ''
).trim();
}
function getRecordPrimaryIdentifier(record = {}) {
const identifierType = getRecordIdentifierType(record);
const email = getRecordEmail(record);
const phoneNumber = getRecordPhoneNumber(record);
return identifierType === 'phone'
? (phoneNumber || String(record.accountIdentifier || '').trim() || email)
: (email || String(record.accountIdentifier || '').trim() || phoneNumber);
}
function getRecordSecondaryIdentifier(record = {}) {
const identifierType = getRecordIdentifierType(record);
const email = getRecordEmail(record);
const phoneNumber = getRecordPhoneNumber(record);
if (identifierType === 'phone' && email) {
return `邮箱 ${email}`;
}
if (identifierType !== 'phone' && phoneNumber) {
return `绑定手机号 ${phoneNumber}`;
}
return '';
}
function getRecordTitle(record = {}) {
const primaryIdentifier = getRecordPrimaryIdentifier(record) || '(空账号)';
const secondaryIdentifier = getRecordSecondaryIdentifier(record);
return secondaryIdentifier
? `${primaryIdentifier} / ${secondaryIdentifier}`
: primaryIdentifier;
}
function getAccountRunRecords(currentState = state.getLatestState()) {
@@ -382,6 +448,8 @@
dom.accountRecordsList.innerHTML = visibleRecords.map((record) => {
const recordId = buildRecordId(record);
const primaryIdentifier = getRecordPrimaryIdentifier(record) || '(空账号)';
const secondaryIdentifier = getRecordSecondaryIdentifier(record);
const recordTitle = getRecordTitle(record);
const statusMeta = getStatusMeta(record);
const summaryText = getRecordSummaryText(record);
const retryCount = normalizeRetryCount(record.retryCount);
@@ -408,12 +476,15 @@
<div
class="${itemClassNames}"
data-account-record-id="${escapeHtml(recordId)}"
title="${escapeHtml(primaryIdentifier)}"
title="${escapeHtml(recordTitle)}"
>
<div class="account-record-item-top">
<div class="account-record-item-email-row">
${selectionMarkup}
<div class="account-record-item-email mono">${escapeHtml(primaryIdentifier)}</div>
<div class="account-record-item-identity">
<div class="account-record-item-email mono">${escapeHtml(primaryIdentifier)}</div>
${secondaryIdentifier ? `<div class="account-record-item-secondary mono">${escapeHtml(secondaryIdentifier)}</div>` : ''}
</div>
</div>
<div class="account-record-item-side">
<span class="account-record-item-status">${escapeHtml(statusMeta.label)}</span>
+18 -1
View File
@@ -3038,17 +3038,34 @@ header {
cursor: pointer;
}
.account-record-item-email {
.account-record-item-identity {
min-width: 0;
flex: 1;
display: flex;
flex-direction: column;
gap: 2px;
}
.account-record-item-email,
.account-record-item-secondary {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.account-record-item-email {
color: var(--text-primary);
font-size: 12px;
font-weight: 600;
}
.account-record-item-secondary {
color: var(--text-secondary);
font-size: 10px;
font-weight: 600;
}
.account-record-item-side {
display: flex;
align-items: center;
+4 -4
View File
@@ -1525,7 +1525,7 @@
<div class="log-header">
<span class="section-label">日志</span>
<div class="log-header-actions">
<button id="btn-open-account-records" class="btn btn-ghost btn-xs" title="查看邮箱记录">记录</button>
<button id="btn-open-account-records" class="btn btn-ghost btn-xs" title="查看账号记录">记录</button>
<button id="btn-clear-log" class="btn btn-ghost btn-xs" title="清空日志">清空</button>
</div>
</div>
@@ -1536,15 +1536,15 @@
<div class="account-records-panel">
<div class="account-records-panel-header">
<div class="account-records-panel-copy">
<span class="account-records-panel-title">邮箱记录</span>
<span id="account-records-meta" class="account-records-panel-meta">暂无邮箱记录</span>
<span class="account-records-panel-title">账号记录</span>
<span id="account-records-meta" class="account-records-panel-meta">暂无账号记录</span>
</div>
<div class="account-records-panel-actions">
<button id="btn-close-account-records" class="modal-close" type="button" aria-label="关闭">×</button>
</div>
</div>
<div class="account-records-toolbar">
<div id="account-records-stats" class="account-records-stats" role="group" aria-label="邮箱记录筛选"></div>
<div id="account-records-stats" class="account-records-stats" role="group" aria-label="账号记录筛选"></div>
<div class="account-records-toolbar-actions">
<button id="btn-toggle-account-records-selection" class="btn btn-ghost btn-xs" type="button">多选</button>
<button id="btn-delete-selected-account-records" class="btn btn-ghost btn-xs" type="button" hidden
+1
View File
@@ -7238,6 +7238,7 @@ async function persistSignupPhoneInputValue(options = {}) {
signupPhoneInputDirty = getSignupPhoneInputValue() !== normalizedPhone;
syncLatestState({
signupPhoneNumber: normalizedPhone,
phoneNumber: '',
...(normalizedPhone
? {
accountIdentifierType: 'phone',