796b6df0 by simon

默认提交

1 parent daf3eb67
...@@ -41,6 +41,10 @@ Page({ ...@@ -41,6 +41,10 @@ Page({
41 let title = detailData && detailData.videoName || ""; 41 let title = detailData && detailData.videoName || "";
42 let path = `pages/detail/detail?c=${detailData.videoCode}`; 42 let path = `pages/detail/detail?c=${detailData.videoCode}`;
43 let imageUrl = detailData && detailData.thumbnail || ""; 43 let imageUrl = detailData && detailData.thumbnail || "";
44 if (app.globalData.adConfigure && app.globalData.adConfigure.ad_config_01 == 1) {
45 this.showInterstitialAd();
46 }
47
44 return { 48 return {
45 title, 49 title,
46 path, 50 path,
...@@ -70,6 +74,8 @@ Page({ ...@@ -70,6 +74,8 @@ Page({
70 '页面名字': '视频详情页' 74 '页面名字': '视频详情页'
71 }); 75 });
72 76
77
78 this.checkPlayTimes().then((result) => {
73 if (wx.createRewardedVideoAd) { 79 if (wx.createRewardedVideoAd) {
74 rewardedVideoAd = wx.createRewardedVideoAd({ 80 rewardedVideoAd = wx.createRewardedVideoAd({
75 adUnitId: 'adunit-3e849f70e28e6c21' 81 adUnitId: 'adunit-3e849f70e28e6c21'
...@@ -84,16 +90,45 @@ Page({ ...@@ -84,16 +90,45 @@ Page({
84 console.log('onClose event emit', res) 90 console.log('onClose event emit', res)
85 }) 91 })
86 } 92 }
87 this.checkShowVideoAd(); 93 this.showVideoAd();
94 });
95
96 this.addInterstitialAd();
97 },
98
99 addInterstitialAd() {
100 if (wx.createInterstitialAd) {
101 interstitialAd = wx.createInterstitialAd({
102 adUnitId: 'adunit-1ffb5a60bc3f7f55'
103 })
104 interstitialAd.onLoad(() => {})
105 interstitialAd.onError((err) => {})
106 interstitialAd.onClose(() => {})
107 }
108 },
109
110 showInterstitialAd() {
111 if (interstitialAd) {
112 interstitialAd.show().catch((err) => {
113 console.error(err)
114 })
115 }
88 }, 116 },
89 117
90 checkShowVideoAd() { 118 checkPlayTimes() {
119 return new Promise((resolve, reject) => {
91 if (app.globalData.adConfigure && app.globalData.adConfigure.configureN > 0) { 120 if (app.globalData.adConfigure && app.globalData.adConfigure.configureN > 0) {
92 if (app.globalData.videoPlayTimes >= app.globalData.adConfigure.configureN) { 121 if (app.globalData.videoPlayTimes >= app.globalData.adConfigure.configureN) {
93 console.log("app.globalData.videoPlayTimes:", app.globalData.videoPlayTimes);
94 // if (app.globalData.videoPlayTimes > 1) {
95 app.globalData.videoPlayTimes = 0; 122 app.globalData.videoPlayTimes = 0;
123 resolve();
124 }
125 }
126 })
127
128 },
96 129
130 showVideoAd() {
131 app.globalData.videoPlayTimes = 0;
97 rewardedVideoAd.show() 132 rewardedVideoAd.show()
98 // 用户触发广告后,显示激励视频广告 133 // 用户触发广告后,显示激励视频广告
99 if (rewardedVideoAd) { 134 if (rewardedVideoAd) {
...@@ -106,8 +141,6 @@ Page({ ...@@ -106,8 +141,6 @@ Page({
106 }) 141 })
107 }) 142 })
108 } 143 }
109 }
110 }
111 }, 144 },
112 145
113 /** 146 /**
...@@ -260,11 +293,60 @@ Page({ ...@@ -260,11 +293,60 @@ Page({
260 size: this.data.size, 293 size: this.data.size,
261 }, 294 },
262 }).then((result) => { 295 }).then((result) => {
296 let {
297 adConfigure,
298 } = this.data;
263 let dataList = result.list; 299 let dataList = result.list;
264 dataList = this.data.dataList.concat(dataList); 300 dataList = this.data.dataList.concat(dataList);
265 // console.log("dataList:", dataList); 301
302
303
304 // 带广告的格式
305 let dataListResult = [];
306
307 // 广告步进
308 let adStep = adConfigure.configureM || 0;
309
310 // 视频广告第一次出现条目
311 let firstAdIndex = adConfigure.configureX || 0;
312 // 视频广告第一条是否已经出现
313 let isFirstAdshow = false;
314
315 // 广告步数
316 let adStepIndex = 0;
317
318 // 洗列表格式
319 dataList.forEach((element, idx) => {
320 // 视频
321 if (isFirstAdshow) {
322 // 第一个视频出现过
323 if (adStepIndex > adStep && adStep != 0) {
324 adStepIndex = 0;
325 dataListResult.push({
326 type: "ad",
327 adType: "banner"
328 })
329 }
330 } else {
331 // 第一个视频出现
332 if (adStepIndex == firstAdIndex && firstAdIndex > 0) {
333 isFirstAdshow = true;
334 adStepIndex = 0;
335 dataListResult.push({
336 type: "ad",
337 adType: "video"
338 })
339 }
340 }
341 adStepIndex++;
342
343 dataListResult.push(element);
344 // console.log("dataListResult:", dataListResult);
345 });
346
266 this.setData({ 347 this.setData({
267 dataList: dataList, 348 dataList: dataList,
349 dataListResult: dataListResult,
268 total: result.total 350 total: result.total
269 }) 351 })
270 resolve(); 352 resolve();
......
...@@ -2,7 +2,7 @@ import { ...@@ -2,7 +2,7 @@ import {
2 getBindtapData 2 getBindtapData
3 } from '../../utils/util' 3 } from '../../utils/util'
4 4
5 5 let interstitialAd = null
6 6
7 7
8 let app = getApp(); 8 let app = getApp();
...@@ -48,6 +48,10 @@ Page({ ...@@ -48,6 +48,10 @@ Page({
48 primaryCode: this.data.curTab.tabCode, 48 primaryCode: this.data.curTab.tabCode,
49 }); 49 });
50 } 50 }
51 if (app.globalData.adConfigure && app.globalData.adConfigure.ad_config_01 == 1) {
52 this.showInterstitialAd();
53 }
54
51 }, 55 },
52 showAuth() { 56 showAuth() {
53 this.setData({ 57 this.setData({
...@@ -67,8 +71,32 @@ Page({ ...@@ -67,8 +71,32 @@ Page({
67 wx.aldstat.sendEvent('进入页面', { 71 wx.aldstat.sendEvent('进入页面', {
68 '页面名字': '首页' 72 '页面名字': '首页'
69 }); 73 });
74 this.addInterstitialAd();
75 if (app.globalData.adConfigure && app.globalData.adConfigure.ad_config_02 == 1) {
76 this.showInterstitialAd();
77 }
70 78
71 }, 79 },
80
81 addInterstitialAd() {
82 if (wx.createInterstitialAd) {
83 interstitialAd = wx.createInterstitialAd({
84 adUnitId: 'adunit-1ffb5a60bc3f7f55'
85 })
86 interstitialAd.onLoad(() => {})
87 interstitialAd.onError((err) => {})
88 interstitialAd.onClose(() => {})
89 }
90 },
91
92 showInterstitialAd() {
93 if (interstitialAd) {
94 interstitialAd.show().catch((err) => {
95 console.error(err)
96 })
97 }
98 },
99
72 initData() { 100 initData() {
73 this.queryAdConfigure().then((result) => { 101 this.queryAdConfigure().then((result) => {
74 this.queryTabList().then((result) => { 102 this.queryTabList().then((result) => {
......
...@@ -26,10 +26,12 @@ Page({ ...@@ -26,10 +26,12 @@ Page({
26 primaryCode: this.data.options.c, 26 primaryCode: this.data.options.c,
27 }); 27 });
28 } 28 }
29
30
31 let opts = this.data.options; 29 let opts = this.data.options;
32 let path = `pages/personal-list/personal-list?c=${opts.c}`; 30 let path = `pages/personal-list/personal-list?c=${opts.c}`;
31 if (app.globalData.adConfigure && app.globalData.adConfigure.ad_config_01 == 1) {
32 this.showInterstitialAd();
33 }
34
33 return { 35 return {
34 path, 36 path,
35 } 37 }
...@@ -49,7 +51,28 @@ Page({ ...@@ -49,7 +51,28 @@ Page({
49 wx.aldstat.sendEvent('进入页面', { 51 wx.aldstat.sendEvent('进入页面', {
50 '页面名字': '个人列表页' 52 '页面名字': '个人列表页'
51 }); 53 });
54 this.addInterstitialAd();
52 }, 55 },
56
57 addInterstitialAd() {
58 if (wx.createInterstitialAd) {
59 interstitialAd = wx.createInterstitialAd({
60 adUnitId: 'adunit-1ffb5a60bc3f7f55'
61 })
62 interstitialAd.onLoad(() => {})
63 interstitialAd.onError((err) => {})
64 interstitialAd.onClose(() => {})
65 }
66 },
67
68 showInterstitialAd() {
69 if (interstitialAd) {
70 interstitialAd.show().catch((err) => {
71 console.error(err)
72 })
73 }
74 },
75
53 initData() { 76 initData() {
54 this.resetPage(); 77 this.resetPage();
55 this.queryAccountDetail(); 78 this.queryAccountDetail();
......
...@@ -39,6 +39,11 @@ Page({ ...@@ -39,6 +39,11 @@ Page({
39 let title = detailData && detailData.videoName || ""; 39 let title = detailData && detailData.videoName || "";
40 let path = `pages/detail/detail?c=${detailData.videoCode}`; 40 let path = `pages/detail/detail?c=${detailData.videoCode}`;
41 let imageUrl = detailData && detailData.thumbnail || ""; 41 let imageUrl = detailData && detailData.thumbnail || "";
42
43 if (app.globalData.adConfigure && app.globalData.adConfigure.ad_config_01 == 1) {
44 this.showInterstitialAd();
45 }
46
42 return { 47 return {
43 title, 48 title,
44 path, 49 path,
...@@ -59,6 +64,26 @@ Page({ ...@@ -59,6 +64,26 @@ Page({
59 wx.aldstat.sendEvent('进入页面', { 64 wx.aldstat.sendEvent('进入页面', {
60 '页面名字': '隐藏视频页' 65 '页面名字': '隐藏视频页'
61 }); 66 });
67 this.addInterstitialAd();
68 },
69
70 addInterstitialAd() {
71 if (wx.createInterstitialAd) {
72 interstitialAd = wx.createInterstitialAd({
73 adUnitId: 'adunit-1ffb5a60bc3f7f55'
74 })
75 interstitialAd.onLoad(() => {})
76 interstitialAd.onError((err) => {})
77 interstitialAd.onClose(() => {})
78 }
79 },
80
81 showInterstitialAd() {
82 if (interstitialAd) {
83 interstitialAd.show().catch((err) => {
84 console.error(err)
85 })
86 }
62 }, 87 },
63 88
64 /** 89 /**
......