index.js 1.45 KB
Page({
  onReady: function (res) {
  
  },  
  bindInputBlur: function(e) {
    this.inputValue = e.detail.value
  },
  bindButtonTap: function() {
    var that = this
     getApp().globalData.no_clear=1;
    wx.chooseVideo({
      sourceType: ['album', 'camera'],
      maxDuration: 60,
      camera: ['front','back'],
      success: function(res) {
        that.setData({
          src: res.tempFilePath
        })
      }
    })
  },
  bindSendDanmu: function () {
    this.videoContext.sendDanmu({
      text: this.inputValue,
      color: getRandomColor()
    })
  },
  onShow:function(){
	  var goods_list = this.selectComponent("#goods_list"); //组件的id
	  goods_list.init();
	  setTimeout(function() {
	    goods_list.get_list();
	  }, 300)
  },
  
    //---------分享配置--------
    onShareAppMessage: function (e) {
      getApp().globalData.no_clear=1
      return {
        title: "直播视频回放",
      }
    },
  //调用视频接口
  onLoad:function(e){
	  var r_id=e.id,th=this;	  
	  if(!r_id) r_id=1;
	  getApp().request.get("/api/wx/weappLiveReplaylist/get?id="+r_id,{
		  data:{stoid:getApp().globalData.setting.stoid},
		  success:function(res){
			   if(res.data.code==0){
				   th.setData({src:res.data.data.media_url})
			   }
		  }
	  })	  
  },
  //---加载更多是靠这个函数----
  onReachBottom: function() {
    var goods_list = this.selectComponent("#goods_list"); //组件的id
    if (goods_list) goods_list.get_list();
  },
  
})