默认提交
Showing
6 changed files
with
76 additions
and
6 deletions
| ... | @@ -76,6 +76,7 @@ App({ | ... | @@ -76,6 +76,7 @@ App({ |
| 76 | userInfo: null, | 76 | userInfo: null, |
| 77 | wxcode: store.getItem("wxcode"), | 77 | wxcode: store.getItem("wxcode"), |
| 78 | tlMemberCode: "", | 78 | tlMemberCode: "", |
| 79 | videoPlayTimes: 0, | ||
| 79 | }, | 80 | }, |
| 80 | //重写分享方法 | 81 | //重写分享方法 |
| 81 | share: function () { | 82 | share: function () { | ... | ... |
| ... | @@ -23,6 +23,9 @@ module.exports = { | ... | @@ -23,6 +23,9 @@ module.exports = { |
| 23 | blessUpdateRoom: "/bless/update/info", // 修改房间信息 | 23 | blessUpdateRoom: "/bless/update/info", // 修改房间信息 |
| 24 | blessJoin: "/bless/join", // 加入房间 | 24 | blessJoin: "/bless/join", // 加入房间 |
| 25 | 25 | ||
| 26 | // 广告配置 | ||
| 27 | adConfigure: "/configure", | ||
| 28 | |||
| 26 | /** | 29 | /** |
| 27 | * 通用接口 | 30 | * 通用接口 |
| 28 | * 请求时 "mode"传"custom" | 31 | * 请求时 "mode"传"custom" | ... | ... |
| ... | @@ -51,6 +51,8 @@ Page({ | ... | @@ -51,6 +51,8 @@ Page({ |
| 51 | }) | 51 | }) |
| 52 | }, | 52 | }, |
| 53 | onLoad(options) { | 53 | onLoad(options) { |
| 54 | |||
| 55 | |||
| 54 | let _this = this; | 56 | let _this = this; |
| 55 | this.setData({ | 57 | this.setData({ |
| 56 | options | 58 | options |
| ... | @@ -72,6 +74,7 @@ Page({ | ... | @@ -72,6 +74,7 @@ Page({ |
| 72 | }); | 74 | }); |
| 73 | }, | 75 | }, |
| 74 | 76 | ||
| 77 | |||
| 75 | /** | 78 | /** |
| 76 | * 基础方法 | 79 | * 基础方法 |
| 77 | * 授权完毕重拉数据用 | 80 | * 授权完毕重拉数据用 |
| ... | @@ -147,6 +150,7 @@ Page({ | ... | @@ -147,6 +150,7 @@ Page({ |
| 147 | * 播放开始 | 150 | * 播放开始 |
| 148 | */ | 151 | */ |
| 149 | onVideoPlayHandler(evt) { | 152 | onVideoPlayHandler(evt) { |
| 153 | app.globalData.videoPlayTimes++; | ||
| 150 | // 打点 | 154 | // 打点 |
| 151 | app.stat({ | 155 | app.stat({ |
| 152 | classify: "video", | 156 | classify: "video", | ... | ... |
| ... | @@ -51,6 +51,7 @@ | ... | @@ -51,6 +51,7 @@ |
| 51 | </view> | 51 | </view> |
| 52 | </view> | 52 | </view> |
| 53 | <!-- 广告 --> | 53 | <!-- 广告 --> |
| 54 | <ad unit-id="adunit-c3754721d968fc07"></ad> | ||
| 54 | <!-- 装饰物 --> | 55 | <!-- 装饰物 --> |
| 55 | <view class="decoration"> | 56 | <view class="decoration"> |
| 56 | <image mode="widthFix" src="../../image/detail/decoration_c1.png" /> | 57 | <image mode="widthFix" src="../../image/detail/decoration_c1.png" /> | ... | ... |
| ... | @@ -2,6 +2,9 @@ import { | ... | @@ -2,6 +2,9 @@ import { |
| 2 | getBindtapData | 2 | getBindtapData |
| 3 | } from '../../utils/util' | 3 | } from '../../utils/util' |
| 4 | 4 | ||
| 5 | |||
| 6 | |||
| 7 | |||
| 5 | let app = getApp(); | 8 | let app = getApp(); |
| 6 | Page({ | 9 | Page({ |
| 7 | data: { | 10 | data: { |
| ... | @@ -29,6 +32,7 @@ Page({ | ... | @@ -29,6 +32,7 @@ Page({ |
| 29 | content: "url", | 32 | content: "url", |
| 30 | }, | 33 | }, |
| 31 | ], | 34 | ], |
| 35 | adConfigure: {}, //广告位配置 | ||
| 32 | options: {}, | 36 | options: {}, |
| 33 | config: {}, | 37 | config: {}, |
| 34 | NewYear: false | 38 | NewYear: false |
| ... | @@ -60,13 +64,13 @@ Page({ | ... | @@ -60,13 +64,13 @@ Page({ |
| 60 | ENV: app.config.ENV, | 64 | ENV: app.config.ENV, |
| 61 | NewYear: app.config.ENV == "NewYear" | 65 | NewYear: app.config.ENV == "NewYear" |
| 62 | }) | 66 | }) |
| 63 | // console.log("config:", this.data.config); | ||
| 64 | // console.log("ENV:", this.data.ENV); | ||
| 65 | wx.aldstat.sendEvent('进入页面', { | 67 | wx.aldstat.sendEvent('进入页面', { |
| 66 | '页面名字': '首页' | 68 | '页面名字': '首页' |
| 67 | }); | 69 | }); |
| 70 | |||
| 68 | }, | 71 | }, |
| 69 | initData() { | 72 | initData() { |
| 73 | this.queryAdConfigure().then((result) => { | ||
| 70 | this.queryTabList().then((result) => { | 74 | this.queryTabList().then((result) => { |
| 71 | let { | 75 | let { |
| 72 | options, | 76 | options, |
| ... | @@ -88,11 +92,12 @@ Page({ | ... | @@ -88,11 +92,12 @@ Page({ |
| 88 | curTab: tabList[0] | 92 | curTab: tabList[0] |
| 89 | }) | 93 | }) |
| 90 | } | 94 | } |
| 91 | |||
| 92 | this.resetPage(); | 95 | this.resetPage(); |
| 93 | this.queryBannerList(); | 96 | this.queryBannerList(); |
| 94 | this.queryVideoList(); | 97 | this.queryVideoList(); |
| 95 | }); | 98 | }); |
| 99 | }); | ||
| 100 | |||
| 96 | }, | 101 | }, |
| 97 | /** | 102 | /** |
| 98 | * 到达底部 | 103 | * 到达底部 |
| ... | @@ -268,6 +273,24 @@ Page({ | ... | @@ -268,6 +273,24 @@ Page({ |
| 268 | } | 273 | } |
| 269 | }, | 274 | }, |
| 270 | 275 | ||
| 276 | /**广告配置 */ | ||
| 277 | queryAdConfigure() { | ||
| 278 | return new Promise((resolve, reject) => { | ||
| 279 | app.post({ | ||
| 280 | sid: false, | ||
| 281 | url: app.api.adConfigure, | ||
| 282 | data: {} | ||
| 283 | }).then((result) => { | ||
| 284 | this.setData({ | ||
| 285 | adConfigure: result | ||
| 286 | }) | ||
| 287 | resolve(result); | ||
| 288 | }).catch((err) => { | ||
| 289 | reject(err) | ||
| 290 | }); | ||
| 291 | }); | ||
| 292 | }, | ||
| 293 | |||
| 271 | /** | 294 | /** |
| 272 | * 获取tab列表 | 295 | * 获取tab列表 |
| 273 | */ | 296 | */ |
| ... | @@ -327,10 +350,43 @@ Page({ | ... | @@ -327,10 +350,43 @@ Page({ |
| 327 | tabCode: this.data.curTab.tabCode || "", | 350 | tabCode: this.data.curTab.tabCode || "", |
| 328 | } | 351 | } |
| 329 | }).then((result) => { | 352 | }).then((result) => { |
| 353 | let { | ||
| 354 | adConfigure | ||
| 355 | } = this.data; | ||
| 330 | let dataList = result.list; | 356 | let dataList = result.list; |
| 331 | dataList = this.data.dataList.concat(dataList); | 357 | dataList = this.data.dataList.concat(dataList); |
| 358 | |||
| 359 | // 带广告的格式 | ||
| 360 | let dataListResult = []; | ||
| 361 | let isFirstAdshow = false; | ||
| 362 | let firstAdIndex = adConfigure.configureX || 0; | ||
| 363 | |||
| 364 | // 广告步进 | ||
| 365 | let adStep = adConfigure.configureM || 0; | ||
| 366 | let adStepIndex = 0; | ||
| 367 | // 洗列表格式 | ||
| 368 | dataList.forEach((element, idx) => { | ||
| 369 | if (isFirstAdshow) { | ||
| 370 | adStepIndex++; | ||
| 371 | if (adStepIndex > adStep && adStep != 0) { | ||
| 372 | adStepIndex = 0; | ||
| 373 | dataListResult.push({ | ||
| 374 | type: "ad", | ||
| 375 | adType: "banner" | ||
| 376 | }) | ||
| 377 | } | ||
| 378 | } | ||
| 379 | if (idx == firstAdIndex && firstAdIndex > 0) { | ||
| 380 | isFirstAdshow = true; | ||
| 381 | dataListResult.push({ | ||
| 382 | type: "ad", | ||
| 383 | adType: "banner" | ||
| 384 | }) | ||
| 385 | } | ||
| 386 | dataListResult.push(element); | ||
| 387 | }); | ||
| 332 | this.setData({ | 388 | this.setData({ |
| 333 | dataList: dataList, | 389 | dataList: dataListResult, |
| 334 | total: result.total, | 390 | total: result.total, |
| 335 | queueCode: result.queueCode, | 391 | queueCode: result.queueCode, |
| 336 | listType: result.type | 392 | listType: result.type | ... | ... |
| ... | @@ -30,13 +30,17 @@ | ... | @@ -30,13 +30,17 @@ |
| 30 | <image class="poster" src="{{item.thumbnail}}" /> | 30 | <image class="poster" src="{{item.thumbnail}}" /> |
| 31 | <view class="desc-wrap"> | 31 | <view class="desc-wrap"> |
| 32 | <view class="tit">{{item.blessTitle}}</view> | 32 | <view class="tit">{{item.blessTitle}}</view> |
| 33 | <view class="scene">{{item.type == 0 ? '我的祝福 >> 送' : '组团祝福 >> 送'}}{{item.scene}}</view> | 33 | <view class="scene"> |
| 34 | {{item.type == 0 ? '我的祝福 >> 送' : '组团祝福 >> 送'}}{{item.scene}} | ||
| 35 | </view> | ||
| 34 | </view> | 36 | </view> |
| 35 | </view> | 37 | </view> |
| 36 | </block> | 38 | </block> |
| 37 | <!-- 视频item --> | 39 | <!-- 视频item --> |
| 38 | <block wx:else> | 40 | <block wx:else> |
| 39 | <view wx:for="{{dataList}}" wx:key="index" class="list-item"> | 41 | <block wx:for="{{dataList}}" wx:key="index"> |
| 42 | <ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad> | ||
| 43 | <view wx:else class="list-item"> | ||
| 40 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> | 44 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> |
| 41 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> | 45 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> |
| 42 | <view class="tit"> | 46 | <view class="tit"> |
| ... | @@ -59,6 +63,7 @@ | ... | @@ -59,6 +63,7 @@ |
| 59 | </view> | 63 | </view> |
| 60 | </view> | 64 | </view> |
| 61 | </block> | 65 | </block> |
| 66 | </block> | ||
| 62 | </view> | 67 | </view> |
| 63 | </view> | 68 | </view> |
| 64 | </view> | 69 | </view> | ... | ... |
-
Please register or sign in to post a comment