Skip to content

Commit 3db98d9

Browse files
author
youngboyliu
committed
fix: 广告
1 parent fa31047 commit 3db98d9

27 files changed

+824
-39
lines changed

miniprogram/app.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
"page/ad/smart-ad/smart-ad",
1010
"page/ad/smart-ad/example1/example1",
1111
"page/ad/smart-ad/example2/example2",
12-
"page/ad/smart-ad/example3/example3"
12+
"page/ad/smart-ad/example3/example3",
13+
"page/ad/optimize-ad/optimize-ad",
14+
"page/ad/optimize-ad/home-small-card/home-small-card",
15+
"page/ad/optimize-ad/home-large-card/home-large-card",
16+
"page/ad/optimize-ad/other-small-card/other-small-card",
17+
"page/ad/optimize-ad/other-large-card/other-large-card"
1318
],
1419
"usingComponents": {
1520
"mp-navigation-bar": "/component/navigation-bar/navigation-bar"

miniprogram/image/icon_ad.png

2.92 KB
Loading

miniprogram/image/icon_ad_HL.png

2.77 KB
Loading

miniprogram/image/icon_ad_dark.png

2.32 KB
Loading

miniprogram/page/ad/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ Page({
6363
})
6464
return
6565
}
66+
if (type === 'optimize') {
67+
wx.navigateTo({
68+
url: '/page/ad/optimize-ad/optimize-ad'
69+
})
70+
return
71+
}
6672
const typeMap = {
67-
optimize: '广告调优',
6873
hosting: '广告托管',
6974
custom: '自主开发'
7075
}
7176
wx.showToast({
72-
title: `点击了${typeMap[type]}`,
77+
title: '稍后上线',
7378
icon: 'none'
7479
})
7580
}
7681
})
77-
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// 广告调优测试-首页大卡
2+
Page({
3+
data: {
4+
theme: 'light'
5+
},
6+
7+
onShareAppMessage() {
8+
return {
9+
title: '广告调优测试-首页大卡',
10+
path: 'page/ad/optimize-ad/home-large-card/home-large-card'
11+
}
12+
},
13+
14+
onUnload() {
15+
if (wx.offThemeChange) {
16+
wx.offThemeChange()
17+
}
18+
},
19+
20+
onLoad(options) {
21+
this.setData({
22+
theme: getApp().globalData.theme || 'light'
23+
})
24+
25+
if (wx.onThemeChange) {
26+
wx.onThemeChange(({ theme }) => {
27+
this.setData({ theme })
28+
})
29+
}
30+
},
31+
32+
/**
33+
* 广告加载成功回调
34+
*/
35+
onadload(e) {
36+
console.log('广告加载成功:', e)
37+
},
38+
39+
/**
40+
* 广告加载失败回调
41+
*/
42+
onaderror(e) {
43+
console.log('广告加载失败:', e)
44+
},
45+
46+
/**
47+
* 广告视频结束回调
48+
*/
49+
onvideoended(e) {
50+
console.log('广告视频播放结束:', e)
51+
}
52+
})
53+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"navigationBarTitleText": "广告调优测试-首页大卡",
3+
"renderer": "webview"
4+
}
5+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!--广告调优测试-首页大卡-->
2+
<view class="container" data-weui-theme="{{theme}}">
3+
<!-- 广告调优测试-首页大卡 -->
4+
<view class="ad-section">
5+
<text class="ad-label">广告调优测试-首页大卡</text>
6+
<ad-custom
7+
unit-id="adunit-c34f3ed02619f043"
8+
class="ad-unit"
9+
bindload="onadload"
10+
binderror="onaderror"
11+
bindvideoended="onvideoended"
12+
></ad-custom>
13+
</view>
14+
15+
<!-- 填充内容 -->
16+
<view class="content-section">
17+
<text class="content-title">内容区域</text>
18+
<view class="content-item">
19+
<text class="content-text">这是一段填充内容,用于页面展示。</text>
20+
</view>
21+
<view class="content-item">
22+
<text class="content-text">此页面确保只有一个广告组件,符合一个页面只有一个广告的要求。</text>
23+
</view>
24+
<view class="content-item">
25+
<text class="content-text">小程序广告是微信官方推出的广告组件,支持多种广告形式。</text>
26+
</view>
27+
<view class="content-item">
28+
<text class="content-text">广告调优可以帮助开发者优化广告展示效果,提升用户体验。</text>
29+
</view>
30+
<view class="content-item">
31+
<text class="content-text">首页小卡广告适合在首屏位置展示,能够获得更高的曝光率。</text>
32+
</view>
33+
<view class="content-item">
34+
<text class="content-text">合理的广告布局可以在不影响用户体验的前提下实现流量变现。</text>
35+
</view>
36+
<view class="content-item">
37+
<text class="content-text">广告组件会根据用户特征自动匹配最合适的广告内容。</text>
38+
</view>
39+
<view class="content-item">
40+
<text class="content-text">开发者可以通过回调函数监听广告的加载状态和用户交互行为。</text>
41+
</view>
42+
<view class="content-item">
43+
<text class="content-text">广告收益与曝光量、点击率等多种因素相关。</text>
44+
</view>
45+
<view class="content-item">
46+
<text class="content-text">建议在合适的场景下展示广告,避免过度打扰用户。</text>
47+
</view>
48+
<view class="content-item">
49+
<text class="content-text">持续优化广告展示策略,可以获得更好的变现效果。</text>
50+
</view>
51+
<view class="content-item">
52+
<text class="content-text">感谢您使用微信广告服务,祝您使用愉快!</text>
53+
</view>
54+
</view>
55+
</view>
56+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* 广告调优测试-首页大卡 */
2+
.container {
3+
display: block !important;
4+
padding: 0;
5+
margin: 0;
6+
background-color: #fff;
7+
min-height: auto;
8+
justify-content: initial;
9+
}
10+
11+
.ad-section {
12+
margin: 0;
13+
padding: 0;
14+
background-color: #fff;
15+
}
16+
17+
.ad-label {
18+
display: block;
19+
font-size: 28rpx;
20+
font-weight: bold;
21+
color: #333;
22+
padding: 20rpx;
23+
margin: 0;
24+
text-align: center;
25+
background-color: #fff;
26+
}
27+
28+
.ad-unit {
29+
width: 100%;
30+
display: block;
31+
}
32+
33+
.content-section {
34+
margin: 0;
35+
padding: 20rpx;
36+
background-color: #fff;
37+
}
38+
39+
.content-title {
40+
display: block;
41+
font-size: 32rpx;
42+
font-weight: bold;
43+
color: #333;
44+
margin-bottom: 20rpx;
45+
text-align: center;
46+
}
47+
48+
.content-item {
49+
margin: 20rpx 0;
50+
padding: 20rpx;
51+
background-color: #fafafa;
52+
border-radius: 8rpx;
53+
border-left: 4rpx solid #007aff;
54+
}
55+
56+
.content-text {
57+
font-size: 28rpx;
58+
line-height: 1.6;
59+
color: #666;
60+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// 广告调优测试-首页小卡
2+
Page({
3+
data: {
4+
theme: 'light'
5+
},
6+
7+
onShareAppMessage() {
8+
return {
9+
title: '广告调优测试-首页小卡',
10+
path: 'page/ad/optimize-ad/home-small-card/home-small-card'
11+
}
12+
},
13+
14+
onUnload() {
15+
if (wx.offThemeChange) {
16+
wx.offThemeChange()
17+
}
18+
},
19+
20+
onLoad(options) {
21+
this.setData({
22+
theme: getApp().globalData.theme || 'light'
23+
})
24+
25+
if (wx.onThemeChange) {
26+
wx.onThemeChange(({ theme }) => {
27+
this.setData({ theme })
28+
})
29+
}
30+
},
31+
32+
/**
33+
* 广告加载成功回调
34+
*/
35+
onadload(e) {
36+
console.log('广告加载成功:', e)
37+
},
38+
39+
/**
40+
* 广告加载失败回调
41+
*/
42+
onaderror(e) {
43+
console.log('广告加载失败:', e)
44+
},
45+
46+
/**
47+
* 广告视频结束回调
48+
*/
49+
onvideoended(e) {
50+
console.log('广告视频播放结束:', e)
51+
}
52+
})
53+

0 commit comments

Comments
 (0)