From 6b7d8a6fcdca53dadfb051760e16d1d174f1a878 Mon Sep 17 00:00:00 2001 From: davy Date: Mon, 7 Apr 2025 10:52:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=BC=80=E5=B1=8F?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 166 +++++++++++++++++++++++++++++++++++------- 1 file changed, 141 insertions(+), 25 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 5356e07..4bd9835 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -74,17 +74,33 @@ --> - - - - - - + + + + + + + + - + + + @@ -126,6 +142,7 @@ loading: false, finished: false, navItems: ['新酒上市', '生成酒单', '酒币换购', '关注厂牌'], + currentAdIndex: 0, // 当前广告索引 }; }, created() { @@ -231,21 +248,28 @@ } else if (it.bannerType == 'homeBanner') { // 首页banner this.homeBanner.push(it) } - }) - let showHomeAD = uni.getStorageSync('showHomeAD') - if (!showHomeAD) { - - this.$refs.ADRef.open() - - } - + // 检查是否需要显示开屏广告 + this.checkShowAD() }) }, + // 检查是否需要显示开屏广告 + checkShowAD() { + if (this.ADList.length === 0) return + + const currentSession = uni.getStorageSync('currentSession') + const newSession = Date.now() + + // 每次打开小程序都显示广告 + if (!currentSession || currentSession !== newSession) { + this.$refs.ADRef.open() + // 记录本次会话时间 + uni.setStorageSync('currentSession', newSession) + } + }, // 关闭广告 closeAd() { - uni.setStorageSync('showHomeAD', true) this.$refs.ADRef.close() }, handleAD(item) { @@ -256,13 +280,6 @@ }) } }, - // 立即认证门店 - toJoin() { - if (!this.bannerJoin) return - uni.navigateTo({ - url: this.bannerJoin.bannerLink, - }) - }, // 跳转专辑页 toFeaturePage(item) { uni.navigateTo({ @@ -393,6 +410,12 @@ url: "/pagesActivity/activityDetail?id=" + item.id }) }, + handlePopupChange(e) { + this.currentAdIndex = e.detail.current; + }, + handleAdSwiperChange(e) { + this.currentAdIndex = e.detail.current; + }, } } @@ -692,4 +715,97 @@ background-position: 0 50%; } } + + .ad-container { + position: relative; + width: 750rpx; + height: 70vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + animation: fadeIn 0.3s ease; + padding: 0 40rpx; + box-sizing: border-box; + } + + .ad-swiper { + width: 100%; + height: 85%; + overflow: visible; + } + + .ad-swiper-item { + box-sizing: border-box; + transition: all 0.3s ease; + transform: scale(0.85); + opacity: 0.6; + + &.active { + transform: scale(1); + opacity: 1; + } + } + + .ad-image-container { + width: 100%; + height: 100%; + position: relative; + border-radius: 30rpx; + overflow: hidden; + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15); + } + + .ad-image { + width: 100%; + height: 100%; + border-radius: 30rpx; + will-change: transform; + backface-visibility: hidden; + transform: translateZ(0); + } + + .ad-close { + margin-top: 40rpx; + width: 72rpx; + height: 72rpx; + display: flex; + justify-content: center; + align-items: center; + background: rgba(255, 255, 255, 0.15); + border-radius: 50%; + backdrop-filter: blur(10px); + transition: all 0.3s ease; + + .cuIcon-roundclose { + font-size: 44rpx; + color: #FFFFFF; + text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2); + } + + &:active { + transform: scale(0.9); + opacity: 0.8; + background: rgba(255, 255, 255, 0.25); + } + } + + /deep/ .uni-swiper-dots { + bottom: -20rpx !important; + + .uni-swiper-dot { + width: 12rpx !important; + height: 12rpx !important; + border-radius: 6rpx !important; + margin: 0 6rpx !important; + transition: all 0.3s ease !important; + background: rgba(255, 255, 255, 0.3) !important; + + &.uni-swiper-dot-active { + width: 28rpx !important; + background-color: #FFFFFF !important; + box-shadow: 0 2rpx 8rpx rgba(255, 255, 255, 0.3); + } + } + } \ No newline at end of file