fix: rating

This commit is contained in:
zzc
2026-05-23 23:24:57 +08:00
parent 0270ba084f
commit 07a568c878
3 changed files with 36 additions and 26 deletions

View File

@@ -5,7 +5,7 @@
<text class="item-name">{{ item.name }}</text>
<view class="rank-tag" v-if="item.rank <= 3">NO.{{ item.rank }}</view>
<view class="flex-spacer"></view>
<text class="item-score">{{ item.score }}</text>
<text class="item-score">{{ item.scoreAvg }}</text>
</view>
<view class="quote-box" v-if="item.quote">
<text class="quote-text">{{ item.quote }}</text>
@@ -15,8 +15,8 @@
class="action-item"
v-for="(action, aIndex) in actions"
:key="aIndex"
:class="{ active: item.userAction === action.value }"
@tap.stop="handleAction(action.value)"
:class="{ active: item.userAction === action.label }"
@tap.stop="handleAction(action)"
>
<view class="action-icon-wrap" :class="'icon-' + action.value">
<text class="emoji">{{ action.emoji }}</text>
@@ -30,16 +30,18 @@
<script setup>
import { FILE_BASE_URL } from "@/utils/constants";
const actions = [
{ label: '拉', value: 'terrible', emoji: '👎', score: 2, scoreType:1 },
{ label: 'NPC', value: 'bad', emoji: '😐', score: 4, scoreType: 2},
{ label: '人上人', value: 'ok', emoji: '🙂', score: 6, scoreType: 3},
{ label: '顶级', value: 'good', emoji: '🔥', score: 8, scoreType: 4},
{ label: '夯', value: 'god', emoji: '👑', score: 10, scoreType: 5 }
];
const props = defineProps({
item: {
type: Object,
required: true,
default: () => ({})
},
actions: {
type: Array,
required: true,
default: () => []
}
});
@@ -49,8 +51,8 @@ const handleCardTap = () => {
emit('item-click', props.item.id);
};
const handleAction = (actionValue) => {
emit('action-click', props.item, actionValue);
const handleAction = async (action) => {
emit('action-click', props.item, action);
};
</script>

View File

@@ -26,7 +26,7 @@
<text class="rank-num" :class="'rank-' + (index + 1)">{{ index + 1 }}</text>
<image class="item-avatar" :src="FILE_BASE_URL + item.avatarUrl" mode="aspectFill"></image>
<text class="item-name">{{ item.name }}</text>
<text class="item-score" :class="'score-' + (index + 1)">{{ item.score }}</text>
<text class="item-score" :class="'score-' + (index + 1)">{{ item.scoreAvg }}</text>
</view>
</view>