fix: rating

This commit is contained in:
zzc
2026-06-10 00:34:12 +08:00
parent d129f1d38e
commit 0383ad6be2
4 changed files with 74 additions and 7 deletions

View File

@@ -150,6 +150,10 @@ const switchCategory = (categoryId) => {
const topicList = ref([]);
const getCurrentCategoryTitle = () => {
return categories.value.find((category) => category.id === currentCategoryId.value)?.title || "推荐";
};
const goToRating = (topicId, itemId) => {
uni.$trackRecord({
eventName: 'jumpto_rating',
@@ -216,8 +220,9 @@ onReachBottom(() => {
onShareAppMessage(async () => {
const shareToken = await getShareToken("index");
getShareReward();
const categoryTitle = getCurrentCategoryTitle();
return {
title: "夯拉评分",
title: `夯拉评分 | ${categoryTitle}榜单正在热议`,
path: "/pages/index/index?shareToken=" + shareToken,
};
});
@@ -225,8 +230,9 @@ onShareAppMessage(async () => {
onShareTimeline(async () => {
const shareToken = await getShareToken("index");
getShareReward();
const categoryTitle = getCurrentCategoryTitle();
return {
title: "夯拉评分",
title: `${categoryTitle}圈都在玩夯拉评分,来看看谁最夯`,
query: `shareToken=${shareToken}`,
};
});

View File

@@ -93,7 +93,7 @@
<script setup>
import { ref, computed } from "vue";
import { useUserStore } from "@/stores/user";
import { onShareAppMessage, onLoad, onShow } from "@dcloudio/uni-app";
import { onShareAppMessage, onShareTimeline, onLoad, onShow } from "@dcloudio/uni-app";
import { getShareToken } from "@/utils/common";
import { getShareReward } from "@/api/system";
import { fetchUserNums } from "@/api/mine";
@@ -154,13 +154,25 @@ onShow(() => {
onShareAppMessage(async () => {
const shareToken = await getShareToken("mine");
getShareReward({ scene: "mine" });
const nickName = isLoggedIn.value ? userInfo.value.nickName : "我";
return {
title: "分享",
path: "/pages/index/index?shareToken=" + shareToken,
title: `${nickName}也在玩夯拉评分来看看TA的主页`,
path: "/pages/mine/mine?shareToken=" + shareToken,
imageUrl: "https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
};
});
onShareTimeline(async () => {
const shareToken = await getShareToken("mine");
getShareReward({ scene: "mine_timeline" });
const nickName = isLoggedIn.value ? userInfo.value.nickName : "我";
const participant = userStats.value.participant || 0;
return {
title: `${nickName}已参与 ${participant} 个话题,来夯拉评分一起围观`,
query: `shareToken=${shareToken}`,
};
});
const handleUserClick = () => {
if (!isLoggedIn.value) {
loginPopupRef.value.open();

View File

@@ -109,7 +109,7 @@
<script setup>
import { ref } from 'vue';
import { getStatusBarHeight } from "@/utils/system";
import { onLoad, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import { onLoad, onPullDownRefresh, onReachBottom, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import AttitudePanel from "@/components/AttitudePanel/AttitudePanel.vue";
import SuccessPopup from "@/components/SuccessPopup/SuccessPopup.vue";
import ActionBadge from "@/components/ActionBadge/ActionBadge.vue";
@@ -117,6 +117,8 @@ import CommentItem from "@/components/CommentItem/CommentItem.vue";
import { FILE_BASE_URL } from "@/utils/constants";
import { fetchTopicRatingItems, topicItemScore, topicItemComment, topicItemCommentList } from "@/api/topicItem";
import { formatDate } from "@/utils/date";
import { getShareToken } from "@/utils/common";
import { getShareReward } from "@/api/system";
@@ -337,6 +339,27 @@ onLoad((options) => {
}
});
onShareAppMessage(async () => {
const shareToken = await getShareToken("rating_item");
getShareReward({ scene: "rating_item" });
const itemName = detailData.value.name || "这个评分对象";
return {
title: `${itemName}」在夯拉评分里是什么段位?`,
path: `/pages/rating/detail?itemId=${itemId.value}&topicId=${detailData.value.topicId}&shareToken=${shareToken}`,
};
});
onShareTimeline(async () => {
const shareToken = await getShareToken("rating_item");
getShareReward({ scene: "rating_item_timeline" });
const itemName = detailData.value.name || "这个评分对象";
const score = detailData.value.score || "0.0";
return {
title: `${itemName}当前评分 ${score},来看看大家怎么评`,
query: `itemId=${itemId.value}&topicId=${detailData.value.topicId}&shareToken=${shareToken}`,
};
});
onPullDownRefresh(() => {
currentPage.value = 1;
hasMore.value = true;

View File

@@ -156,13 +156,15 @@
<script setup>
import { ref } from 'vue';
import { getStatusBarHeight } from "@/utils/system";
import { onPullDownRefresh, onReachBottom, onLoad } from "@dcloudio/uni-app";
import { onPullDownRefresh, onReachBottom, onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import { fetchTopicDetail, fetchTopicRatingItems } from "@/api/topic";
import { FILE_BASE_URL } from "@/utils/constants";
import RatingCard from "@/components/RatingCard/RatingCard.vue";
import SuccessPopup from "@/components/SuccessPopup/SuccessPopup.vue";
import { topicItemScore, topicItemAdd } from "@/api/topicItem";
import { uploadImage } from "@/utils/common";
import { getShareToken } from "@/utils/common";
import { getShareReward } from "@/api/system";
// 状态栏高度处理
const statusBarHeight = ref(getStatusBarHeight() || 44);
@@ -361,6 +363,30 @@ const goToDetail = (itemId) => {
});
};
onShareAppMessage(async () => {
const shareToken = await getShareToken("rating_topic");
getShareReward({ scene: "rating_topic" });
const topName = ratingItems.value?.[0]?.name;
return {
title: topName
? `${topicData.value.title || "夯拉评分"}」正在热评,${topName}暂时领先`
: `${topicData.value.title || "夯拉评分"}」正在热评,快来参与打分`,
path: `/pages/rating/index?topicId=${currentTopicId.value}&shareToken=${shareToken}`,
};
});
onShareTimeline(async () => {
const shareToken = await getShareToken("rating_topic");
getShareReward({ scene: "rating_topic_timeline" });
const topName = ratingItems.value?.[0]?.name;
return {
title: topName
? `${topName}在「${topicData.value.title || "夯拉评分"}」里冲到第一了`
: `${topicData.value.title || "夯拉评分"}」榜单已开启,来看看大家怎么评`,
query: `topicId=${currentTopicId.value}&shareToken=${shareToken}`,
};
});
// 下拉刷新
onPullDownRefresh(async () => {
if (currentTopicId.value) {