diff --git a/images/1.jpg b/images/1.jpg index 1a1a832..b356b20 100644 Binary files a/images/1.jpg and b/images/1.jpg differ diff --git a/images/2.jpg b/images/2.jpg index 79bfb8e..0658315 100644 Binary files a/images/2.jpg and b/images/2.jpg differ diff --git a/images/3.jpg b/images/3.jpg new file mode 100644 index 0000000..b390174 Binary files /dev/null and b/images/3.jpg differ diff --git a/images/4.jpg b/images/4.jpg new file mode 100644 index 0000000..29f81ad Binary files /dev/null and b/images/4.jpg differ diff --git a/pages/index/index.js b/pages/index/index.js index 1869f30..2e92a52 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -632,22 +632,34 @@ Page({ // 广告点击事件处理 onAdClick: function(e) { - const adData = e.currentTarget.dataset.ad - console.log('广告被点击, 广告ID:', adData ? adData.id : 'unknown') + const adSlot = e.currentTarget.dataset.ad; + let imageSrc = e.currentTarget.dataset.src; - if (adData && adData.adType) { + // 如果没有从data-src获取到,尝试从图片元素直接获取src + if (!imageSrc) { + imageSrc = e.currentTarget.src; + } + + console.log('广告被点击, 广告位:', adSlot); + console.log('广告图片路径:', imageSrc); + + // 直接预览广告图片(单击触发) + const validImageUrls = [imageSrc]; + + if (validImageUrls.length > 0 && validImageUrls[0]) { + this.setData({ + previewImageUrls: validImageUrls, + previewImageIndex: 0, + showImagePreview: true + }); + console.log('广告图片预览已打开,图片URL:', validImageUrls[0]); + } else { + console.error('无法获取广告图片路径'); wx.showToast({ - title: '广告位: ' + adData.adType, - icon: 'none', - duration: 2000 - }) - - if (adData.adType === 'full_card') { - console.log('完整卡片广告被点击') - } else if (adData.adType === 'half_image') { - console.log('半高图片广告被点击') - } - } + title: '图片加载失败', + icon: 'none' + }); + } }, // 加载商品分类列表 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index bcaae89..84e6455 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -157,16 +157,20 @@ - + - + + + + + + + + + + + @@ -190,9 +194,6 @@ bindload="onImageLoad" data-index="{{index}}" data-column="left" - bindtap="previewImage" - data-item="{{item}}" - data-index="0" > 预售 现货 @@ -224,10 +225,11 @@ @@ -251,9 +253,6 @@ bindload="onImageLoad" data-index="{{index}}" data-column="right" - bindtap="previewImage" - data-item="{{item}}" - data-index="0" > 预售 现货 diff --git a/pages/index/index.wxss b/pages/index/index.wxss index abfc779..a9d0581 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1492,6 +1492,12 @@ wx-button:not([size=mini]) { z-index: 1001; } +/* 轮播广告样式 */ +.ad-swiper { + width: 100%; + height: 100%; +} + .ad-image { width: 100%; height: 350rpx; diff --git a/pages/profile/index.wxml b/pages/profile/index.wxml index b801c76..623a318 100644 --- a/pages/profile/index.wxml +++ b/pages/profile/index.wxml @@ -7,7 +7,6 @@ > {{userInfo.phoneNumber|| '未登录'}} - 当前身份: {{userType || '未设置'}} @@ -24,7 +23,7 @@ type="primary" style="margin: 20rpx 0;" > - 授权手机号 + 授权登录 @@ -37,7 +36,7 @@ - 收藏 + 收藏夹