修复用户管理外部邮箱绑定状态误显示关闭

This commit is contained in:
smail 2026-09-18 22:52:05 +08:00
parent 39e65eb9f4
commit 29a1d58461
3 changed files with 7 additions and 11 deletions

View File

@ -18,10 +18,7 @@ export function recoveryCodeMeta(configured) {
: { label: '未开启', type: 'info' }
}
export function externalEmailMeta(enabled, configured) {
if (!enabled) {
return { label: '已关闭', type: 'warning' }
}
export function externalEmailMeta(configured) {
return configured
? { label: '已绑定', type: 'success' }
: { label: '未绑定', type: 'info' }

View File

@ -37,12 +37,12 @@
<el-table-column label="外部邮箱" width="76">
<template #default="scope">
<el-tag
:type="externalEmailMeta(scope.row.ExternalEmailEnabled, scope.row.ExternalEmailConfigured).type"
:type="externalEmailMeta(scope.row.ExternalEmailConfigured).type"
size="small"
effect="plain"
class="status-tag"
>
{{ externalEmailMeta(scope.row.ExternalEmailEnabled, scope.row.ExternalEmailConfigured).label }}
{{ externalEmailMeta(scope.row.ExternalEmailConfigured).label }}
</el-tag>
</template>
</el-table-column>
@ -165,7 +165,6 @@
<strong>外部邮箱</strong>
<span>
{{ externalEmailMeta(
selectedUser?.ExternalEmailEnabled,
selectedUser?.ExternalEmailConfigured
).label }}
</span>

View File

@ -33,9 +33,8 @@ test('用户管理状态映射使用明确的中文文案', () => {
assert.equal(roleMeta('').label, '未知权限')
assert.equal(recoveryCodeMeta(true).label, '已开启')
assert.equal(recoveryCodeMeta(false).label, '未开启')
assert.equal(externalEmailMeta(true, true).label, '已绑定')
assert.equal(externalEmailMeta(true, false).label, '未绑定')
assert.equal(externalEmailMeta(false, true).label, '已关闭')
assert.equal(externalEmailMeta(true).label, '已绑定')
assert.equal(externalEmailMeta(false).label, '未绑定')
assert.equal(accountStatusMeta(0).label, '正常')
assert.equal(accountStatusMeta(1).label, '已禁用')
})
@ -50,8 +49,9 @@ test('用户管理页面可编译并展示权限与安全状态列', () => {
}
assert.match(source, /scope\.row\.Role/)
assert.match(source, /scope\.row\.RecoveryCodeConfigured/)
assert.match(source, /scope\.row\.ExternalEmailEnabled/)
assert.doesNotMatch(source, /ExternalEmailEnabled/)
assert.match(source, /scope\.row\.ExternalEmailConfigured/)
assert.match(source, /selectedUser\?\.ExternalEmailConfigured/)
assert.match(source, /管理安全码/)
assert.match(source, /编辑外部邮箱/)
assert.match(source, /RecoveryCodeDialog/)