fix: rating

This commit is contained in:
zzc
2026-05-26 10:25:33 +08:00
parent b3f7609494
commit 6d42ebb513
2 changed files with 16 additions and 5 deletions

View File

@@ -80,8 +80,8 @@
<view class="comments-section card">
<view class="tabs-header">
<view class="tabs">
<text class="tab active">最热</text>
<text class="tab">最新</text>
<text class="tab" :class="{ active: currentTab === 'hot' }" @tap="switchTab('hot')">最热</text>
<text class="tab" :class="{ active: currentTab === 'new' }" @tap="switchTab('new')">最新</text>
</view>
<text class="filter-icon"></text>
</view>
@@ -126,6 +126,7 @@ const hasMore = ref(true);
const currentPage = ref(1);
const currentAction = ref('');
const successPopupRef = ref(null);
const currentTab = ref('hot'); // 'hot' 或 'new'
const goBack = () => {
uni.navigateBack();
@@ -205,12 +206,22 @@ const handleSendComment = async (payload) => {
}
};
const switchTab = (tab) => {
if (currentTab.value === tab) return;
currentTab.value = tab;
currentPage.value = 1;
hasMore.value = true;
comments.value = [];
getCommentsData();
};
const getCommentsData = async () => {
if (!detailData.value.topicId || !itemId.value || loading.value) return;
try {
loading.value = true;
const res = await topicItemCommentList(detailData.value.topicId, itemId.value, currentPage.value);
const orderBy = currentTab.value;
const res = await topicItemCommentList(detailData.value.topicId, itemId.value, currentPage.value, orderBy);
const list = res?.list || [];
const formattedList = list.map(item => ({