fix(user-center): drop icon before unopened VIP status name

The status card always rendered the icon slot, so never-opened members saw a generic certificate glyph in front of 未开通会员 (level 0 has no configured icon and fell back to fa-certificate). Members with a real level keep their icon; only the level-0 case drops the slot.

Render the icon span only when vip_level_number > 0.

Verification: extended tests/widget-system/vip-tab-status-card.test.cjs (3 contract tests); node --test tests/**/*.test.cjs 638/638 pass; php -l clean.
This commit is contained in:
kate522 committed 2026-10-18 14:47:26 +08:00
1 parent e94ecdd7b1
commit 817ac9c647
2 files changed
+9 -1

No files matched your search

@@ -34,3 +34,10 @@ test('生效中/永久/已过期分支仍产出到期文案', () => {
const assignments = vipTab.match(/\$vip_expiry_text\s*=/g) || [];
assert.ok(assignments.length >= 4, '初始化 + 永久 + 生效中 + 已过期均应赋值');
});
test('未开通状态名称前不渲染图标位', () => {
// 图标位仅在有等级(生效中/永久/已过期)时输出;未开通(level 0)不输出,
// 避免「未开通会员」前面挂通用证书图标。
assert.match(vipTab, /\$vip_level_number > 0 \? '<span class="uc-vip-status__icon"/);
assert.ok(!vipTab.includes(". '<span class=\"uc-vip-status__icon\" aria-hidden=\"true\">' . \$status_icon"), '图标位不应再无条件渲染');
});