10738d21 by simon

默认提交

1 parent 8a4eeec1
......@@ -76,6 +76,7 @@ App({
userInfo: null,
wxcode: store.getItem("wxcode"),
tlMemberCode: "",
videoPlayTimes: 0,
},
//重写分享方法
share: function () {
......
......@@ -23,6 +23,9 @@ module.exports = {
blessUpdateRoom: "/bless/update/info", // 修改房间信息
blessJoin: "/bless/join", // 加入房间
// 广告配置
adConfigure: "/configure",
/**
* 通用接口
* 请求时 "mode"传"custom"
......
......@@ -51,6 +51,8 @@ Page({
})
},
onLoad(options) {
let _this = this;
this.setData({
options
......@@ -72,6 +74,7 @@ Page({
});
},
/**
* 基础方法
* 授权完毕重拉数据用
......@@ -147,6 +150,7 @@ Page({
* 播放开始
*/
onVideoPlayHandler(evt) {
app.globalData.videoPlayTimes++;
// 打点
app.stat({
classify: "video",
......
......@@ -51,6 +51,7 @@
</view>
</view>
<!-- 广告 -->
<ad unit-id="adunit-c3754721d968fc07"></ad>
<!-- 装饰物 -->
<view class="decoration">
<image mode="widthFix" src="../../image/detail/decoration_c1.png" />
......
......@@ -2,6 +2,9 @@ import {
getBindtapData
} from '../../utils/util'
let app = getApp();
Page({
data: {
......@@ -29,6 +32,7 @@ Page({
content: "url",
},
],
adConfigure: {}, //广告位配置
options: {},
config: {},
NewYear: false
......@@ -60,13 +64,13 @@ Page({
ENV: app.config.ENV,
NewYear: app.config.ENV == "NewYear"
})
// console.log("config:", this.data.config);
// console.log("ENV:", this.data.ENV);
wx.aldstat.sendEvent('进入页面', {
'页面名字': '首页'
});
},
initData() {
this.queryAdConfigure().then((result) => {
this.queryTabList().then((result) => {
let {
options,
......@@ -88,11 +92,12 @@ Page({
curTab: tabList[0]
})
}
this.resetPage();
this.queryBannerList();
this.queryVideoList();
});
});
},
/**
* 到达底部
......@@ -268,6 +273,24 @@ Page({
}
},
/**广告配置 */
queryAdConfigure() {
return new Promise((resolve, reject) => {
app.post({
sid: false,
url: app.api.adConfigure,
data: {}
}).then((result) => {
this.setData({
adConfigure: result
})
resolve(result);
}).catch((err) => {
reject(err)
});
});
},
/**
* 获取tab列表
*/
......@@ -327,10 +350,43 @@ Page({
tabCode: this.data.curTab.tabCode || "",
}
}).then((result) => {
let {
adConfigure
} = this.data;
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 adStepIndex = 0;
// 洗列表格式
dataList.forEach((element, idx) => {
if (isFirstAdshow) {
adStepIndex++;
if (adStepIndex > adStep && adStep != 0) {
adStepIndex = 0;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
}
if (idx == firstAdIndex && firstAdIndex > 0) {
isFirstAdshow = true;
dataListResult.push({
type: "ad",
adType: "banner"
})
}
dataListResult.push(element);
});
this.setData({
dataList: dataList,
dataList: dataListResult,
total: result.total,
queueCode: result.queueCode,
listType: result.type
......
......@@ -30,13 +30,17 @@
<image class="poster" src="{{item.thumbnail}}" />
<view class="desc-wrap">
<view class="tit">{{item.blessTitle}}</view>
<view class="scene">{{item.type == 0 ? '我的祝福 >> 送' : '组团祝福 >> 送'}}{{item.scene}}</view>
<view class="scene">
{{item.type == 0 ? '我的祝福 >> 送' : '组团祝福 >> 送'}}{{item.scene}}
</view>
</view>
</view>
</block>
<!-- 视频item -->
<block wx:else>
<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">
......@@ -59,6 +63,7 @@
</view>
</view>
</block>
</block>
</view>
</view>
</view>
......