fix(community): add missing heart and heartFilled icons to restore like button rendering

这个提交包含在:
xcbyy
2026-10-13 15:37:07 +08:00
父节点 fb23b262b3
当前提交 3d895a1a0a
共有 3 个文件被更改,包括 41 次插入 和 1 次删除

查看文件

@@ -45,6 +45,18 @@ export const ICONS = {
</svg>
`),
heart: svgToUri(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#94A3B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
</svg>
`),
heartFilled: svgToUri(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#EF4444" stroke="#EF4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
</svg>
`),
close: svgToUri(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#94A3B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="18" y1="6" x2="6" y2="18"></line>

查看文件

@@ -110,7 +110,7 @@
<view class="post-footer">
<view class="footer-left">
<view class="action-item btn-active" @click="toggleLike(post)">
<image class="action-icon" :src="post.liked ? ICONS.flame : ICONS.heart" mode="aspectFit" />
<image class="action-icon" :src="post.liked ? ICONS.heartFilled : ICONS.heart" mode="aspectFit" />
<text class="action-count" :class="{ liked: post.liked }">{{ post.likes }}</text>
</view>
<view class="action-item btn-active" @click="handleComment(post)">

查看文件

@@ -917,6 +917,34 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安
expect(emojiRegex.test(content)).toBe(false);
});
});
describe('21. 友圈广场点赞图标与矢量图标库完整性验证 (pwuniapp/common/icons.js & pages/community/index.vue)', () => {
const iconsPath = path.join(rootDir, 'pwuniapp', 'common', 'icons.js');
const communityPath = path.join(rootDir, 'pwuniapp', 'pages', 'community', 'index.vue');
it('icons.js 必须完整导出 heart (未点赞) 与 heartFilled (已点赞高亮) 矢量图标', () => {
expect(fs.existsSync(iconsPath)).toBe(true);
const content = fs.readFileSync(iconsPath, 'utf-8');
expect(content).toContain('heart: svgToUri');
expect(content).toContain('heartFilled: svgToUri');
expect(content).toContain('#94A3B8');
expect(content).toContain('#EF4444');
});
it('友圈广场页面点赞按钮必须正确绑定 heartFilled 与 heart 图标', () => {
expect(fs.existsSync(communityPath)).toBe(true);
const content = fs.readFileSync(communityPath, 'utf-8');
expect(content).toContain(':src="post.liked ? ICONS.heartFilled : ICONS.heart"');
});
it('icons.js 与友圈广场页面严禁包含任何系统 Emoji 违规字符', () => {
const iconsContent = fs.readFileSync(iconsPath, 'utf-8');
const communityContent = fs.readFileSync(communityPath, 'utf-8');
const emojiRegex = /(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u2600-\u27BF])/u;
expect(emojiRegex.test(iconsContent)).toBe(false);
expect(emojiRegex.test(communityContent)).toBe(false);
});
});
});