aa
jiangping
2024-08-02 7dc29ed74ebaa8a0e66f68264d9a13f95dc3af21
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,26 @@
    })
  },
  itemClick(e) {
    const { videourl } = e.currentTarget.dataset
    wx.previewMedia({
      sources: [{ url: videourl, type: 'video' }]
    const { videourl ,id} = e.currentTarget.dataset
    const { dataList } = this.data
    dataList.forEach(ite => {
      if(id === ite.id){
        ite.viewCount += 1
      }
    })
    this.setData({ dataList })
    actionDo({
      actionType: 'view',
      id: id
    })
    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 +83,8 @@
  },
  onLoad(options) {
    this.getTagList()
    this.getList()
    this.getList()
    this.videoContext = wx.createVideoContext('myVideo')
  },
  /**
@@ -107,5 +126,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()
    }
  }
})