feat(frontend): restore the posts count badge and drop dead vipbg-v1 rules

统计行补回「文章」徽章。上一轮按「项目不做帖子」的要求把它删掉了,现在这个判断反过来了,于是恢复:位置回到参考主题的顺序(文章在最前),计数仍走 count_user_posts,图标改用全局 FA5+ 的 fa-file-alt,与其余徽章(评论 / 点赞 / 人气)保持一致。

删掉 main.css 里 .vipbg-v1 与 .vipbg-v1:before 两条死规则。全站没有任何地方使用这个类,而且 :before 里的 f006 是 FA4 码位,在 FA5 中映射不到任何字形,留着只会让人以为水印能出来。

两个契约测试里原本断言统计行不输出文章徽章,改回断言输出,并补上 fa-file-alt 的校验。

重建 main.min.css;public bundle 本次未变,因为它打包的 header-userbox.css 没有改动。573 项契约测试全部通过。
This commit is contained in:
2026-10-10 16:42:16 +08:00
parent 7e7bf6db23
commit 855e85e7db
5 changed files with 9 additions and 17 deletions
-10
View File
@@ -5944,16 +5944,6 @@ body:has(.modal.in) .float-btn,
opacity: 0.06;
}
.vipbg-v1 {
background: linear-gradient(60deg, #f0bf81 0, #fdefd6 30%, #f2deb9 40%, #fdc277 80%, #f9e1b7 100%);
color: #8c5728;
--this-color: #8c5728;
}
.vipbg-v1:before {
content: '\f006';
}
.vip-texticon {
font-size: 0.85em;
background: transparent;
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -327,8 +327,7 @@ if (!function_exists('aksrt_get_user_posts_meta_sum')) {
if (!function_exists('aksrt_get_user_badges')) {
/**
* legacy parity: 作者资料卡统计徽章行(评论 / 粉丝|点赞 / 人气值)。
* 本站不做帖子,故不输出文章徽章。
* legacy parity: 作者资料卡统计徽章行(文章 / 评论 / 粉丝|点赞 / 人气值)。
*
* @param int $user_id 用户 ID。
*/
@@ -338,6 +337,7 @@ if (!function_exists('aksrt_get_user_badges')) {
}
$home = aksrt_get_user_home_url($user_id);
$post_n = aksrt_cut_count(count_user_posts($user_id, 'post', true));
$com_n = aksrt_cut_count((int) get_comments([
'user_id' => $user_id,
'status' => 'approve',
@@ -351,6 +351,7 @@ if (!function_exists('aksrt_get_user_badges')) {
$view_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, 'aksrt_post_views'));
$html = '';
$html .= '<a class="but c-blue tag-posts" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s篇文章', 'aksrt'), $post_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-file-alt" aria-hidden="true"></i>' . $post_n . '</a>';
$html .= '<a class="but c-green tag-comment" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s条评论', 'aksrt'), $com_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-comment-dots" aria-hidden="true"></i>' . $com_n . '</a>';
if ($followed_n) {
$html .= '<a class="but c-yellow tag-follow" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s个粉丝', 'aksrt'), $followed_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-heart em09" aria-hidden="true"></i>' . $followed_n . '</a>';
@@ -181,10 +181,11 @@ test('the account popover rows match the reference user box structure', () => {
const identity = read('inc/helpers/aksrt-identity.php');
const legacyMainCss = read('assets/css/main.css');
// Stats row is wired with the reference wrapper and drops the posts chip.
// Stats row is wired with the reference wrapper and carries the posts chip.
assert.match(header, /aksrt_header_user_badges_row\(\$user_id\)/);
assert.match(header, /class="em09 author-tag mb10 mt6 flex jc"/);
assert.doesNotMatch(identity, /tag-posts/);
assert.match(identity, /tag-posts/);
assert.match(identity, /fa fas fa-file-alt/);
assert.match(identity, /fa fas fa-comment-dots/);
assert.match(identity, /fa fas fa-thumbs-up/);
assert.match(identity, /fa fas fa-fire/);
@@ -307,8 +307,8 @@ test('after-box author card mirrors legacy user-card structure', () => {
assert.match(render, /<div class="user-desc mt10 muted-2-color em09">/);
assert.doesNotMatch(render, /user-btns/);
assert.doesNotMatch(render, /发布文章.*用户中心/s);
// The project ships no posts, so the stats row carries no posts chip.
assert.doesNotMatch(identity, /tag-posts/);
// The stats row carries the posts chip.
assert.match(identity, /tag-posts/);
assert.match(identity, /tag-comment/);
assert.match(identity, /tag-follow/);
assert.match(identity, /tag-like/);