|
|
@@ -17,29 +17,35 @@ const app = getApp()
|
|
|
let interstitialAd = null
|
|
|
|
|
|
Page({
|
|
|
- data: {
|
|
|
- videoList: [],
|
|
|
- loading: false,
|
|
|
- hasMore: true,
|
|
|
- page: 1,
|
|
|
- size: 10,
|
|
|
- // 状态栏高度
|
|
|
- statusBarHeight: 20,
|
|
|
- navHeight: 64, // 导航栏高度 = 状态栏 + 44
|
|
|
- navStyle: '',
|
|
|
- listStyle: '',
|
|
|
- // 添加防抖时间戳
|
|
|
- lastLoadTime: 0,
|
|
|
- ads: null,
|
|
|
- globalConfig: null,
|
|
|
- // 视频分类列表
|
|
|
- categoryList: [],
|
|
|
- // 当前选中的分类ID
|
|
|
- currentCategoryId: null,
|
|
|
-
|
|
|
- share_count: 1,
|
|
|
- hasLoadAdConfig: false,
|
|
|
+ data: {
|
|
|
+ videoList: [],
|
|
|
+ loading: false,
|
|
|
+ hasMore: true,
|
|
|
+ page: 1,
|
|
|
+ size: 10,
|
|
|
+ // 状态栏高度
|
|
|
+ statusBarHeight: 20,
|
|
|
+ navHeight: 64, // 导航栏高度 = 状态栏 + 44
|
|
|
+ navStyle: '',
|
|
|
+ listStyle: '',
|
|
|
+ // 添加防抖时间戳
|
|
|
+ lastLoadTime: 0,
|
|
|
+ ads: null,
|
|
|
+ globalConfig: null,
|
|
|
+ // 视频分类列表
|
|
|
+ categoryList: [],
|
|
|
+ // 当前选中的分类ID
|
|
|
+ currentCategoryId: null,
|
|
|
+
|
|
|
+ share_count: 1,
|
|
|
+ hasLoadAdConfig: false,
|
|
|
+ templateAdId: '',
|
|
|
+ adErrorField: {
|
|
|
+ videoError: false,
|
|
|
+ bannerError: false,
|
|
|
+ templateError: false
|
|
|
},
|
|
|
+ },
|
|
|
|
|
|
async onLoad() {
|
|
|
console.log('打开视频页面--------------------------')
|
|
|
@@ -50,8 +56,9 @@ Page({
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
+ templateAdId: apple.ads.templateAdId,
|
|
|
hasLoadAdConfig: true
|
|
|
- })
|
|
|
+ })
|
|
|
|
|
|
this.interstitalLoad()
|
|
|
getTemplateConfig({
|
|
|
@@ -256,18 +263,12 @@ Page({
|
|
|
adType: "video",
|
|
|
lock: false
|
|
|
}))
|
|
|
-
|
|
|
videoList = this.formatVideoAdList(videoList);
|
|
|
-
|
|
|
- console.log(videoList, '过滤后的数组')
|
|
|
-
|
|
|
console.log("format videoList", videoList)
|
|
|
-
|
|
|
} catch (apiError) {
|
|
|
console.error('API调用失败:', apiError)
|
|
|
throw apiError
|
|
|
}
|
|
|
-
|
|
|
// 如果是第一页,直接替换数据
|
|
|
if (this.data.page === 1) {
|
|
|
this.setData({
|
|
|
@@ -401,8 +402,7 @@ Page({
|
|
|
// 点击视频
|
|
|
onVideoTap(e) {
|
|
|
const { id, info, index } = e.currentTarget.dataset;
|
|
|
- console.log(id, info, index, 111111111111111)
|
|
|
- // const video = this.data.videoList.find(item => item.id === id);
|
|
|
+ console.log(id, info, index, '视频详情')
|
|
|
if (!info) {
|
|
|
wx.hideLoading();
|
|
|
wx.showToast({
|
|
|
@@ -560,4 +560,31 @@ Page({
|
|
|
wx.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ // 统一小程序广告加载成功
|
|
|
+ appletsAdLoad(e) {
|
|
|
+ let _target = e.currentTarget.dataset
|
|
|
+ this.setData({
|
|
|
+ [`adErrorField.${_target.field}`]: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 统一小程序广告加载失败
|
|
|
+ appletsAdError(e) {
|
|
|
+ let _target = e.currentTarget.dataset
|
|
|
+ this.setData({
|
|
|
+ [`adErrorField.${_target.field}`]: true
|
|
|
+ })
|
|
|
+ console.error(_target.name, '错误', e)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 统一小程序广告关闭
|
|
|
+ appletsAdClose(e) {
|
|
|
+ let _target = e.currentTarget.dataset
|
|
|
+ },
|
|
|
+
|
|
|
+ // 统一小程序广告点击
|
|
|
+ appletsAdClick(e) {
|
|
|
+ let _target = e.currentTarget.dataset
|
|
|
+ }
|
|
|
})
|