diff --git a/api/system.js b/api/system.js index 7a6c7a3..68fbdc7 100644 --- a/api/system.js +++ b/api/system.js @@ -60,6 +60,13 @@ export const getRankList = async (scene) => { }); }; +export const getRandomRecommendList = async (scene) => { + return request({ + url: `/api/blessing/random/recommend/list?scene=${scene}`, + method: "get", + }); +}; + export const msgCheckApi = async (content) => { return request({ url: "/api/common/msg-check?content=" + content, diff --git a/pages/index/index.vue b/pages/index/index.vue index 63655b7..f6f7b78 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -159,7 +159,7 @@ @tap="navToWallpaper(item)" > @@ -190,7 +190,7 @@ @tap="navToAvatar(item)" > @@ -221,7 +221,11 @@ import { ref, onMounted, computed } from "vue"; import { getStatusBarHeight } from "@/utils/system"; import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app"; import { useUserStore } from "@/stores/user"; -import { getRankList, watchAdReward } from "@/api/system"; +import { + getRankList, + watchAdReward, + getRandomRecommendList, +} from "@/api/system"; import { getUserSignInfo, userSignIn } from "@/api/user"; import calendar from "@/utils/lunar"; @@ -369,8 +373,8 @@ const fetchUserSingInfo = async () => { const fetchHomeData = async () => { try { const [wallpapers, avatars] = await Promise.all([ - getRankList("wallpaper"), - getRankList("avatar"), + getRandomRecommendList("wallpaper_download"), + getRandomRecommendList("avatar_download"), ]); if (wallpapers && Array.isArray(wallpapers)) { @@ -394,16 +398,14 @@ const navToMake = (item) => { }; const navToWallpaper = (item) => { - const imageUrl = encodeURIComponent( - item.resourceInfo?.url || item.imageUrl || "", - ); + const imageUrl = encodeURIComponent(item.imageUrl || ""); uni.navigateTo({ - url: `/pages/wallpaper/detail?id=${item.targetId}&imageUrl=${imageUrl}`, + url: `/pages/wallpaper/detail?id=${item.id}&imageUrl=${imageUrl}&categoryId=${item.categoryId}`, }); }; const navToAvatar = (item) => { - const query = `recommendId=${item.targetId || ""}&type=avatar&imageUrl=${encodeURIComponent(item?.resourceInfo?.url || "")}`; + const query = `recommendId=${item.id || ""}&type=avatar&imageUrl=${encodeURIComponent(item?.imageUrl || "")}`; uni.navigateTo({ url: `/pages/avatar/index?${query}` }); }; @@ -914,11 +916,11 @@ onShareTimeline(() => { flex-direction: column; align-items: center; margin-right: 24rpx; - width: 140rpx; + width: 160rpx; .avatar-img { - width: 140rpx; - height: 140rpx; + width: 160rpx; + height: 160rpx; border-radius: 32rpx; margin-bottom: 12rpx; box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05); @@ -941,8 +943,8 @@ onShareTimeline(() => { flex-direction: column; align-items: center; justify-content: center; - width: 140rpx; - height: 140rpx; + width: 160rpx; + height: 160rpx; background: #d81e06; border-radius: 32rpx; box-shadow: 0 8rpx 24rpx rgba(216, 30, 6, 0.2); diff --git a/pages/wallpaper/detail.vue b/pages/wallpaper/detail.vue index 52d73e5..e3f4dfc 100644 --- a/pages/wallpaper/detail.vue +++ b/pages/wallpaper/detail.vue @@ -146,6 +146,10 @@ onLoad(async (options) => { if (options.imageUrl) { detailData.value.imageUrl = decodeURIComponent(options.imageUrl); } + + if (options.categoryId) { + categoryId.value = options.categoryId; + } fetchRecommend(options.id); }); @@ -197,7 +201,7 @@ const fetchRecommend = async (id) => { try { const res = await getWallpaperSameList(id || detailData.value.id); recommendList.value = res; - categoryId.value = res[0]?.categoryId || ""; + // categoryId.value = res[0]?.categoryId || ""; } catch (e) { console.error("Failed to fetch recommendations", e); }