ソースを参照

feat 合集增加模板广告 & 合集刷新打开 & 改成页面滚动 & 激励视频奖励bug修复

erekook 10 ヶ月 前
コミット
6595cb8355

+ 2 - 1
config/config.js

@@ -8,6 +8,7 @@ const appInfoObj = {
       rewardAdId: "adunit-7df7b95b78f624f8",
       bookmarkAdId: "adunit-343af082b8c8ea18",
       templateAdId: "adunit-80f6ec7a264f968b",
+      template2AdId: "adunit-453e5674fdf5912a",
     },
   },
   wxa13166979d7011c4: {
@@ -481,7 +482,7 @@ const appInfoObj = {
 };
 
 // @config 确定使用的小程序appid
-const current_appid = "wxf2dd3343ad28ec14";
+const current_appid = "wxa7a33088566e1292";
 export const apple = {
   ...appInfoObj[current_appid],
   appKey: "49TBR8Z1rA7PyqD30FV0v48AU",

+ 24 - 24
pages/collect-video/video.js

@@ -6,7 +6,7 @@ import {
   getCollectRealVideoUrl,
   getRecCollectList,
 } from "../../api/api";
-import { rnd, SendEvent, rndone } from "../../utils/util";
+import { rnd, SendEvent, rndone, deepCopy } from "../../utils/util";
 import { apple } from "../../config/config";
 
 const app = getApp();
@@ -58,7 +58,7 @@ Page({
     this.handleEntrace(options);
     this.setData({
       collectId: options.collectId,
-      templateAdId: apple.ads.templateAdId,
+      templateAdId: apple.ads.template2AdId,
       hasLoadAdConfig: true,
     });
 
@@ -297,7 +297,7 @@ Page({
         e.views = rnd(1, 10);
       });
       this.setData({
-        videoList: res,
+        videoList: this.formatVideoAdList(deepCopy(res)),
         loading: false,
         hasMore: false,
       });
@@ -396,19 +396,19 @@ Page({
    */
   formatVideoAdList(arr) {
     // 原生广告间隔,激励广告间隔
-    let templateGap = 0,
+    let templateGap = 5,
       rewardGap = 0;
-    console.log(this.data.globalConfig);
-    if (this.data.globalConfig.isHomeTemplateAd === 1) {
-      templateGap = this.data.globalConfig.homeTemplateAdInterval;
-    } else {
-      templateGap = 0;
-    }
-    if (this.data.globalConfig.isHomeRewardAd) {
-      rewardGap = this.data.globalConfig.homeRewardAdInterval;
-    } else {
-      rewardGap = 0;
-    }
+    // console.log(this.data.globalConfig);
+    // if (this.data.globalConfig.isHomeTemplateAd === 1) {
+    //   templateGap = this.data.globalConfig.homeTemplateAdInterval;
+    // } else {
+    //   templateGap = 0;
+    // }
+    // if (this.data.globalConfig.isHomeRewardAd) {
+    //   rewardGap = this.data.globalConfig.homeRewardAdInterval;
+    // } else {
+    //   rewardGap = 0;
+    // }
     console.log(
       "原生间隔templateGap",
       templateGap,
@@ -417,12 +417,7 @@ Page({
     );
 
     // 第二个固定是原生广告
-    let result = [
-      arr.shift(),
-      {
-        adType: "templateAd",
-      },
-    ];
+    let result = [];
     // 辅助计算间隔变量
     let markIndex = 0;
     let templateAdFlag = true;
@@ -476,7 +471,12 @@ Page({
       tag_id: this.data.tagId,
     });
     console.log(id, info, index, "合集详情");
-    this.getCollectVideoDetail();
+    wx.redirectTo({
+      url: "/pages/collect-video/video?collectId=${id}",
+      fail(err) {
+        this.getCollectVideoDetail();
+      },
+    });
   },
 
   // 分享给朋友
@@ -525,7 +525,7 @@ Page({
 
           SendEvent("unlock_collection", {
             cid: this.data.collectId,
-            video_id: this.data.eps[this.playingEp].id,
+            video_id: this.data.eps[this.data.playingEp].id,
             // tag_id: this.data.tagId,
             ad_num: hadRewardNum + 1,
           });
@@ -534,7 +534,7 @@ Page({
         } else {
           SendEvent("unlock_collection_fail", {
             cid: this.data.collectId,
-            video_id: this.data.eps[this.playingEp].id,
+            video_id: this.data.eps[this.data.playingEp].id,
           });
         }
       });

+ 8 - 15
pages/collect-video/video.wxml

@@ -52,20 +52,17 @@
   </view>
   <view class="title">猜你喜欢</view>
   <!-- 视频列表 -->
-  <scroll-view
-    scroll-y
+  <view
     class="list-container"
-    enhanced="{{ true }}"
-    show-scrollbar="{{ false }}"
-    bounces="{{ true }}"
-    fast-deceleration="{{ true }}"
   >
     <view class="list">
+      <view wx:if="{{hasLoadAdConfig }}" class="ad-custom-card-1">
+        <ad-custom unit-id="{{templateAdId}}" style="height: 100%;margin-bottom: 20rpx;"></ad-custom>
+      </view>
       <block wx:for="{{ videoList }}" wx:key="id" wx:for-index="idx">
-        <!-- 视频广告 -->
-        <!-- <view wx:if="{{item.adType === 'videoAd' && hasLoadAdConfig}}" class="ad-custom-card"> -->
-        <!--   <ad unit-id="{{templateAdId}}" ad-type="video" style="height: 100%;margin-bottom: 20rpx;"></ad> -->
-        <!-- </view> -->
+      <view wx:if="{{item.adType === 'templateAd' && hasLoadAdConfig }}" class="ad-custom-card-1">
+        <ad-custom unit-id="{{templateAdId}}" style="height: 100%;margin-bottom: 20rpx;"></ad-custom>
+      </view>
         <view wx:if="{{ item.adType === 'video' }}">
           <!-- 视频卡片 -->
           <view class="video-item" bindtap="clickCollect" data-info="{{ item }}" data-id="{{ item.id }}" data-index="{{idx}}">
@@ -85,10 +82,6 @@
             </view>
           </view>
         </view>
-         <!-- 卡片原生广告 -->
-         <!-- <view wx:if="{{item.adType === 'templateAd' && hasLoadAdConfig }}" class="ad-custom-card-1"> -->
-         <!--    <ad-custom unit-id="{{templateAdId}}" style="height: 100%;margin-bottom: 20rpx;"></ad-custom> -->
-         <!--  </view> -->
       </block>
     </view>
 
@@ -114,6 +107,6 @@
         <text>暂无视频内容</text>
       </view>
     </view>
-  </scroll-view>
+  </view>
 
 </view>

+ 0 - 1
pages/collect-video/video.wxss

@@ -190,7 +190,6 @@
 
 /* 列表容器 */
 .list-container {
-  height: calc(100vh - 500rpx);
   background-color: #f8f8f8;
 }
 

+ 2 - 2
project.private.config.json

@@ -25,8 +25,8 @@
       "list": [
         {
           "name": "合集视频",
-          "pathName": "pages/video/video",
-          "query": "collectId=18&type=tuiguang",
+          "pathName": "pages/collect-video/video",
+          "query": "collectId=18",
           "scene": 1008,
           "launchMode": "default",
           "groupInfo": {