fix: bizhi detail
This commit is contained in:
@@ -20,3 +20,10 @@ export const getWallpaperRecommendList = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getWallpaperSameList = async (id) => {
|
||||
return request({
|
||||
url: `/api/blessing/wallpaper/same/list?id=${id}`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -398,7 +398,7 @@ const navToWallpaper = (item) => {
|
||||
item.resourceInfo?.url || item.imageUrl || "",
|
||||
);
|
||||
uni.navigateTo({
|
||||
url: `/pages/wallpaper/detail?id=${item.id}&imageUrl=${imageUrl}`,
|
||||
url: `/pages/wallpaper/detail?id=${item.targetId}&imageUrl=${imageUrl}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ import { ref, computed } from "vue";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getPageDetail } from "@/api/system";
|
||||
import { getWallpaperRecommendList } from "@/api/wallpaper";
|
||||
import { getWallpaperSameList } from "@/api/wallpaper";
|
||||
import {
|
||||
getShareToken,
|
||||
saveViewRequest,
|
||||
@@ -145,7 +145,7 @@ onLoad(async (options) => {
|
||||
if (options.imageUrl) {
|
||||
detailData.value.imageUrl = decodeURIComponent(options.imageUrl);
|
||||
}
|
||||
fetchRecommend();
|
||||
fetchRecommend(options.id);
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
@@ -180,6 +180,7 @@ const fetchDetail = async () => {
|
||||
saveViewRequest(shareToken.value, "wallpaper_detail", res.id);
|
||||
if (res) {
|
||||
detailData.value = res;
|
||||
fetchRecommend(res.id);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch detail", e);
|
||||
@@ -190,9 +191,10 @@ const fetchDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchRecommend = async () => {
|
||||
const fetchRecommend = async (id) => {
|
||||
if (!id && !detailData.value.id) return;
|
||||
try {
|
||||
const res = await getWallpaperRecommendList();
|
||||
const res = await getWallpaperSameList(id || detailData.value.id);
|
||||
recommendList.value = res;
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch recommendations", e);
|
||||
@@ -230,8 +232,21 @@ const previewImage = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const onRecommendClick = () => {
|
||||
goToIndex();
|
||||
const onRecommendClick = (item) => {
|
||||
// Update detailData with new item info
|
||||
detailData.value = {
|
||||
...detailData.value,
|
||||
id: item.id,
|
||||
imageUrl: item.imageUrl,
|
||||
title: item.title,
|
||||
};
|
||||
// Refresh recommendations for the new item
|
||||
fetchRecommend(item.id);
|
||||
// Scroll to top or just update view
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300,
|
||||
});
|
||||
};
|
||||
|
||||
const goToGreeting = () => {
|
||||
|
||||
Reference in New Issue
Block a user