fix: wteail detail

This commit is contained in:
zzc
2026-01-28 21:37:37 +08:00
parent c0a4423124
commit fb68e87624
2 changed files with 117 additions and 131 deletions

View File

@@ -13,109 +13,107 @@
</view>
</view>
<scroll-view scroll-y class="content-scroll">
<view class="content-container">
<!-- Sharer Info -->
<view class="sharer-info" v-if="detailData.from">
<image
:src="detailData.from.avatar || '/static/default-avatar.png'"
class="avatar"
mode="aspectFill"
/>
<view class="info-text">
<view class="nickname">{{
detailData.from.nickname || "神秘好友"
}}</view>
<view class="action-text">给你分享了一张2026新春精美壁纸</view>
<view class="sub-text"> 2026 且马贺岁</view>
</view>
</view>
<!-- Wallpaper Preview -->
<view class="preview-card">
<view class="preview-badge">PREVIEW</view>
<image
:src="detailData.imageUrl"
mode="widthFix"
class="main-image"
@tap="previewImage"
/>
</view>
<!-- Action Buttons -->
<view class="action-buttons">
<button class="btn primary-btn" @tap="goToIndex">
<text class="btn-icon"></text>
<text>我也要领同款壁纸</text>
</button>
</view>
<!-- More Wallpapers -->
<view class="more-section">
<view class="section-header">
<text class="section-title">更多精美新春壁纸</text>
<view class="more-link" @tap="goToIndex">
<text>查看更多</text>
<text class="arrow"></text>
</view>
</view>
<view class="more-grid">
<view
v-for="(item, index) in recommendList"
:key="index"
class="grid-item"
@tap="onRecommendClick(item)"
>
<image :src="item.imageUrl" mode="aspectFill" class="grid-img" />
<text class="item-title">{{ item.title || "新春壁纸" }}</text>
</view>
</view>
</view>
<!-- Fortune Banner -->
<!-- Wallpaper Banner -->
<view class="wallpaper-banner" @tap="goToFortune">
<view class="banner-icon">
<text>🏮</text>
</view>
<view class="banner-content">
<text class="banner-title">去抽取新年运势</text>
<text class="banner-desc">每日一签开启你的新年好运</text>
</view>
<text class="banner-arrow"></text>
</view>
<view class="wallpaper-banner" @tap="goToGreeting">
<view class="banner-icon">
<text>🧧</text>
</view>
<view class="banner-content">
<text class="banner-title">去制作新年贺卡</text>
<text class="banner-desc">定制专属祝福传递浓浓年味</text>
</view>
<text class="banner-arrow"></text>
</view>
<view class="wallpaper-banner" @tap="goToAvatar">
<view class="banner-icon">
<text>🖼</text>
</view>
<view class="banner-content">
<text class="banner-title">去挑选新年头像</text>
<text class="banner-desc">精选新年头像让手机也过年</text>
</view>
<text class="banner-arrow"></text>
</view>
<!-- Footer -->
<view class="footer">
<view class="footer-divider">
<view class="line"></view>
<text class="footer-text">2026 HAPPY NEW YEAR</text>
<view class="line"></view>
</view>
<view class="footer-sub">新春祝福 · 传递温情</view>
<view class="content-container">
<!-- Sharer Info -->
<view class="sharer-info" v-if="detailData.from">
<image
:src="detailData.from.avatar || '/static/default-avatar.png'"
class="avatar"
mode="aspectFill"
/>
<view class="info-text">
<view class="nickname">{{
detailData.from.nickname || "神秘好友"
}}</view>
<view class="action-text">给你分享了一张2026新春精美壁纸</view>
<view class="sub-text"> 2026 且马贺岁</view>
</view>
</view>
</scroll-view>
<!-- Wallpaper Preview -->
<view class="preview-card">
<view class="preview-badge">PREVIEW</view>
<image
:src="detailData.imageUrl"
mode="widthFix"
class="main-image"
@tap="previewImage"
/>
</view>
<!-- Action Buttons -->
<view class="action-buttons">
<button class="btn primary-btn" @tap="goToIndex">
<text class="btn-icon"></text>
<text>我也要领同款壁纸</text>
</button>
</view>
<!-- More Wallpapers -->
<view class="more-section">
<view class="section-header">
<text class="section-title">更多精美新春壁纸</text>
<view class="more-link" @tap="goToIndex">
<text>查看更多</text>
<text class="arrow"></text>
</view>
</view>
<view class="more-grid">
<view
v-for="(item, index) in recommendList"
:key="index"
class="grid-item"
@tap="onRecommendClick(item)"
>
<image :src="item.imageUrl" mode="aspectFill" class="grid-img" />
<text class="item-title">{{ item.title || "新春壁纸" }}</text>
</view>
</view>
</view>
<!-- Fortune Banner -->
<!-- Wallpaper Banner -->
<view class="wallpaper-banner" @tap="goToFortune">
<view class="banner-icon">
<text>🏮</text>
</view>
<view class="banner-content">
<text class="banner-title">去抽取新年运势</text>
<text class="banner-desc">每日一签开启你的新年好运</text>
</view>
<text class="banner-arrow"></text>
</view>
<view class="wallpaper-banner" @tap="goToGreeting">
<view class="banner-icon">
<text>🧧</text>
</view>
<view class="banner-content">
<text class="banner-title">去制作新年贺卡</text>
<text class="banner-desc">定制专属祝福传递浓浓年味</text>
</view>
<text class="banner-arrow"></text>
</view>
<view class="wallpaper-banner" @tap="goToAvatar">
<view class="banner-icon">
<text>🖼</text>
</view>
<view class="banner-content">
<text class="banner-title">去挑选新年头像</text>
<text class="banner-desc">精选新年头像让手机也过年</text>
</view>
<text class="banner-arrow"></text>
</view>
<!-- Footer -->
<view class="footer">
<view class="footer-divider">
<view class="line"></view>
<text class="footer-text">2026 HAPPY NEW YEAR</text>
<view class="line"></view>
</view>
<view class="footer-sub">新春祝福 · 传递温情</view>
</view>
</view>
</view>
</template>
@@ -124,7 +122,7 @@ import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { getBavBarHeight } from "@/utils/system";
import { getPageDetail } from "@/api/system";
import { getWallpaperList } from "@/api/wallpaper";
import { getWallpaperRecommendList } from "@/api/wallpaper";
import { saveViewRequest } from "@/utils/common.js";
const navHeight = getBavBarHeight();
@@ -162,13 +160,8 @@ const fetchDetail = async () => {
const fetchRecommend = async () => {
try {
// Try to get wallpapers. Assuming empty category returns a default list or we use a known category if available.
// For now, passing empty string as categoryId.
const res = await getWallpaperList("", 1);
if (res && res.list) {
// Take first 3 items
recommendList.value = res.list.slice(0, 3);
}
const res = await getWallpaperRecommendList();
recommendList.value = res;
} catch (e) {
console.error("Failed to fetch recommendations", e);
}
@@ -198,22 +191,15 @@ const goToFortune = () => {
};
const previewImage = () => {
if (detailData.value.imageUrl) {
uni.previewImage({
urls: [detailData.value.imageUrl],
});
}
// if (detailData.value.imageUrl) {
// uni.previewImage({
// urls: [detailData.value.imageUrl],
// });
// }
};
const onRecommendClick = (item) => {
// If clicking a recommended item, maybe we just preview it or go to wallpaper list?
// Since this is a "detail" page for a specific share, clicking another wallpaper
// might normally go to its detail, but we don't have a generic detail page logic
// (unless we reuse this page with a new token, but these items might not have tokens).
// Best fallback: Preview it.
uni.previewImage({
urls: [item.imageUrl],
});
const onRecommendClick = () => {
goToIndex();
};
const goToGreeting = () => {
@@ -232,8 +218,6 @@ const goToAvatar = () => {
min-height: 100vh;
background: #ffffff;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.nav-bar {
@@ -242,7 +226,7 @@ const goToAvatar = () => {
left: 0;
width: 100%;
z-index: 100;
background-color: transparent; // Make it transparent as per design
background-color: #ffffff;
.nav-content {
height: 44px; // Standard nav height
@@ -274,11 +258,6 @@ const goToAvatar = () => {
}
}
.content-scroll {
flex: 1;
height: 0; // Important for scroll-view in flex container
}
.content-container {
padding: 20px;
padding-bottom: 40px;