默认提交
Showing
6 changed files
with
118 additions
and
48 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,39 +64,40 @@ Page({ | ... | @@ -60,39 +64,40 @@ 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() { |
70 | this.queryTabList().then((result) => { | 73 | this.queryAdConfigure().then((result) => { |
71 | let { | 74 | this.queryTabList().then((result) => { |
72 | options, | 75 | let { |
73 | tabList | 76 | options, |
74 | } = this.data; | 77 | tabList |
75 | if (options.t == "bless") { | 78 | } = this.data; |
76 | let tabIndex = 0; | 79 | if (options.t == "bless") { |
77 | tabList.forEach((element, idx) => { | 80 | let tabIndex = 0; |
78 | if (element.type == 2) { | 81 | tabList.forEach((element, idx) => { |
79 | tabIndex = idx; | 82 | if (element.type == 2) { |
80 | } | 83 | tabIndex = idx; |
81 | }); | 84 | } |
82 | this.setData({ | 85 | }); |
83 | curTab: tabList[tabIndex], | 86 | this.setData({ |
84 | active: tabIndex | 87 | curTab: tabList[tabIndex], |
85 | }) | 88 | active: tabIndex |
86 | } else { | 89 | }) |
87 | this.setData({ | 90 | } else { |
88 | curTab: tabList[0] | 91 | this.setData({ |
89 | }) | 92 | curTab: tabList[0] |
90 | } | 93 | }) |
91 | 94 | } | |
92 | this.resetPage(); | 95 | this.resetPage(); |
93 | this.queryBannerList(); | 96 | this.queryBannerList(); |
94 | this.queryVideoList(); | 97 | this.queryVideoList(); |
98 | }); | ||
95 | }); | 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,34 +30,39 @@ | ... | @@ -30,34 +30,39 @@ |
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"> |
40 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> | 42 | <ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad> |
41 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> | 43 | <view wx:else class="list-item"> |
42 | <view class="tit"> | 44 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> |
43 | <view class="tit-bg"></view> | 45 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> |
44 | <view class="tit-t1">{{item.videoName}}</view> | 46 | <view class="tit"> |
47 | <view class="tit-bg"></view> | ||
48 | <view class="tit-t1">{{item.videoName}}</view> | ||
49 | </view> | ||
50 | <div class="play"> | ||
51 | <span class="iconfont iconplay"></span> | ||
52 | </div> | ||
45 | </view> | 53 | </view> |
46 | <div class="play"> | 54 | <view class="list-item-func"> |
47 | <span class="iconfont iconplay"></span> | 55 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="user"> |
48 | </div> | 56 | <image class="portrait" mode="aspectFill" src="{{item.headImage}}" /> |
49 | </view> | 57 | <text class="name">{{item.accountName || ""}}</text> |
50 | <view class="list-item-func"> | 58 | </view> |
51 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="user"> | 59 | <button data-data="{{item}}" data-index="{{index}}" class="share" open-type="share" bindtap="onShareItem"> |
52 | <image class="portrait" mode="aspectFill" src="{{item.headImage}}" /> | 60 | <span class="t1 iconfont iconwechat"></span> |
53 | <text class="name">{{item.accountName || ""}}</text> | 61 | <span class="t1">分享</span> |
62 | </button> | ||
54 | </view> | 63 | </view> |
55 | <button data-data="{{item}}" data-index="{{index}}" class="share" open-type="share" bindtap="onShareItem"> | ||
56 | <span class="t1 iconfont iconwechat"></span> | ||
57 | <span class="t1">分享</span> | ||
58 | </button> | ||
59 | </view> | 64 | </view> |
60 | </view> | 65 | </block> |
61 | </block> | 66 | </block> |
62 | </view> | 67 | </view> |
63 | </view> | 68 | </view> | ... | ... |
-
Please register or sign in to post a comment