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({
|
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",
|
method: "GET",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,8 +80,8 @@
|
|||||||
<view class="comments-section card">
|
<view class="comments-section card">
|
||||||
<view class="tabs-header">
|
<view class="tabs-header">
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<text class="tab active">最热</text>
|
<text class="tab" :class="{ active: currentTab === 'hot' }" @tap="switchTab('hot')">最热</text>
|
||||||
<text class="tab">最新</text>
|
<text class="tab" :class="{ active: currentTab === 'new' }" @tap="switchTab('new')">最新</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="filter-icon"></text>
|
<text class="filter-icon"></text>
|
||||||
</view>
|
</view>
|
||||||
@@ -126,6 +126,7 @@ const hasMore = ref(true);
|
|||||||
const currentPage = ref(1);
|
const currentPage = ref(1);
|
||||||
const currentAction = ref('');
|
const currentAction = ref('');
|
||||||
const successPopupRef = ref(null);
|
const successPopupRef = ref(null);
|
||||||
|
const currentTab = ref('hot'); // 'hot' 或 'new'
|
||||||
|
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.navigateBack();
|
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 () => {
|
const getCommentsData = async () => {
|
||||||
if (!detailData.value.topicId || !itemId.value || loading.value) return;
|
if (!detailData.value.topicId || !itemId.value || loading.value) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
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 list = res?.list || [];
|
||||||
|
|
||||||
const formattedList = list.map(item => ({
|
const formattedList = list.map(item => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user