feat/info-comment-jump

This commit is contained in:
zzc
2026-06-25 07:35:36 +08:00
parent 8d2337e5b7
commit 4fb8a05f8d
4 changed files with 149 additions and 6 deletions

View File

@@ -294,9 +294,8 @@ const resolveActionText = (item) => {
};
const resolveJumpText = (item) => {
if(item.title.includes("已提交审核") || item.title.includes("未通过")) return "";
if(item.title.includes("已提交审核") || item.title.includes("未通过") || item.title.includes("评分项")) return "";
if (item.itemId) return "查看评分详情";
if (item.topicId) return "查看话题";
return "查看消息";
};
@@ -405,9 +404,16 @@ const setItemReadState = (id, isRead = true) => {
};
const handleNavigate = (item) => {
const isCommentInteraction = item?.type === 'comment' || item?.type === 'comment_like';
const targetCommentId =
item?.commentId ||
(item?.targetType === 'comment' ? item?.targetId : '') ||
item?.metadata?.commentId ||
'';
if (item.itemId) {
uni.navigateTo({
url: `/pages/rating/detail?topicId=${item.topicId || ""}&itemId=${item.itemId}`,
url: `/pages/rating/detail?topicId=${item.topicId || ""}&itemId=${item.itemId}${isCommentInteraction && targetCommentId ? `&commentId=${targetCommentId}` : ""}`,
});
return;
}
@@ -438,7 +444,7 @@ const markSingleAsRead = async (item) => {
const handleItemTap = async (item) => {
await markSingleAsRead(item);
if(item.title.includes("未通过") || item.title.includes("已提交审核")) return
if(item.title.includes("未通过") || item.title.includes("已提交审核") || item.title.includes("评分项")) return
handleNavigate(item);
};

View File

@@ -140,6 +140,7 @@ const commentSectionRef = ref(null);
const isLoggedIn = computed(() => !!userStore.token || !!userStore.userInfo?.nickName);
const isSendingComment = ref(false);
const pkPreview = ref(null);
const pendingAnchorCommentId = ref('');
const commentRequestKey = computed(() => {
if (!detailData.value.topicId || !itemId.value) return '';
return `${detailData.value.topicId}_${itemId.value}`;
@@ -360,6 +361,14 @@ const handleCommentPublished = ({ mode, content, replyTarget }) => {
});
};
const scrollToPendingComment = async () => {
if (!pendingAnchorCommentId.value) return;
const found = await commentSectionRef.value?.scrollToComment?.(pendingAnchorCommentId.value);
if (found) {
pendingAnchorCommentId.value = '';
}
};
const handleSendComment = async (payload) => {
if (!isLoggedIn.value) {
openLoginPopup();
@@ -424,6 +433,7 @@ const getDetailData = async () => {
currentAction.value = data.userAction || '';
await commentSectionRef.value?.refreshComments?.();
await scrollToPendingComment();
getPkPreviewData();
} catch (error) {
console.error('获取详情失败:', error);
@@ -446,6 +456,9 @@ onLoad((options) => {
if (options.topicId) {
detailData.value.topicId = options.topicId;
}
if (options.commentId) {
pendingAnchorCommentId.value = options.commentId;
}
if (options.itemId) {
itemId.value = options.itemId;
getDetailData();