🚸 突出已点赞帖子

This commit is contained in:
BTMuli
2026-04-12 21:24:57 +08:00
parent c2ab1c550c
commit 415ff1c98d
2 changed files with 26 additions and 7 deletions

View File

@@ -50,7 +50,11 @@
<v-icon size="12">mdi-eye</v-icon>
<span>{{ card.data.view }}</span>
</div>
<div :title="`收藏数:${card.data.mark}`" class="tpc-info-item">
<div
:class="{ collected: props.post.self_operation?.is_collected }"
:title="`收藏数:${card.data.mark}`"
class="tpc-info-item"
>
<v-icon size="12">mdi-star</v-icon>
<span>{{ card.data.mark }}</span>
</div>
@@ -58,7 +62,11 @@
<v-icon size="12">mdi-comment</v-icon>
<span>{{ card.data.reply }}</span>
</div>
<div :title="`点赞数:${card.data.like}`" class="tpc-info-item">
<div
:class="{ love: props.post.self_operation?.upvote_type ?? 0 > 0 }"
:title="`点赞数:${card.data.like}`"
class="tpc-info-item"
>
<v-icon size="12">mdi-thumb-up</v-icon>
<span>{{ card.data.like }}</span>
</div>
@@ -185,8 +193,10 @@ watch(
);
function trySelect(): void {
if (props.selectMode) emits("onSelected", props.post.post.post_id);
isSelected.value = !isSelected.value;
if (props.selectMode) {
emits("onSelected", props.post.post.post_id);
isSelected.value = !isSelected.value;
}
}
async function toPost(): Promise<void> {
@@ -484,6 +494,14 @@ function onUserClick(): void {
gap: 2px;
opacity: 0.6;
white-space: nowrap;
&.love {
color: var(--tgc-od-red);
}
&.collect {
color: var(--tgc-od-orange);
}
}
.tpc-act {

View File

@@ -1,7 +1,8 @@
/**
* 用户类型定义文件
* @since Beta v0.7.9
* @since Beta v0.10.0
*/
declare namespace TGApp.BBS.User {
/**
* 用户信息返回响应
@@ -115,7 +116,7 @@ declare namespace TGApp.BBS.User {
/**
* 用户操作
* @since Beta v0.7.2
* @since Beta v0.10.0
*/
type SelfOperation = {
/** 操作类型 */
@@ -123,7 +124,7 @@ declare namespace TGApp.BBS.User {
/** 是否收藏 */
is_collected: boolean;
/** 互动类型 */
upvote_type: number;
upvote_type?: number;
};
/**