From 138db89b3193d60850e203e1847e2f91d2b00ebc Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 07 八月 2024 18:19:47 +0800
Subject: [PATCH] lll

---
 wechat_jiaxuan/components/disRealpic/index.js |   50 +++++++++++++++++++++++++++++---------------------
 1 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/wechat_jiaxuan/components/disRealpic/index.js b/wechat_jiaxuan/components/disRealpic/index.js
index 443057c..582dd03 100644
--- a/wechat_jiaxuan/components/disRealpic/index.js
+++ b/wechat_jiaxuan/components/disRealpic/index.js
@@ -15,6 +15,8 @@
     menuButtonInfo: Object
   },
   data: {
+    acVid: '',
+    viewIdList: [],
     // 鍔ㄧ敾
     showTouch: true,
     animationData: {},
@@ -77,11 +79,11 @@
     },
     touchmove(e) {
       var touchMove = e.detail.scrollTop;
-      if (touchDot - touchMove > 16) {
+      if(touchMove - touchDot > 24){
         touchDot = touchMove
         this.fadeOut();
       }
-      if (touchDot - touchMove > 16) {
+      if(touchDot - touchMove > 24){
         touchDot = touchMove
         setTimeout(() => {
           this.setData({ showTouch: true })
@@ -186,18 +188,31 @@
       }
     },
     videoClick(e) {
-      const {
-        videourl
-      } = e.currentTarget.dataset
-
-      let videoPlay = this.selectComponent('.videoPlay');
-      if (videoPlay) {
-        videoPlay.startPlayVideo(videourl, this);
+      const { id } = e.currentTarget.dataset
+      const { dataList, acVid, viewIdList } = this.data
+      const index = viewIdList.findIndex(i => i === 'video' + id)
+      if(acVid){
+        if('video' + id != acVid){
+          wx.createVideoContext(acVid, this).pause()
+          wx.createVideoContext('video' + id, this).play()
+          this.setData({ acVid: 'video' + id })
+        }
+      }else{
+        this.setData({ acVid: 'video' + id })
+        wx.createVideoContext('video' + id, this).play()
       }
-      console.log(videourl + "-------------------------------------")
-      // wx.previewMedia({
-      //   sources: [{ url: videourl, type: 'video' }]
-      // })
+      dataList.forEach(ite => {
+        if(id === ite.id && index === -1){
+          ite.viewCount += 1
+          viewIdList.push('video' + id)
+          actionDo({
+            actionType: 'view',
+            id: id
+          })
+          this.setData({ viewIdList })
+        }
+      })
+      this.setData({ dataList })
     },
     priviewFull(e) {
       const item = e.currentTarget.dataset.item
@@ -239,14 +254,7 @@
       const item = e.currentTarget.dataset.item
       console.log('item', item);
       if (item.openType == 'video') {
-
-        let videoPlay = this.selectComponent('.videoPlay');
-        if (videoPlay) {
-          videoPlay.startPlayVideo(item.openContent, this);
-        }
-        // wx.previewMedia({
-        //   sources: [{ url: item.openContent, type: 'video' }]
-        // })
+        return
       }
       if (item.openType == 'link') {
         wx.navigateTo({

--
Gitblit v1.9.3