yiming
2024-03-22 1e0ffc1deed2044f96bab70e10d5c5544f6a23bf
packageDomain/pages/resourceDetails/myAudio/index.js
@@ -7,6 +7,7 @@
   * 页面的初始数据
   */
  data: {
    showDropdown: false,
    noteList: [],
    navBarHeight: '',
    barHeight: '',
@@ -34,12 +35,18 @@
    style: 'height: 248rpx',
    submitType: "new", //  新建 or 编辑
    noteId: '',
    myAudioDuration: '',  // 视频时间
    myAudioCurrent: '',   // 当前播放进度
    myAudioDuration: '00:00',  // 视频时间
    myAudioCurrent: '00:00',   // 当前播放进度
    isplay: false, //是否默认播放,
    selectId: '',
    speed: 1.0,
  },
  // 时间格式化
  format(t) {
    let time = Math.floor(t / 60) >= 10 ? Math.floor(t / 60) : '0' + Math.floor(t / 60);
    t = time + ':' + ((t % 60) / 100).toFixed(2).slice(-2);
    return t;
  },
  audio: null,
  // 格式化笔记时间
@@ -55,12 +62,7 @@
    return formattedDate
  },
  // 时间格式化
  format(t) {
    let time = Math.floor(t / 60) >= 10 ? Math.floor(t / 60) : '0' + Math.floor(t / 60);
    t = time + ':' + ((t % 60) / 100).toFixed(2).slice(-2);
    return t;
  },
  /**
   * 生命周期函数--监听页面加载
@@ -103,6 +105,7 @@
   */
  onShow() {
    this.pubulicPlayFun()
  },
  /**
@@ -240,7 +243,6 @@
    }
    this.setData({
      selectedId: e.currentTarget.dataset.index,
    })
@@ -372,9 +374,9 @@
    await app.MG.ugc.getTopicMessageList(query).then((res) => {
      // notePage.value.total = res.totalSize
      res.datas.forEach((item) => {
        // item.compliceHover = false
        // item.deleteHover = false
        item.createDate = this.convertTimestamp(item.createDate)
        console.log(item, 'item789');
      })
      this.setData({
        "pageCount.total": res.totalSize,
@@ -521,7 +523,8 @@
    myAudio.onCanplay(() => {
      myAudio.duration; //必须写,不然获取不到。。。
      setTimeout(() => {
        console.log(myAudio.duration);
        console.log(myAudio.duration, 'myAudio.duration');
        // debugger
        this.setData({
          myAudioDuration: this.format(myAudio.duration),
          myAudioCurrent: this.format(myAudio.currentTime)
@@ -569,7 +572,6 @@
    });
  },
  adsfhaewlf() {
    myAudio.pause();
    this.setData({
      isplay: false
@@ -614,7 +616,7 @@
    }
  },
  // 左右切换
  changeItem(item) {
    console.log(item);
@@ -651,6 +653,7 @@
    }
    setTimeout(() => {
      console.log(this.data.speed, 'this.data.speed');
      myAudio.startTime = this.data.myAudioDuration  //开始时间  
      myAudio.playbackRate = this.data.speed; //  播放速率
    }, 200);
@@ -665,7 +668,53 @@
      myAudioPos: position,
      myAudioCurrent: this.format(currentTime)
    })
  },
  toggleDropdown() {
    this.setData({
      showDropdown: !this.data.showDropdown
    });
  },
  smallSpeed() {
    this.setData({
      speed: 0.5,
      showDropdown: !this.data.showDropdown
    })
    setTimeout(() => {
      myAudio.startTime = this.data.myAudioDuration  //开始时间
      myAudio.playbackRate = this.data.speed; //  播放速率
    }, 200);
  },
  centreSpeed() {
    this.setData({
      speed: 1.5,
      showDropdown: !this.data.showDropdown
    })
    setTimeout(() => {
      myAudio.startTime = this.data.myAudioDuration  //开始时间
      myAudio.playbackRate = this.data.speed; //  播放速率
    }, 200);
  },
  bigSpeed() {
    this.setData({
      speed: 2,
      showDropdown: !this.data.showDropdown
    })
    setTimeout(() => {
      myAudio.startTime = this.data.myAudioDuration  //开始时间
      myAudio.playbackRate = this.data.speed; //  播放速率
    }, 200);
  },
  smallSpeeDmultiple() {
    this.setData({
      speed: 1,
      showDropdown: !this.data.showDropdown
    })
    setTimeout(() => {
      myAudio.startTime = this.data.myAudioDuration  //开始时间
      myAudio.playbackRate = this.data.speed; //  播放速率
    }, 200);
  }
})