From d9a89d83c2048a964f16ca179feb2b7f21b9d33a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 29 七月 2024 16:28:47 +0800
Subject: [PATCH] 提交

---
 wechat_jiaxuan/pages/productVideo/index.js |   98 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/wechat_jiaxuan/pages/productVideo/index.js b/wechat_jiaxuan/pages/productVideo/index.js
index 22a8ed7..cd4f618 100644
--- a/wechat_jiaxuan/pages/productVideo/index.js
+++ b/wechat_jiaxuan/pages/productVideo/index.js
@@ -1,34 +1,81 @@
-// pages/consult/consult.js
+import { getZhongTaiVideoPage, getCataLogTagList } from '../../api/index'
 Page({
 
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    category: ['鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈','鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈'],
-    secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
-    activeCate: '',
-    seActiveCate: '',
-    dataList: []
-  },
+    videoContext:null,
+    category: [],
+    tagCodes: '',
+    videoUrl: '',
+    showVideo: false,
+    isShow:false,
+    curVideoSrc:'',
+    dataList: [],
+    total: 0,
+    pageSize: 10,
+    pageNum: 1,
 
-  itemClick(e) {
-    const { id } = e.target.dataset
-    console.log(e.target.dataset);
-    wx.navigateTo({
-      url: '/pages/consult/detail',
+  },
+  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] : null
+    }).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 { videourl } = e.currentTarget.dataset 
+    let videoPlay = this.selectComponent('.videoPlay'); 
+    if(videoPlay){ 
+      videoPlay.startPlayVideo(videourl,this );
+    }
+    // this.startPlayVideo(videourl)
+
+    // 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() 
+    this.videoContext = wx.createVideoContext('myVideo') 
   },
 
   /**
@@ -65,18 +112,23 @@
   onPullDownRefresh() {
 
   },
-
-  /**
-   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
-   */
-  onReachBottom() {
-
-  },
-
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
   onShareAppMessage() {
 
+  },
+  startPlayVideo(videourl){
+    this.setData({isShow:true, curVideoSrc:videourl})
+    console.log(videourl) 
+    this.videoContext.requestFullScreen({
+      // direction: 0  
+    });  
+  },
+  onClose(){
+    this.setData({isShow:false}) 
+    if(this.videoContext){
+      this.videoContext.exitFullScreen() 
+    }
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3