From 67691fedbabb03a2c5997da4951763ba5a8f4a9f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 23 七月 2024 16:26:09 +0800
Subject: [PATCH] ‘’

---
 wechat_staff/pages/productVideo/index.js |   71 ++++++++++++++++++++++++-----------
 1 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/wechat_staff/pages/productVideo/index.js b/wechat_staff/pages/productVideo/index.js
index 22a8ed7..6e9614a 100644
--- a/wechat_staff/pages/productVideo/index.js
+++ b/wechat_staff/pages/productVideo/index.js
@@ -1,34 +1,69 @@
-// pages/consult/consult.js
+import { getZhongTaiVideoPage, getCataLogTagList } from '../../api/index'
 Page({
 
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    category: ['鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈','鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈'],
-    secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
-    activeCate: '',
-    seActiveCate: '',
-    dataList: []
-  },
+    category: [],
+    tagCodes: '',
 
+    dataList: [],
+    total: 0,
+    pageSize: 10,
+    pageNum: 1,
+
+  },
+  onReachBottom() {
+    console.log('瑙﹀簳浜嬩欢');
+    const { total, dataList, pageNum } = this.data
+    if(total > dataList.length){
+      this.setData({ pageNum: pageNum + 1 })
+      this.getList()
+    }else{
+      wx.showToast({
+        title: '鏆傛棤鏇村鏁版嵁',
+        icon: 'none'
+      })
+    }
+  },
+  getList() {
+    const { pageSize, pageNum, tagCodes } = this.data
+    getZhongTaiVideoPage({
+      pageSize,pageNum, tagCodes: tagCodes ? [tagCodes] : []
+    }).then(res => {
+      this.setData({
+        dataList: [...this.data.dataList, ...res.data.records],
+        total: res.data.total
+      })
+    })
+  },
+  getTagList() {
+    getCataLogTagList({
+      catalogCode: 'video_rec'
+    }).then(res => {
+      this.setData({ category: res.data })
+    })
+  },
   itemClick(e) {
-    const { id } = e.target.dataset
-    console.log(e.target.dataset);
-    wx.navigateTo({
-      url: '/pages/consult/detail',
+    const { videourl } = e.currentTarget.dataset
+    wx.previewMedia({
+      sources: [{ url: videourl, type: 'video' }]
     })
   },
   cateClick(e) {
-    const { index } = e.target.dataset
-    console.log(index);
+    const { code } = e.target.dataset
+    this.setData({ tagCodes: code })
+    this.setData({ total: 0, dataList: [], pageNum: 1 })
+    this.getList()
   },
   seCateClick(e) {
     const { index } = e.target.dataset
     console.log(index);
   },
   onLoad(options) {
-
+    this.getTagList()
+    this.getList()
   },
 
   /**
@@ -65,14 +100,6 @@
   onPullDownRefresh() {
 
   },
-
-  /**
-   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
-   */
-  onReachBottom() {
-
-  },
-
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */

--
Gitblit v1.9.3