默认提交
Showing
7 changed files
with
218 additions
and
36 deletions
... | @@ -69,6 +69,8 @@ App({ | ... | @@ -69,6 +69,8 @@ App({ |
69 | }) | 69 | }) |
70 | } | 70 | } |
71 | }) | 71 | }) |
72 | |||
73 | |||
72 | }, | 74 | }, |
73 | globalData: { | 75 | globalData: { |
74 | share: false, | 76 | share: false, |
... | @@ -76,7 +78,9 @@ App({ | ... | @@ -76,7 +78,9 @@ App({ |
76 | userInfo: null, | 78 | userInfo: null, |
77 | wxcode: store.getItem("wxcode"), | 79 | wxcode: store.getItem("wxcode"), |
78 | tlMemberCode: "", | 80 | tlMemberCode: "", |
81 | adConfigure: {}, | ||
79 | videoPlayTimes: 0, | 82 | videoPlayTimes: 0, |
83 | blessPlayTimes: 0, | ||
80 | }, | 84 | }, |
81 | //重写分享方法 | 85 | //重写分享方法 |
82 | share: function () { | 86 | share: function () { | ... | ... |
... | @@ -10,6 +10,7 @@ import Poster from '../../miniprogram_dist/poster/poster'; | ... | @@ -10,6 +10,7 @@ import Poster from '../../miniprogram_dist/poster/poster'; |
10 | let calendar = require('../../utils/calendar.js'); | 10 | let calendar = require('../../utils/calendar.js'); |
11 | const innerAudio = wx.createInnerAudioContext(); | 11 | const innerAudio = wx.createInnerAudioContext(); |
12 | 12 | ||
13 | let rewardedVideoAd = null | ||
13 | 14 | ||
14 | let app = getApp(); | 15 | let app = getApp(); |
15 | Page({ | 16 | Page({ |
... | @@ -80,7 +81,7 @@ Page({ | ... | @@ -80,7 +81,7 @@ Page({ |
80 | shareType = res.target.dataset.data || ""; | 81 | shareType = res.target.dataset.data || ""; |
81 | console.log("shareType:", shareType); | 82 | console.log("shareType:", shareType); |
82 | if (shareType) { | 83 | if (shareType) { |
83 | console.log("shareType222:",shareType); | 84 | console.log("shareType222:", shareType); |
84 | title = `${ownerMember.memberName}邀请您组队发祝福!体验今年最火爆的拜年方式` | 85 | title = `${ownerMember.memberName}邀请您组队发祝福!体验今年最火爆的拜年方式` |
85 | wx.aldstat.sendEvent('拜年页分享', { | 86 | wx.aldstat.sendEvent('拜年页分享', { |
86 | '分享': '邀请分享' | 87 | '分享': '邀请分享' |
... | @@ -235,6 +236,11 @@ Page({ | ... | @@ -235,6 +236,11 @@ Page({ |
235 | joinRoomDialogVisibleUnAuth: true, | 236 | joinRoomDialogVisibleUnAuth: true, |
236 | }) | 237 | }) |
237 | } | 238 | } |
239 | } else { | ||
240 | |||
241 | } | ||
242 | if (ownerMember.mySelf == 1) { | ||
243 | app.globalData.blessPlayTimes++; | ||
238 | } | 244 | } |
239 | }); | 245 | }); |
240 | console.log("memberCode:", app.store.getItem("memberCode")); | 246 | console.log("memberCode:", app.store.getItem("memberCode")); |
... | @@ -242,8 +248,50 @@ Page({ | ... | @@ -242,8 +248,50 @@ Page({ |
242 | wx.aldstat.sendEvent('进入页面', { | 248 | wx.aldstat.sendEvent('进入页面', { |
243 | '页面名字': '拜年详情页' | 249 | '页面名字': '拜年详情页' |
244 | }); | 250 | }); |
251 | |||
252 | if (wx.createRewardedVideoAd) { | ||
253 | rewardedVideoAd = wx.createRewardedVideoAd({ | ||
254 | adUnitId: 'adunit-3e849f70e28e6c21' | ||
255 | }) | ||
256 | rewardedVideoAd.onLoad(() => { | ||
257 | // console.log('onLoad event emit'); | ||
258 | }) | ||
259 | rewardedVideoAd.onError((err) => { | ||
260 | console.log('onError event emit', err) | ||
261 | }) | ||
262 | rewardedVideoAd.onClose((res) => { | ||
263 | // console.log('onClose event emit', res) | ||
264 | }) | ||
265 | } | ||
266 | |||
267 | this.checkShowVideoAd(); | ||
245 | }, | 268 | }, |
246 | 269 | ||
270 | checkShowVideoAd() { | ||
271 | console.log("app.globalData.blessPlayTimes:", app.globalData.blessPlayTimes); | ||
272 | if (app.globalData.adConfigure && app.globalData.adConfigure.configureA > 0) { | ||
273 | if (app.globalData.blessPlayTimes >= app.globalData.adConfigure.configureA) { | ||
274 | // console.log("app.globalData.blessPlayTimes:", app.globalData.blessPlayTimes); | ||
275 | |||
276 | app.globalData.blessPlayTimes = 0; | ||
277 | |||
278 | rewardedVideoAd.show() | ||
279 | // 用户触发广告后,显示激励视频广告 | ||
280 | if (rewardedVideoAd) { | ||
281 | rewardedVideoAd.show().catch(() => { | ||
282 | // 失败重试 | ||
283 | rewardedVideoAd.load() | ||
284 | .then(() => rewardedVideoAd.show()) | ||
285 | .catch(err => { | ||
286 | console.log('激励视频 广告显示失败') | ||
287 | }) | ||
288 | }) | ||
289 | } | ||
290 | } | ||
291 | } | ||
292 | }, | ||
293 | |||
294 | |||
247 | /** | 295 | /** |
248 | * 基础方法 | 296 | * 基础方法 |
249 | * 授权完毕重拉数据用 | 297 | * 授权完毕重拉数据用 |
... | @@ -321,8 +369,7 @@ Page({ | ... | @@ -321,8 +369,7 @@ Page({ |
321 | this.showTips("定制祝福成功!马上邀请您的亲友吧!"); | 369 | this.showTips("定制祝福成功!马上邀请您的亲友吧!"); |
322 | }); | 370 | }); |
323 | }).catch((err) => {}); | 371 | }).catch((err) => {}); |
324 | } else if (res.cancel) { | 372 | } else if (res.cancel) {} |
325 | } | ||
326 | } | 373 | } |
327 | }) | 374 | }) |
328 | }, | 375 | }, |
... | @@ -465,7 +512,6 @@ Page({ | ... | @@ -465,7 +512,6 @@ Page({ |
465 | * 生成海报 | 512 | * 生成海报 |
466 | */ | 513 | */ |
467 | onPosterHandler() { | 514 | onPosterHandler() { |
468 | console.log("onPosterHandler"); | ||
469 | let { | 515 | let { |
470 | detailData | 516 | detailData |
471 | } = this.data; | 517 | } = this.data; |
... | @@ -498,7 +544,6 @@ Page({ | ... | @@ -498,7 +544,6 @@ Page({ |
498 | const { | 544 | const { |
499 | detail | 545 | detail |
500 | } = e; | 546 | } = e; |
501 | console.log("detail:", detail) | ||
502 | this.setData({ | 547 | this.setData({ |
503 | imageUrl: detail, | 548 | imageUrl: detail, |
504 | posterVisible: true, | 549 | posterVisible: true, |
... | @@ -514,7 +559,6 @@ Page({ | ... | @@ -514,7 +559,6 @@ Page({ |
514 | * 异步生成海报 | 559 | * 异步生成海报 |
515 | */ | 560 | */ |
516 | onCreatePoster(posterConfig) { | 561 | onCreatePoster(posterConfig) { |
517 | console.log("posterConfig:", posterConfig); | ||
518 | this.setData({ | 562 | this.setData({ |
519 | posterConfig: posterConfig | 563 | posterConfig: posterConfig |
520 | }, () => { | 564 | }, () => { |
... | @@ -738,7 +782,7 @@ Page({ | ... | @@ -738,7 +782,7 @@ Page({ |
738 | ownerMember, | 782 | ownerMember, |
739 | updateRoomInfo | 783 | updateRoomInfo |
740 | } = this.data; | 784 | } = this.data; |
741 | console.log("updateRoomInfo:", updateRoomInfo); | 785 | // console.log("updateRoomInfo:", updateRoomInfo); |
742 | app.post({ | 786 | app.post({ |
743 | url: app.api.blessUpdateRoom, | 787 | url: app.api.blessUpdateRoom, |
744 | data: { | 788 | data: { |
... | @@ -748,7 +792,7 @@ Page({ | ... | @@ -748,7 +792,7 @@ Page({ |
748 | sentence: updateRoomInfo.sentence || "", | 792 | sentence: updateRoomInfo.sentence || "", |
749 | } | 793 | } |
750 | }).then((result) => { | 794 | }).then((result) => { |
751 | console.log("result:", result); | 795 | // console.log("result:", result); |
752 | this.queryBlessDetail(); | 796 | this.queryBlessDetail(); |
753 | }).catch((err) => {}); | 797 | }).catch((err) => {}); |
754 | }, | 798 | }, |
... | @@ -766,7 +810,7 @@ Page({ | ... | @@ -766,7 +810,7 @@ Page({ |
766 | // tempFilePath可以作为img标签的src属性显示图片 | 810 | // tempFilePath可以作为img标签的src属性显示图片 |
767 | const tempFiles = res.tempFiles | 811 | const tempFiles = res.tempFiles |
768 | let files = tempFiles; | 812 | let files = tempFiles; |
769 | console.log("chooseImage files:", files); | 813 | // console.log("chooseImage files:", files); |
770 | _this.setData({ | 814 | _this.setData({ |
771 | files | 815 | files |
772 | }); | 816 | }); |
... | @@ -790,8 +834,8 @@ Page({ | ... | @@ -790,8 +834,8 @@ Page({ |
790 | }); | 834 | }); |
791 | 835 | ||
792 | this.uploadToCustomService(pics).then((picRes) => { | 836 | this.uploadToCustomService(pics).then((picRes) => { |
793 | console.log("picRes:", picRes); | 837 | // console.log("picRes:", picRes); |
794 | console.log("updateUserInfo:", updateUserInfo); | 838 | // console.log("updateUserInfo:", updateUserInfo); |
795 | app.post({ | 839 | app.post({ |
796 | url: app.api.blessUpdateUserInfo, | 840 | url: app.api.blessUpdateUserInfo, |
797 | data: { | 841 | data: { |
... | @@ -801,7 +845,7 @@ Page({ | ... | @@ -801,7 +845,7 @@ Page({ |
801 | memberHead: picRes[0] || "", | 845 | memberHead: picRes[0] || "", |
802 | } | 846 | } |
803 | }).then((result) => { | 847 | }).then((result) => { |
804 | console.log("result:", result); | 848 | // console.log("result:", result); |
805 | this.queryBlessDetail(); | 849 | this.queryBlessDetail(); |
806 | }).catch((err) => {}); | 850 | }).catch((err) => {}); |
807 | }) | 851 | }) |
... | @@ -913,15 +957,15 @@ Page({ | ... | @@ -913,15 +957,15 @@ Page({ |
913 | blessContent: blessContent, | 957 | blessContent: blessContent, |
914 | isAuth: result.isAuth == 1 | 958 | isAuth: result.isAuth == 1 |
915 | }); | 959 | }); |
916 | console.log("detailData:", result); | 960 | // console.log("detailData:", result); |
917 | console.log("blessContent:", this.data.blessContent); | 961 | // console.log("blessContent:", this.data.blessContent); |
918 | console.log("类型 type => ", result.type == 1 ? "组队" : "单人"); | 962 | // console.log("类型 type => ", result.type == 1 ? "组队" : "单人"); |
919 | console.log("是否已定制 customMade => ", result.customMade == 1 ? "已经定制" : "未定制"); | 963 | // console.log("是否已定制 customMade => ", result.customMade == 1 ? "已经定制" : "未定制"); |
920 | console.log("是否自己房间 mySelf => ", result.ownerMember.mySelf == 1 ? "是" : "否"); | 964 | // console.log("是否自己房间 mySelf => ", result.ownerMember.mySelf == 1 ? "是" : "否"); |
921 | console.log("房主信息 ownerMember => ", result.ownerMember); | 965 | // console.log("房主信息 ownerMember => ", result.ownerMember); |
922 | console.log("是否授权 isAuth =>", this.data.isAuth); | 966 | // console.log("是否授权 isAuth =>", this.data.isAuth); |
923 | console.log("房主信息 =>", result.ownerMember); | 967 | // console.log("房主信息 =>", result.ownerMember); |
924 | console.log("祝福内容 =>", result.blessContent); | 968 | // console.log("祝福内容 =>", result.blessContent); |
925 | resolve(result); | 969 | resolve(result); |
926 | }).catch((err) => { | 970 | }).catch((err) => { |
927 | reject(err); | 971 | reject(err); |
... | @@ -1141,7 +1185,7 @@ Page({ | ... | @@ -1141,7 +1185,7 @@ Page({ |
1141 | data | 1185 | data |
1142 | } = evt.detail; | 1186 | } = evt.detail; |
1143 | if (data && data.evttype && data.evttype == "join") { | 1187 | if (data && data.evttype && data.evttype == "join") { |
1144 | console.log("55555"); | 1188 | // console.log("55555"); |
1145 | } | 1189 | } |
1146 | switch (name) { | 1190 | switch (name) { |
1147 | 1191 | ... | ... |
... | @@ -5,6 +5,9 @@ import { | ... | @@ -5,6 +5,9 @@ import { |
5 | } from '../../utils/util'; | 5 | } from '../../utils/util'; |
6 | 6 | ||
7 | let app = getApp(); | 7 | let app = getApp(); |
8 | |||
9 | let rewardedVideoAd = null | ||
10 | |||
8 | Page({ | 11 | Page({ |
9 | data: { | 12 | data: { |
10 | isOverShare: true, | 13 | isOverShare: true, |
... | @@ -32,8 +35,6 @@ Page({ | ... | @@ -32,8 +35,6 @@ Page({ |
32 | primaryCode: this.data.detailData.videoCode, | 35 | primaryCode: this.data.detailData.videoCode, |
33 | }); | 36 | }); |
34 | } | 37 | } |
35 | |||
36 | |||
37 | let detailData = this.data.detailData; | 38 | let detailData = this.data.detailData; |
38 | let title = detailData && detailData.videoName || ""; | 39 | let title = detailData && detailData.videoName || ""; |
39 | let path = `pages/detail/detail?c=${detailData.videoCode}`; | 40 | let path = `pages/detail/detail?c=${detailData.videoCode}`; |
... | @@ -67,13 +68,54 @@ Page({ | ... | @@ -67,13 +68,54 @@ Page({ |
67 | // } | 68 | // } |
68 | // } | 69 | // } |
69 | // }) | 70 | // }) |
71 | _this.onReplayHandler(); | ||
70 | }).catch((err) => {});; | 72 | }).catch((err) => {});; |
71 | this.initData(); | 73 | this.initData(); |
72 | wx.aldstat.sendEvent('进入页面', { | 74 | wx.aldstat.sendEvent('进入页面', { |
73 | '页面名字': '视频详情页' | 75 | '页面名字': '视频详情页' |
74 | }); | 76 | }); |
77 | |||
78 | |||
79 | if (wx.createRewardedVideoAd) { | ||
80 | rewardedVideoAd = wx.createRewardedVideoAd({ | ||
81 | adUnitId: 'adunit-3e849f70e28e6c21' | ||
82 | }) | ||
83 | rewardedVideoAd.onLoad(() => { | ||
84 | console.log('onLoad event emit'); | ||
85 | }) | ||
86 | rewardedVideoAd.onError((err) => { | ||
87 | console.log('onError event emit', err) | ||
88 | }) | ||
89 | rewardedVideoAd.onClose((res) => { | ||
90 | console.log('onClose event emit', res) | ||
91 | }) | ||
92 | } | ||
93 | |||
94 | this.checkShowVideoAd(); | ||
75 | }, | 95 | }, |
76 | 96 | ||
97 | checkShowVideoAd() { | ||
98 | if (app.globalData.adConfigure && app.globalData.adConfigure.configureN > 0) { | ||
99 | if (app.globalData.videoPlayTimes >= app.globalData.adConfigure.configureN) { | ||
100 | console.log("app.globalData.videoPlayTimes:", app.globalData.videoPlayTimes); | ||
101 | // if (app.globalData.videoPlayTimes > 1) { | ||
102 | app.globalData.videoPlayTimes = 0; | ||
103 | |||
104 | rewardedVideoAd.show() | ||
105 | // 用户触发广告后,显示激励视频广告 | ||
106 | if (rewardedVideoAd) { | ||
107 | rewardedVideoAd.show().catch(() => { | ||
108 | // 失败重试 | ||
109 | rewardedVideoAd.load() | ||
110 | .then(() => rewardedVideoAd.show()) | ||
111 | .catch(err => { | ||
112 | console.log('激励视频 广告显示失败') | ||
113 | }) | ||
114 | }) | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | }, | ||
77 | 119 | ||
78 | /** | 120 | /** |
79 | * 基础方法 | 121 | * 基础方法 |
... | @@ -219,7 +261,7 @@ Page({ | ... | @@ -219,7 +261,7 @@ Page({ |
219 | }).then((result) => { | 261 | }).then((result) => { |
220 | let dataList = result.list; | 262 | let dataList = result.list; |
221 | dataList = this.data.dataList.concat(dataList); | 263 | dataList = this.data.dataList.concat(dataList); |
222 | console.log("dataList:", dataList); | 264 | // console.log("dataList:", dataList); |
223 | this.setData({ | 265 | this.setData({ |
224 | dataList: dataList, | 266 | dataList: dataList, |
225 | total: result.total | 267 | total: result.total | ... | ... |
... | @@ -284,6 +284,8 @@ Page({ | ... | @@ -284,6 +284,8 @@ Page({ |
284 | this.setData({ | 284 | this.setData({ |
285 | adConfigure: result | 285 | adConfigure: result |
286 | }) | 286 | }) |
287 | app.globalData.adConfigure = result; | ||
288 | |||
287 | resolve(result); | 289 | resolve(result); |
288 | }).catch((err) => { | 290 | }).catch((err) => { |
289 | reject(err) | 291 | reject(err) |
... | @@ -351,23 +353,52 @@ Page({ | ... | @@ -351,23 +353,52 @@ Page({ |
351 | } | 353 | } |
352 | }).then((result) => { | 354 | }).then((result) => { |
353 | let { | 355 | let { |
354 | adConfigure | 356 | adConfigure, |
355 | } = this.data; | 357 | } = this.data; |
358 | let listType = result.type; | ||
356 | let dataList = result.list; | 359 | let dataList = result.list; |
357 | dataList = this.data.dataList.concat(dataList); | 360 | dataList = this.data.dataList.concat(dataList); |
358 | 361 | ||
359 | // 带广告的格式 | 362 | // 带广告的格式 |
360 | let dataListResult = []; | 363 | let dataListResult = []; |
361 | let isFirstAdshow = false; | ||
362 | let firstAdIndex = adConfigure.configureX || 0; | ||
363 | 364 | ||
364 | // 广告步进 | 365 | // 广告步进 |
365 | let adStep = adConfigure.configureM || 0; | 366 | let adStep = adConfigure.configureM || 0; |
367 | |||
368 | // 视频广告第一次出现条目 | ||
369 | let firstAdIndex = adConfigure.configureX || 0; | ||
370 | // 视频广告第一条是否已经出现 | ||
371 | let isFirstAdshow = false; | ||
372 | |||
373 | // 祝福广告第一次出现条目 | ||
374 | let firstAdIndexBless = adConfigure.configureB || 0; | ||
375 | // 祝福广告第一条是否已经出现 | ||
376 | let isFirstAdBlessShow = false; | ||
377 | // console.log("firstAdIndexBless:", firstAdIndexBless); | ||
378 | |||
379 | // 广告步数 | ||
366 | let adStepIndex = 0; | 380 | let adStepIndex = 0; |
381 | |||
367 | // 洗列表格式 | 382 | // 洗列表格式 |
368 | dataList.forEach((element, idx) => { | 383 | dataList.forEach((element, idx) => { |
384 | if (listType == 2) { | ||
385 | // 拜年祝福 | ||
386 | if (isFirstAdBlessShow) { | ||
387 | |||
388 | } else { | ||
389 | if (adStepIndex == firstAdIndexBless && firstAdIndexBless > 0) { | ||
390 | isFirstAdBlessShow = true; | ||
391 | adStepIndex = 0; | ||
392 | dataListResult.push({ | ||
393 | type: "ad", | ||
394 | adType: "banner" | ||
395 | }) | ||
396 | } | ||
397 | } | ||
398 | } else { | ||
399 | // 视频祝福 | ||
369 | if (isFirstAdshow) { | 400 | if (isFirstAdshow) { |
370 | adStepIndex++; | 401 | // 第一个视频出现过 |
371 | if (adStepIndex > adStep && adStep != 0) { | 402 | if (adStepIndex > adStep && adStep != 0) { |
372 | adStepIndex = 0; | 403 | adStepIndex = 0; |
373 | dataListResult.push({ | 404 | dataListResult.push({ |
... | @@ -375,14 +406,20 @@ Page({ | ... | @@ -375,14 +406,20 @@ Page({ |
375 | adType: "banner" | 406 | adType: "banner" |
376 | }) | 407 | }) |
377 | } | 408 | } |
378 | } | 409 | } else { |
379 | if (idx == firstAdIndex && firstAdIndex > 0) { | 410 | // 第一个视频出现 |
411 | if (adStepIndex == firstAdIndex && firstAdIndex > 0) { | ||
380 | isFirstAdshow = true; | 412 | isFirstAdshow = true; |
413 | adStepIndex = 0; | ||
381 | dataListResult.push({ | 414 | dataListResult.push({ |
382 | type: "ad", | 415 | type: "ad", |
383 | adType: "banner" | 416 | adType: "banner" |
384 | }) | 417 | }) |
385 | } | 418 | } |
419 | } | ||
420 | } | ||
421 | adStepIndex++; | ||
422 | |||
386 | dataListResult.push(element); | 423 | dataListResult.push(element); |
387 | }); | 424 | }); |
388 | this.setData({ | 425 | this.setData({ | ... | ... |
... | @@ -26,7 +26,9 @@ | ... | @@ -26,7 +26,9 @@ |
26 | <view class="list"> | 26 | <view class="list"> |
27 | <!-- 拜年item --> | 27 | <!-- 拜年item --> |
28 | <block wx:if="{{listType == 2}}"> | 28 | <block wx:if="{{listType == 2}}"> |
29 | <view wx:for="{{dataList}}" bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" wx:key="index" class="list-bless-item"> | 29 | <block wx:for="{{dataList}}" wx:key="index"> |
30 | <ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad> | ||
31 | <view wx:else bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-bless-item"> | ||
30 | <image class="poster" src="{{item.thumbnail}}" /> | 32 | <image class="poster" src="{{item.thumbnail}}" /> |
31 | <view class="desc-wrap"> | 33 | <view class="desc-wrap"> |
32 | <view class="tit">{{item.blessTitle}}</view> | 34 | <view class="tit">{{item.blessTitle}}</view> |
... | @@ -36,6 +38,7 @@ | ... | @@ -36,6 +38,7 @@ |
36 | </view> | 38 | </view> |
37 | </view> | 39 | </view> |
38 | </block> | 40 | </block> |
41 | </block> | ||
39 | <!-- 视频item --> | 42 | <!-- 视频item --> |
40 | <block wx:else> | 43 | <block wx:else> |
41 | <block wx:for="{{dataList}}" wx:key="index"> | 44 | <block wx:for="{{dataList}}" wx:key="index"> | ... | ... |
... | @@ -12,7 +12,8 @@ Page({ | ... | @@ -12,7 +12,8 @@ Page({ |
12 | size: 10, | 12 | size: 10, |
13 | dataList: [], | 13 | dataList: [], |
14 | options: {}, | 14 | options: {}, |
15 | personInfo: {} | 15 | personInfo: {}, |
16 | // adConfigure: {}, //广告位配置 | ||
16 | }, | 17 | }, |
17 | onShareAppMessage(res) { | 18 | onShareAppMessage(res) { |
18 | if (res.from === 'button') { | 19 | if (res.from === 'button') { |
... | @@ -86,7 +87,7 @@ Page({ | ... | @@ -86,7 +87,7 @@ Page({ |
86 | }, | 87 | }, |
87 | 88 | ||
88 | 89 | ||
89 | onShareItem(evt){ | 90 | onShareItem(evt) { |
90 | let curItem = getBindtapData(evt); | 91 | let curItem = getBindtapData(evt); |
91 | app.stat({ | 92 | app.stat({ |
92 | classify: "share", | 93 | classify: "share", |
... | @@ -131,8 +132,56 @@ Page({ | ... | @@ -131,8 +132,56 @@ Page({ |
131 | }).then((result) => { | 132 | }).then((result) => { |
132 | let dataList = result.list; | 133 | let dataList = result.list; |
133 | dataList = this.data.dataList.concat(dataList); | 134 | dataList = this.data.dataList.concat(dataList); |
135 | |||
136 | // 带广告的格式 | ||
137 | let dataListResult = []; | ||
138 | |||
139 | let adConfigure = app.globalData.adConfigure; | ||
140 | |||
141 | // 广告步进 | ||
142 | let adStep = adConfigure.configureM || 0; | ||
143 | |||
144 | // 视频广告第一次出现条目 | ||
145 | let firstAdIndex = adConfigure.configureX || 0; | ||
146 | // 视频广告第一条是否已经出现 | ||
147 | let isFirstAdshow = false; | ||
148 | |||
149 | // 广告步数 | ||
150 | let adStepIndex = 0; | ||
151 | |||
152 | dataList.forEach(element => { | ||
153 | // 视频祝福 | ||
154 | if (isFirstAdshow) { | ||
155 | // 第一个视频出现过 | ||
156 | if (adStepIndex > adStep && adStep != 0) { | ||
157 | adStepIndex = 0; | ||
158 | dataListResult.push({ | ||
159 | type: "ad", | ||
160 | adType: "banner" | ||
161 | }) | ||
162 | } | ||
163 | } else { | ||
164 | // 第一个视频出现 | ||
165 | if (adStepIndex == firstAdIndex && firstAdIndex > 0) { | ||
166 | isFirstAdshow = true; | ||
167 | adStepIndex = 0; | ||
168 | dataListResult.push({ | ||
169 | type: "ad", | ||
170 | adType: "banner" | ||
171 | }) | ||
172 | } | ||
173 | } | ||
174 | |||
175 | adStepIndex++; | ||
176 | |||
177 | dataListResult.push(element); | ||
178 | |||
179 | }); | ||
180 | |||
181 | |||
182 | |||
134 | this.setData({ | 183 | this.setData({ |
135 | dataList: dataList, | 184 | dataList: dataListResult, |
136 | total: result.total, | 185 | total: result.total, |
137 | }) | 186 | }) |
138 | resolve(result); | 187 | resolve(result); | ... | ... |
... | @@ -10,7 +10,9 @@ | ... | @@ -10,7 +10,9 @@ |
10 | </view> | 10 | </view> |
11 | <view class="content"> | 11 | <view class="content"> |
12 | <view class="list"> | 12 | <view class="list"> |
13 | <view wx:for="{{dataList}}" wx:key="index" class="list-item"> | 13 | <block wx:for="{{dataList}}" wx:key="index"> |
14 | <ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad> | ||
15 | <view wx:else class="list-item"> | ||
14 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> | 16 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video"> |
15 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> | 17 | <image class="img" src="{{item.thumbnail}}" mode="aspectFill" /> |
16 | <view class="tit"> | 18 | <view class="tit"> |
... | @@ -32,6 +34,7 @@ | ... | @@ -32,6 +34,7 @@ |
32 | </button> | 34 | </button> |
33 | </view> | 35 | </view> |
34 | </view> | 36 | </view> |
37 | </block> | ||
35 | </view> | 38 | </view> |
36 | </view> | 39 | </view> |
37 | </view> | 40 | </view> | ... | ... |
-
Please register or sign in to post a comment