diff --git a/pages/wallpaper/detail.vue b/pages/wallpaper/detail.vue index bff869b..52d73e5 100644 --- a/pages/wallpaper/detail.vue +++ b/pages/wallpaper/detail.vue @@ -133,6 +133,7 @@ const detailData = ref({ }); const recommendList = ref([]); const shareToken = ref(""); +const categoryId = ref(""); onLoad(async (options) => { if (options.shareToken) { @@ -196,6 +197,7 @@ const fetchRecommend = async (id) => { try { const res = await getWallpaperSameList(id || detailData.value.id); recommendList.value = res; + categoryId.value = res[0]?.categoryId || ""; } catch (e) { console.error("Failed to fetch recommendations", e); } @@ -214,7 +216,7 @@ const goBack = () => { const goToIndex = () => { 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 () => { // Logic after successful login if needed }; diff --git a/pages/wallpaper/index.vue b/pages/wallpaper/index.vue index 62af99a..8b399eb 100644 --- a/pages/wallpaper/index.vue +++ b/pages/wallpaper/index.vue @@ -174,6 +174,10 @@ onLoad((options) => { shareToken.value = options.shareToken; saveViewRequest(options.shareToken, "wallpaper_download"); } + if (options.categoryId) { + currentCategoryId.value = options.categoryId; + } + fetchCategories(); trackRecord({ eventName: "wallpaper_page_visit", eventType: `visit`, @@ -190,7 +194,9 @@ const fetchCategories = async () => { const list = Array.isArray(res) ? res : res?.list || []; if (list.length > 0) { categories.value = list; - currentCategoryId.value = list[0].id; + if (!currentCategoryId.value) { + currentCategoryId.value = list[0].id; + } loadWallpapers(true); } } catch (e) {