From b022834cf81ea67a6f28d31cc057d494ac6dc8ed Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 30 七月 2024 14:03:02 +0800
Subject: [PATCH] 提交

---
 wechat_jiaxuan/pages/productVideo/index.js |   45 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/wechat_jiaxuan/pages/productVideo/index.js b/wechat_jiaxuan/pages/productVideo/index.js
index 4db093b..1209c01 100644
--- a/wechat_jiaxuan/pages/productVideo/index.js
+++ b/wechat_jiaxuan/pages/productVideo/index.js
@@ -1,15 +1,17 @@
-import { getZhongTaiVideoPage, getCataLogTagList } from '../../api/index'
+import { getZhongTaiVideoPage, actionDo, getCataLogTagList } from '../../api/index'
 Page({
 
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    videoContext:null,
     category: [],
     tagCodes: '',
     videoUrl: '',
     showVideo: false,
-
+    isShow:false,
+    curVideoSrc:'',
     dataList: [],
     total: 0,
     pageSize: 10,
@@ -48,10 +50,27 @@
     })
   },
   itemClick(e) {
-    const { videourl } = e.currentTarget.dataset
-    wx.previewMedia({
-      sources: [{ url: videourl, type: 'video' }]
+ 
+    const { videourl ,id} = e.currentTarget.dataset 
+    actionDo({
+      actionType: 'view',
+      id: id
     })
+    var dataList = this.data.dataList;
+    dataList.forEach(item =>{
+       if(item.id == id){
+         item.viewCount = (item.viewCount||0) +1 
+        }
+    })
+    this.setData({dataList:dataList})
+    let videoPlay = this.selectComponent('.videoPlay'); 
+    if(videoPlay){ 
+      videoPlay.startPlayVideo(videourl,this );
+    }
+    // this.startPlayVideo(videourl) 
+    // wx.previewMedia({
+    //   sources: [{ url: videourl, type: 'video' }]
+    // })
   },
   cateClick(e) {
     const { code } = e.target.dataset
@@ -65,7 +84,8 @@
   },
   onLoad(options) {
     this.getTagList()
-    this.getList()
+    this.getList() 
+    this.videoContext = wx.createVideoContext('myVideo') 
   },
 
   /**
@@ -107,5 +127,18 @@
    */
   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