fix: bizhi detail

This commit is contained in:
zzc
2026-02-26 14:58:04 +08:00
parent 9137a3410b
commit 2d178fa470
2 changed files with 10 additions and 12 deletions

View File

@@ -133,6 +133,7 @@ const detailData = ref({
}); });
const recommendList = ref([]); const recommendList = ref([]);
const shareToken = ref(""); const shareToken = ref("");
const categoryId = ref("");
onLoad(async (options) => { onLoad(async (options) => {
if (options.shareToken) { if (options.shareToken) {
@@ -196,6 +197,7 @@ const fetchRecommend = async (id) => {
try { try {
const res = await getWallpaperSameList(id || detailData.value.id); const res = await getWallpaperSameList(id || detailData.value.id);
recommendList.value = res; recommendList.value = res;
categoryId.value = res[0]?.categoryId || "";
} catch (e) { } catch (e) {
console.error("Failed to fetch recommendations", e); console.error("Failed to fetch recommendations", e);
} }
@@ -214,7 +216,7 @@ const goBack = () => {
const goToIndex = () => { const goToIndex = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/wallpaper/index", url: `/pages/wallpaper/index?categoryId=${categoryId.value}`,
}); });
}; };
@@ -249,16 +251,6 @@ const onRecommendClick = (item) => {
}); });
}; };
const goToGreeting = () => {
uni.switchTab({ url: "/pages/make/index" });
};
const goToAvatar = () => {
uni.navigateTo({
url: "/pages/avatar/index",
});
};
const handleLogind = async () => { const handleLogind = async () => {
// Logic after successful login if needed // Logic after successful login if needed
}; };

View File

@@ -174,6 +174,10 @@ onLoad((options) => {
shareToken.value = options.shareToken; shareToken.value = options.shareToken;
saveViewRequest(options.shareToken, "wallpaper_download"); saveViewRequest(options.shareToken, "wallpaper_download");
} }
if (options.categoryId) {
currentCategoryId.value = options.categoryId;
}
fetchCategories();
trackRecord({ trackRecord({
eventName: "wallpaper_page_visit", eventName: "wallpaper_page_visit",
eventType: `visit`, eventType: `visit`,
@@ -190,7 +194,9 @@ const fetchCategories = async () => {
const list = Array.isArray(res) ? res : res?.list || []; const list = Array.isArray(res) ? res : res?.list || [];
if (list.length > 0) { if (list.length > 0) {
categories.value = list; categories.value = list;
if (!currentCategoryId.value) {
currentCategoryId.value = list[0].id; currentCategoryId.value = list[0].id;
}
loadWallpapers(true); loadWallpapers(true);
} }
} catch (e) { } catch (e) {