From c96612e8a63ecef9590be0f8b5199277ec94e5b9 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期三, 18 九月 2024 18:43:12 +0800
Subject: [PATCH] 云学习购买目录,修改bug

---
 packageDomain/pages/resourceDetails/myAudio/index.js |   94 +++++++++--------------------------------------
 1 files changed, 18 insertions(+), 76 deletions(-)

diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js
index af8f609..06c0fb7 100644
--- a/packageDomain/pages/resourceDetails/myAudio/index.js
+++ b/packageDomain/pages/resourceDetails/myAudio/index.js
@@ -45,7 +45,6 @@
     myAudioDuration: '00:00', // 瑙嗛鏃堕棿
     myAudioCurrent: '00:00', // 褰撳墠鎾斁杩涘害
     isplay: false, //鏄惁榛樿鎾斁,
-    selectId: '',
     speed: 1.0,
     myAudioPos: '',
     startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿
@@ -145,14 +144,17 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
    */
   onHide() {
+    // this.setData({
+    //   pauseTime: Date.now()
+    // })
+    // if (wx.getStorageSync(app.config.tokenKey)) {
+    //   let duration = this.data.pauseTime - this.data.startTime
+    //   this.count(duration)
+    // }
+    // this.setPlayerList()
     this.setData({
-      pauseTime: Date.now()
+      isplay: true
     })
-    if (wx.getStorageSync(app.config.tokenKey)) {
-      let duration = this.data.pauseTime - this.data.startTime
-      this.count(duration)
-    }
-    this.setPlayerList()
   },
 
   /**
@@ -162,29 +164,24 @@
    * 
    */
   onUnload() {
-    // this.setData({
-    //   pauseTime: Date.now()
-    // })
-    // if (wx.getStorageSync(app.config.tokenKey)) {
-    //   let duration = this.data.pauseTime - this.data.startTime
-    //   this.count(duration)
-    // }
-
-
-    // myAudio.src = ''
-    // myAudio.destroy()
     this.setData({
       // myAudioPos: '',
       isplay: false, //鏄惁榛樿鎾斁,
       myAudioCurrent: '00:00', // 褰撳墠鎾斁杩涘害
       showData: '',
       speed: 1.0,
+      pauseTime: Date.now()
     });
     myAudio.playbackRate = this.data.speed;
     // 鍋滄闊抽鎾斁
     myAudio.stop();
     // 閿�姣� InnerAudioContext 瀹炰緥
     // myAudio.destroy();
+    // 缁熻瀛︿範鏃堕暱
+    if (wx.getStorageSync(app.config.tokenKey)) {
+      let duration = this.data.pauseTime - this.data.startTime
+      this.count(duration)
+    }
     this.setPlayerList()
   },
   count(timeStr) {
@@ -203,6 +200,7 @@
     if (this.data.cmsId) {
       data.cmsItemId = this.data.cmsId
     }
+    console.log('缁熻', data)
     app.MG.job.newJobWithApiNewEvent(data).then((res) => {})
   },
   /**
@@ -348,11 +346,9 @@
     if (this.data.showData != '') {
       this.setData({
         titleName: item.name,
-        selectId: item.id,
         selectedId: e.currentTarget.dataset.index,
         showData: '',
         activeId: item.id
-
       })
       if (item.selectType == "audio" || item.learnSelectType === "audio") {
         if (this.data.formPath == 'jsek_cloudLearning') {
@@ -645,9 +641,6 @@
         myAudioCurrent: '00:00',
         myAudioPos: '',
       })
-
-
-
     });
 
     //杩涘害鏉″彉鍖�   
@@ -680,57 +673,6 @@
     });
   },
 
-  //鍙冲垏鎹�
-  onLeftSwitch() {
-    this.setData({
-      speed: 1.0,
-      myAudioCurrent: '00:00'
-    })
-    const index = this.data.threeLeveData.findIndex((item) => item.id == this.data.selectId)
-    if (this.data.threeLeveData[index - 1]) {
-      this.changeItem(this.data.threeLeveData[index - 1])
-      this.setData({
-        selectedId: index - 1,
-      })
-    } else {
-      console.log('宸茬粡鏄涓�棣栦簡');
-    }
-  },
-  //鍙冲垏鎹�
-  onRightSwitch() {
-    this.setData({
-      speed: 1.0,
-      myAudioCurrent: '00:00'
-    })
-    const index = this.data.threeLeveData.findIndex((item) => item.id == this.data.selectId)
-    if (this.data.threeLeveData[index + 1]) {
-      this.changeItem(this.data.threeLeveData[index + 1])
-      this.setData({
-        selectedId: index + 1,
-      })
-    } else {
-      console.log('宸茬粡鏄渶鍚庝竴棣栦簡');
-    }
-  },
-
-  // 宸﹀彸鍒囨崲
-  changeItem(item) {
-    if (this.data.showData != '') {
-      this.setData({
-        showData: ''
-      })
-    }
-    this.setData({
-      titleName: item.name,
-      selectId: item.id
-    })
-    if (item.selectType == "audio") {
-      this.setData({
-        showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file
-      })
-      this.pubulicPlayFun()
-    }
-  },
   // 鎾斁鍊嶉��
   onSpeed() {
     let c = this.data.speed;
@@ -827,12 +769,12 @@
   setPlayerList() {
     let that = this
     if (that.data.progress > 0) {
-      let index = that.data.playerList.findIndex((itemData) => itemData.cmsItemId == that.data.selectId)
+      let index = that.data.playerList.findIndex((itemData) => itemData.cmsItemId == that.data.activeId)
       if (index > -1) {
         that.data.playerList.splice(index, 1)
       }
       that.data.playerList.push({
-        cmsItemId: that.data.selectId,
+        cmsItemId: that.data.activeId,
         progress: that.data.progress
       })
       app.MG.identity

--
Gitblit v1.9.1