From f5379b17ef0699233bd915471116ca2a4ece671e Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 29 Aug 2026 09:35:32 +0800 Subject: [PATCH] 1 --- pages/index/index.vue | 218 +++++++++++++++++++++++++++++++++--------- 1 file changed, 171 insertions(+), 47 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index f1e9bc2..04b6e18 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -150,56 +150,34 @@ - - - - - 🔥 ¥{{item.productList[0].originalPrice}} - - {{item.title}} - ¥{{item.productList[0].groupPrice}} - - {{item.productList[0].groupMembers}}人团 - 去拼 - - - - - - 🔥 ¥{{item.productList[0].originalPrice}} - - {{item.title}} - ¥{{item.productList[0].groupPrice}} - - {{item.productList[0].groupMembers}}人团 - 去拼 - - - - - - 🔥 ¥{{item.productList[0].originalPrice}} - - {{item.title}} - ¥{{item.productList[0].groupPrice}} - - {{item.productList[0].groupMembers}}人团 - 去拼 + + + + + + 🔥 ¥{{item.productList && item.productList[0] ? item.productList[0].originalPrice : ''}} + + {{item.title}} + ¥{{item.productList && item.productList[0] ? item.productList[0].groupPrice : ''}} + + {{item.productList && item.productList[0] ? item.productList[0].groupMembers : ''}}人团 + 去拼 + - - + + + + - 🔥 ¥{{item.productList[0].originalPrice}} + 🔥 ¥{{item.productList && item.productList[0] ? item.productList[0].originalPrice : ''}} {{item.title}} - ¥{{item.productList[0].groupPrice}} + ¥{{item.productList && item.productList[0] ? item.productList[0].groupPrice : ''}} - {{item.productList[0].groupMembers}}人团 + {{item.productList && item.productList[0] ? item.productList[0].groupMembers : ''}}人团 去拼 @@ -495,6 +473,14 @@ + + + + + x + + + @@ -549,6 +535,7 @@ import { resolveHomeShareTarget, normalizeShareTargetPath } from '@/utils/sharePath.js' const HOME_AD_IMAGE_CACHE_KEY = 'home_ad_image_cache_v1' + const HOME_POPUP_AD_SHOWN_KEY_PREFIX = 'home_popup_ad_shown_v1' const HOME_AD_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000 const HOME_AD_IMAGE_CACHE_LIMIT = 40 const homeAdImageDownloading = {} @@ -678,6 +665,7 @@ indicatorDots: false, autoplay: true, mallAds: [], + homePopupAd: {}, deliveryItem: [], rejectOrderSubmittingMap: {}, interval: 4000, @@ -723,7 +711,7 @@ pageSize:10, getAreaId: '', putAreaId: '', - paths: ['home_top', 'home_center_left_top', 'home_center_left_bottom', 'home_center_right_top', + paths: ['home_top', 'home_center', 'home_center_left_top', 'home_center_left_bottom', 'home_center_right_top', 'home_center_right_bottom' ], order: '', @@ -794,6 +782,16 @@ return title.indexOf(keyword) > -1 }) }, + homeCenterAds() { + return (this.mallAds || []) + .filter(item => item && item.position != 'home_top' && item.position != 'home_popup') + .slice() + .sort((a, b) => { + const aSort = a.sortOrder === undefined || a.sortOrder === null ? Number.MAX_SAFE_INTEGER : Number(a.sortOrder) + const bSort = b.sortOrder === undefined || b.sortOrder === null ? Number.MAX_SAFE_INTEGER : Number(b.sortOrder) + return aSort - bSort + }) + }, planetHasReminder() { return !!(this.homeReminders && this.homeReminders.planet) }, @@ -1493,6 +1491,45 @@ } return normalized }, + getTodayKey() { + const now = new Date() + const month = String(now.getMonth() + 1).padStart(2, '0') + const day = String(now.getDate()).padStart(2, '0') + return now.getFullYear() + '-' + month + '-' + day + }, + getHomePopupAdShownKey() { + const userId = uni.getStorageSync('id') || 'guest' + return HOME_POPUP_AD_SHOWN_KEY_PREFIX + '_' + userId + '_' + this.getTodayKey() + }, + isHomePopupAdShownToday() { + return !!uni.getStorageSync(this.getHomePopupAdShownKey()) + }, + markHomePopupAdShownToday() { + uni.setStorageSync(this.getHomePopupAdShownKey(), true) + }, + handleHomePopupAd(ad) { + if (!ad || !ad.adImage) return + const imageUrl = this.normalizeAdImageUrl(ad.adImage) + if (!imageUrl || this.isHomePopupAdShownToday()) return + this.homePopupAd = { + ...ad, + adImage: imageUrl, + adDisplayImage: imageUrl + } + this.markHomePopupAdShownToday() + this.$nextTick(() => { + setTimeout(() => { + if (this.$refs.homePopupAdPopup && this.$refs.homePopupAdPopup.open) { + this.$refs.homePopupAdPopup.open() + } + }, 180) + }) + }, + closeHomePopupAd() { + if (this.$refs.homePopupAdPopup && this.$refs.homePopupAdPopup.close) { + this.$refs.homePopupAdPopup.close() + } + }, getHomeAdImageCache() { const cache = uni.getStorageSync(HOME_AD_IMAGE_CACHE_KEY) return cache && typeof cache === 'object' ? cache : {} @@ -1724,6 +1761,7 @@ that.loadStatus = 'nomore'; if (res.code == 200) { that.homeReminders = res.result.homeReminders || {} + that.handleHomePopupAd(res.result.homePopupAd) that.mallAds = res.result.mallAds || [] that.applyCachedAdImages(that.mallAds) for(let i=0;i