fix: rating
This commit is contained in:
@@ -29,9 +29,9 @@ export const topicItemCommentLike = async (data) => {
|
||||
};
|
||||
|
||||
// 获取评论列表
|
||||
export const topicItemCommentList = async (topicId, itemId, page = 1) => {
|
||||
export const topicItemCommentList = async (topicId, itemId, page = 1, orderBy = 1) => {
|
||||
return request({
|
||||
url: `/api/rating/topic/comment/item/list?topicId=${topicId}&itemId=${itemId}&page=${page}`,
|
||||
url: `/api/rating/topic/comment/item/list?topicId=${topicId}&itemId=${itemId}&page=${page}&orderBy=${orderBy}`,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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 => ({
|
||||
|
||||
Reference in New Issue
Block a user