fix: rating

This commit is contained in:
zzc
2026-05-26 07:29:52 +08:00
parent da6fb97da4
commit 7ef0e46cc8
3 changed files with 44 additions and 12 deletions

View File

@@ -127,9 +127,8 @@ import { getStatusBarHeight } from "@/utils/system";
import { onLoad, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import AttitudePanel from "@/components/AttitudePanel/AttitudePanel.vue";
import SuccessPopup from "@/components/SuccessPopup/SuccessPopup.vue";
import { fetchTopicRatingItems } from "@/api/topicItem";
import { FILE_BASE_URL } from "@/utils/constants";
import { topicItemScore } from "@/api/topicItem";
import { fetchTopicRatingItems, topicItemScore, topicItemComment } from "@/api/topicItem";
const statusBarHeight = ref(getStatusBarHeight() || 44);
const loading = ref(false);
@@ -181,13 +180,35 @@ const handleActionChange = async (action) => {
}
};
const handleSendComment = (payload) => {
console.log('发送评论:', payload);
uni.showToast({
title: '发送成功',
icon: 'success'
});
// TODO: 调用接口发送评论,然后更新评论列表
const handleSendComment = async (payload) => {
if (!detailData.value.topicId || !itemId.value) return;
try {
uni.showLoading({ title: '发送中...' });
await topicItemComment({
topicId: detailData.value.topicId,
itemId: itemId.value,
content: payload.content
});
uni.hideLoading();
// 弹出成功弹窗
if (successPopupRef.value) {
successPopupRef.value.show({
emoji: '💬',
label: '你的锐评已发布'
}, 'comment');
}
// 刷新页面数据以获取最新评论
getDetailData();
} catch (error) {
uni.hideLoading();
uni.showToast({
title: '发送失败',
icon: 'none'
});
}
};
const getDetailData = async () => {