63022cc7 by simon

默认提交

1 parent 10738d21
......@@ -69,6 +69,8 @@ App({
})
}
})
},
globalData: {
share: false,
......@@ -76,7 +78,9 @@ App({
userInfo: null,
wxcode: store.getItem("wxcode"),
tlMemberCode: "",
adConfigure: {},
videoPlayTimes: 0,
blessPlayTimes: 0,
},
//重写分享方法
share: function () {
......
......@@ -10,6 +10,7 @@ import Poster from '../../miniprogram_dist/poster/poster';
let calendar = require('../../utils/calendar.js');
const innerAudio = wx.createInnerAudioContext();
let rewardedVideoAd = null
let app = getApp();
Page({
......@@ -80,7 +81,7 @@ Page({
shareType = res.target.dataset.data || "";
console.log("shareType:", shareType);
if (shareType) {
console.log("shareType222:",shareType);
console.log("shareType222:", shareType);
title = `${ownerMember.memberName}邀请您组队发祝福!体验今年最火爆的拜年方式`
wx.aldstat.sendEvent('拜年页分享', {
'分享': '邀请分享'
......@@ -235,6 +236,11 @@ Page({
joinRoomDialogVisibleUnAuth: true,
})
}
} else {
}
if (ownerMember.mySelf == 1) {
app.globalData.blessPlayTimes++;
}
});
console.log("memberCode:", app.store.getItem("memberCode"));
......@@ -242,8 +248,50 @@ Page({
wx.aldstat.sendEvent('进入页面', {
'页面名字': '拜年详情页'
});
if (wx.createRewardedVideoAd) {
rewardedVideoAd = wx.createRewardedVideoAd({
adUnitId: 'adunit-3e849f70e28e6c21'
})
rewardedVideoAd.onLoad(() => {
// console.log('onLoad event emit');
})
rewardedVideoAd.onError((err) => {
console.log('onError event emit', err)
})
rewardedVideoAd.onClose((res) => {
// console.log('onClose event emit', res)
})
}
this.checkShowVideoAd();
},
checkShowVideoAd() {
console.log("app.globalData.blessPlayTimes:", app.globalData.blessPlayTimes);
if (app.globalData.adConfigure && app.globalData.adConfigure.configureA > 0) {
if (app.globalData.blessPlayTimes >= app.globalData.adConfigure.configureA) {
// console.log("app.globalData.blessPlayTimes:", app.globalData.blessPlayTimes);
app.globalData.blessPlayTimes = 0;
rewardedVideoAd.show()
// 用户触发广告后,显示激励视频广告
if (rewardedVideoAd) {
rewardedVideoAd.show().catch(() => {
// 失败重试
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
.catch(err => {
console.log('激励视频 广告显示失败')
})
})
}
}
}
},
/**
* 基础方法
* 授权完毕重拉数据用
......@@ -321,8 +369,7 @@ Page({
this.showTips("定制祝福成功!马上邀请您的亲友吧!");
});
}).catch((err) => {});
} else if (res.cancel) {
}
} else if (res.cancel) {}
}
})
},
......@@ -465,7 +512,6 @@ Page({
* 生成海报
*/
onPosterHandler() {
console.log("onPosterHandler");
let {
detailData
} = this.data;
......@@ -498,7 +544,6 @@ Page({
const {
detail
} = e;
console.log("detail:", detail)
this.setData({
imageUrl: detail,
posterVisible: true,
......@@ -514,7 +559,6 @@ Page({
* 异步生成海报
*/
onCreatePoster(posterConfig) {
console.log("posterConfig:", posterConfig);
this.setData({
posterConfig: posterConfig
}, () => {
......@@ -738,7 +782,7 @@ Page({
ownerMember,
updateRoomInfo
} = this.data;
console.log("updateRoomInfo:", updateRoomInfo);
// console.log("updateRoomInfo:", updateRoomInfo);
app.post({
url: app.api.blessUpdateRoom,
data: {
......@@ -748,7 +792,7 @@ Page({
sentence: updateRoomInfo.sentence || "",
}
}).then((result) => {
console.log("result:", result);
// console.log("result:", result);
this.queryBlessDetail();
}).catch((err) => {});
},
......@@ -766,7 +810,7 @@ Page({
// tempFilePath可以作为img标签的src属性显示图片
const tempFiles = res.tempFiles
let files = tempFiles;
console.log("chooseImage files:", files);
// console.log("chooseImage files:", files);
_this.setData({
files
});
......@@ -790,8 +834,8 @@ Page({
});
this.uploadToCustomService(pics).then((picRes) => {
console.log("picRes:", picRes);
console.log("updateUserInfo:", updateUserInfo);
// console.log("picRes:", picRes);
// console.log("updateUserInfo:", updateUserInfo);
app.post({
url: app.api.blessUpdateUserInfo,
data: {
......@@ -801,7 +845,7 @@ Page({
memberHead: picRes[0] || "",
}
}).then((result) => {
console.log("result:", result);
// console.log("result:", result);
this.queryBlessDetail();
}).catch((err) => {});
})
......@@ -913,15 +957,15 @@ Page({
blessContent: blessContent,
isAuth: result.isAuth == 1
});
console.log("detailData:", result);
console.log("blessContent:", this.data.blessContent);
console.log("类型 type => ", result.type == 1 ? "组队" : "单人");
console.log("是否已定制 customMade => ", result.customMade == 1 ? "已经定制" : "未定制");
console.log("是否自己房间 mySelf => ", result.ownerMember.mySelf == 1 ? "是" : "否");
console.log("房主信息 ownerMember => ", result.ownerMember);
console.log("是否授权 isAuth =>", this.data.isAuth);
console.log("房主信息 =>", result.ownerMember);
console.log("祝福内容 =>", result.blessContent);
// console.log("detailData:", result);
// console.log("blessContent:", this.data.blessContent);
// console.log("类型 type => ", result.type == 1 ? "组队" : "单人");
// console.log("是否已定制 customMade => ", result.customMade == 1 ? "已经定制" : "未定制");
// console.log("是否自己房间 mySelf => ", result.ownerMember.mySelf == 1 ? "是" : "否");
// console.log("房主信息 ownerMember => ", result.ownerMember);
// console.log("是否授权 isAuth =>", this.data.isAuth);
// console.log("房主信息 =>", result.ownerMember);
// console.log("祝福内容 =>", result.blessContent);
resolve(result);
}).catch((err) => {
reject(err);
......@@ -1141,7 +1185,7 @@ Page({
data
} = evt.detail;
if (data && data.evttype && data.evttype == "join") {
console.log("55555");
// console.log("55555");
}
switch (name) {
......
......@@ -5,6 +5,9 @@ import {
} from '../../utils/util';
let app = getApp();
let rewardedVideoAd = null
Page({
data: {
isOverShare: true,
......@@ -32,8 +35,6 @@ Page({
primaryCode: this.data.detailData.videoCode,
});
}
let detailData = this.data.detailData;
let title = detailData && detailData.videoName || "";
let path = `pages/detail/detail?c=${detailData.videoCode}`;
......@@ -67,13 +68,54 @@ Page({
// }
// }
// })
_this.onReplayHandler();
}).catch((err) => {});;
this.initData();
wx.aldstat.sendEvent('进入页面', {
'页面名字': '视频详情页'
});
if (wx.createRewardedVideoAd) {
rewardedVideoAd = wx.createRewardedVideoAd({
adUnitId: 'adunit-3e849f70e28e6c21'
})
rewardedVideoAd.onLoad(() => {
console.log('onLoad event emit');
})
rewardedVideoAd.onError((err) => {
console.log('onError event emit', err)
})
rewardedVideoAd.onClose((res) => {
console.log('onClose event emit', res)
})
}
this.checkShowVideoAd();
},
checkShowVideoAd() {
if (app.globalData.adConfigure && app.globalData.adConfigure.configureN > 0) {
if (app.globalData.videoPlayTimes >= app.globalData.adConfigure.configureN) {
console.log("app.globalData.videoPlayTimes:", app.globalData.videoPlayTimes);
// if (app.globalData.videoPlayTimes > 1) {
app.globalData.videoPlayTimes = 0;
rewardedVideoAd.show()
// 用户触发广告后,显示激励视频广告
if (rewardedVideoAd) {
rewardedVideoAd.show().catch(() => {
// 失败重试
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
.catch(err => {
console.log('激励视频 广告显示失败')
})
})
}
}
}
},
/**
* 基础方法
......@@ -219,7 +261,7 @@ Page({
}).then((result) => {
let dataList = result.list;
dataList = this.data.dataList.concat(dataList);
console.log("dataList:", dataList);
// console.log("dataList:", dataList);
this.setData({
dataList: dataList,
total: result.total
......
......@@ -284,6 +284,8 @@ Page({
this.setData({
adConfigure: result
})
app.globalData.adConfigure = result;
resolve(result);
}).catch((err) => {
reject(err)
......@@ -351,23 +353,52 @@ Page({
}
}).then((result) => {
let {
adConfigure
adConfigure,
} = this.data;
let listType = result.type;
let dataList = result.list;
dataList = this.data.dataList.concat(dataList);
// 带广告的格式
let dataListResult = [];
let isFirstAdshow = false;
let firstAdIndex = adConfigure.configureX || 0;
// 广告步进
let adStep = adConfigure.configureM || 0;
// 视频广告第一次出现条目
let firstAdIndex = adConfigure.configureX || 0;
// 视频广告第一条是否已经出现
let isFirstAdshow = false;
// 祝福广告第一次出现条目
let firstAdIndexBless = adConfigure.configureB || 0;
// 祝福广告第一条是否已经出现
let isFirstAdBlessShow = false;
// console.log("firstAdIndexBless:", firstAdIndexBless);
// 广告步数
let adStepIndex = 0;
// 洗列表格式
dataList.forEach((element, idx) => {
if (listType == 2) {
// 拜年祝福
if (isFirstAdBlessShow) {
} else {
if (adStepIndex == firstAdIndexBless && firstAdIndexBless > 0) {
isFirstAdBlessShow = true;
adStepIndex = 0;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
}
} else {
// 视频祝福
if (isFirstAdshow) {
adStepIndex++;
// 第一个视频出现过
if (adStepIndex > adStep && adStep != 0) {
adStepIndex = 0;
dataListResult.push({
......@@ -375,14 +406,20 @@ Page({
adType: "banner"
})
}
}
if (idx == firstAdIndex && firstAdIndex > 0) {
} else {
// 第一个视频出现
if (adStepIndex == firstAdIndex && firstAdIndex > 0) {
isFirstAdshow = true;
adStepIndex = 0;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
}
}
adStepIndex++;
dataListResult.push(element);
});
this.setData({
......
......@@ -26,7 +26,9 @@
<view class="list">
<!-- 拜年item -->
<block wx:if="{{listType == 2}}">
<view wx:for="{{dataList}}" bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" wx:key="index" class="list-bless-item">
<block wx:for="{{dataList}}" wx:key="index">
<ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad>
<view wx:else bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-bless-item">
<image class="poster" src="{{item.thumbnail}}" />
<view class="desc-wrap">
<view class="tit">{{item.blessTitle}}</view>
......@@ -36,6 +38,7 @@
</view>
</view>
</block>
</block>
<!-- 视频item -->
<block wx:else>
<block wx:for="{{dataList}}" wx:key="index">
......
......@@ -12,7 +12,8 @@ Page({
size: 10,
dataList: [],
options: {},
personInfo: {}
personInfo: {},
// adConfigure: {}, //广告位配置
},
onShareAppMessage(res) {
if (res.from === 'button') {
......@@ -86,7 +87,7 @@ Page({
},
onShareItem(evt){
onShareItem(evt) {
let curItem = getBindtapData(evt);
app.stat({
classify: "share",
......@@ -131,8 +132,56 @@ Page({
}).then((result) => {
let dataList = result.list;
dataList = this.data.dataList.concat(dataList);
// 带广告的格式
let dataListResult = [];
let adConfigure = app.globalData.adConfigure;
// 广告步进
let adStep = adConfigure.configureM || 0;
// 视频广告第一次出现条目
let firstAdIndex = adConfigure.configureX || 0;
// 视频广告第一条是否已经出现
let isFirstAdshow = false;
// 广告步数
let adStepIndex = 0;
dataList.forEach(element => {
// 视频祝福
if (isFirstAdshow) {
// 第一个视频出现过
if (adStepIndex > adStep && adStep != 0) {
adStepIndex = 0;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
} else {
// 第一个视频出现
if (adStepIndex == firstAdIndex && firstAdIndex > 0) {
isFirstAdshow = true;
adStepIndex = 0;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
}
adStepIndex++;
dataListResult.push(element);
});
this.setData({
dataList: dataList,
dataList: dataListResult,
total: result.total,
})
resolve(result);
......
......@@ -10,7 +10,9 @@
</view>
<view class="content">
<view class="list">
<view wx:for="{{dataList}}" wx:key="index" class="list-item">
<block wx:for="{{dataList}}" wx:key="index">
<ad wx:if="{{item.type == 'ad'}}" unit-id="adunit-c3754721d968fc07"></ad>
<view wx:else class="list-item">
<view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video">
<image class="img" src="{{item.thumbnail}}" mode="aspectFill" />
<view class="tit">
......@@ -32,6 +34,7 @@
</button>
</view>
</view>
</block>
</view>
</view>
</view>
......