fix: index detail

This commit is contained in:
zzc
2026-02-26 15:14:55 +08:00
parent 5738464cc8
commit a883caf981
3 changed files with 29 additions and 16 deletions

View File

@@ -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) => { export const msgCheckApi = async (content) => {
return request({ return request({
url: "/api/common/msg-check?content=" + content, url: "/api/common/msg-check?content=" + content,

View File

@@ -159,7 +159,7 @@
@tap="navToWallpaper(item)" @tap="navToWallpaper(item)"
> >
<image <image
:src="getThumbUrl(item.resourceInfo?.url)" :src="getThumbUrl(item.imageUrl)"
mode="aspectFill" mode="aspectFill"
class="wallpaper-img" class="wallpaper-img"
/> />
@@ -190,7 +190,7 @@
@tap="navToAvatar(item)" @tap="navToAvatar(item)"
> >
<image <image
:src="getThumbUrl(item.resourceInfo?.url)" :src="getThumbUrl(item.imageUrl)"
mode="aspectFill" mode="aspectFill"
class="avatar-img" class="avatar-img"
/> />
@@ -221,7 +221,11 @@ import { ref, onMounted, computed } from "vue";
import { getStatusBarHeight } from "@/utils/system"; import { getStatusBarHeight } from "@/utils/system";
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app"; import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user"; 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 { getUserSignInfo, userSignIn } from "@/api/user";
import calendar from "@/utils/lunar"; import calendar from "@/utils/lunar";
@@ -369,8 +373,8 @@ const fetchUserSingInfo = async () => {
const fetchHomeData = async () => { const fetchHomeData = async () => {
try { try {
const [wallpapers, avatars] = await Promise.all([ const [wallpapers, avatars] = await Promise.all([
getRankList("wallpaper"), getRandomRecommendList("wallpaper_download"),
getRankList("avatar"), getRandomRecommendList("avatar_download"),
]); ]);
if (wallpapers && Array.isArray(wallpapers)) { if (wallpapers && Array.isArray(wallpapers)) {
@@ -394,16 +398,14 @@ const navToMake = (item) => {
}; };
const navToWallpaper = (item) => { const navToWallpaper = (item) => {
const imageUrl = encodeURIComponent( const imageUrl = encodeURIComponent(item.imageUrl || "");
item.resourceInfo?.url || item.imageUrl || "",
);
uni.navigateTo({ 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 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}` }); uni.navigateTo({ url: `/pages/avatar/index?${query}` });
}; };
@@ -914,11 +916,11 @@ onShareTimeline(() => {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-right: 24rpx; margin-right: 24rpx;
width: 140rpx; width: 160rpx;
.avatar-img { .avatar-img {
width: 140rpx; width: 160rpx;
height: 140rpx; height: 160rpx;
border-radius: 32rpx; border-radius: 32rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05); box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
@@ -941,8 +943,8 @@ onShareTimeline(() => {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 140rpx; width: 160rpx;
height: 140rpx; height: 160rpx;
background: #d81e06; background: #d81e06;
border-radius: 32rpx; border-radius: 32rpx;
box-shadow: 0 8rpx 24rpx rgba(216, 30, 6, 0.2); box-shadow: 0 8rpx 24rpx rgba(216, 30, 6, 0.2);

View File

@@ -146,6 +146,10 @@ onLoad(async (options) => {
if (options.imageUrl) { if (options.imageUrl) {
detailData.value.imageUrl = decodeURIComponent(options.imageUrl); detailData.value.imageUrl = decodeURIComponent(options.imageUrl);
} }
if (options.categoryId) {
categoryId.value = options.categoryId;
}
fetchRecommend(options.id); fetchRecommend(options.id);
}); });
@@ -197,7 +201,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 || ""; // categoryId.value = res[0]?.categoryId || "";
} catch (e) { } catch (e) {
console.error("Failed to fetch recommendations", e); console.error("Failed to fetch recommendations", e);
} }