videoplay.js 2.4 KB
// pages/videoplay/videoplay.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    videourl: '',
    thumb:'',
    title:'',
    fullScreen:true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log('999887766',options)
    let that=this
   
    
    this.setData({
    //   videourl: 'http://qiniu.winesbook.cn/admin/20190707/8b9721aa1195bfe251ec8276b55fb862.mp4'

      videourl: options.url,
      thumb:options.thumb,
      title:options.title
     })

    let token=wx.getStorageSync("token");
    if(token==''){
      wx.showToast({
        title: '请先登录',
        icon:"none"
      })

      setTimeout(function(){
        wx.navigateTo({
          url: '/pages/index/index?url=' + that.data.videourl + '&thumb=' + that.data.thumb + '&title=' + that.data.title,
        })
      })
    }
      
  },
  

  end() {
    console.log(43347889)
    wx.navigateBack({
      checked: true
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
   
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    setTimeout(function(){
      this.videoContext = wx.createVideoContext('myvideo', this);
      this.videoContext.requestFullScreen({ direction: 90 });
    },1500)
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let that=this;
    console.log(that.data.thumb)
    return {
      title: that.data.title, // 转发后 所显示的title
      // path: '/pages/home/buildtextdetail/buildtextdetail?buildid='+buildid+'&gettoken='+newtoken, // 相对的路径
      path: '/pages/videoplay/videoplay?url=' + that.data.videourl + '&thumb=' + that.data.thumb + '&title=' + that.data.title, //分娩笔记分享2
      imageUrl:this.data.thumb,
      success: (res) => { // 成功后要做的事情
        console.log(res)
        
      },
      fail: function (res) {
        // 分享失败
        console.log(res)
      }
  }
  }
})