// pages/evaluationDetail/evaluationDetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tipList:[
      '人均:该学生在本班历次得分的平均值\r\n',
      '班平:该班级内多有学生得分的平均值\r\n',
      '满星:第一个数是该学生在本班级得满分的次数,第二个数是已评分的次数\r\n',
    ],
    imgList:[
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
      'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg'
    ],
    curVideo: '',
    videoFlag: 0,
    videoContext: '',
    videoList:[
      {
        img: 'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
        url: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
      },
      {
        img: 'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
        url: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
      },
      {
        img: 'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
        url: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
      },
      {
        img: 'https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',
        url: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
      }
    ],
    curAudio: '',
    curAudioIndex: -1,
    audioPause: 0,
    audioList:[
      'https://gm-sycdn.kuwo.cn/2256fce37c86b5bc25065d780f769260/60347b85/resource/n2/73/81/1062648582.mp3',
      'https://gm-sycdn.kuwo.cn/2256fce37c86b5bc25065d780f769260/60347b85/resource/n2/73/81/1062648582.mp3',
    ],
  },

  getTip:function(){
    var str = ''
    for(var i in this.data.tipList){
      str+= this.data.tipList[i]
    }
    wx.showModal({
        title: '调课说明',
         content: str,
         showCancel: false,//是否显示取消按钮
         cancelText:"否",//默认是“取消”
         cancelColor:'#999999',//取消文字的颜色
         confirmText:"我知道了",//默认是“确定”
         confirmColor: 'skyblue',//确定文字的颜色
    })
  },

  bindfullscreenchange:function(){
    if(this.data.videoFlag == 0){
      this.setData({
        videoFlag : 1
      })
    } else {
      this.setData({
        videoFlag : 0,
        curVideo : ""
      })
    }
  },

  videoShow:function(e){
    this.setData({
      curVideo: e.currentTarget.dataset.url
    })
    
    this.videoContext.requestFullScreen({	// 设置全屏时视频的方向,不指定则根据宽高比自动判断。
			direction: 90						// 屏幕逆时针90度
		});
  },

  showImg:function(e){
    // var list = e.currentTarget.dataset.url
    wx.previewImage({
      urls: this.data.imgList,
    })
  },

  audioShow:function(e){
    if(this.data.audioPause == 0 && this.data.curAudioIndex != e.currentTarget.dataset.index){//播放语音,切换
      this.setData({
        curAudio: ""
      })
      this.setData({
        curAudioIndex: e.currentTarget.dataset.index,
        curAudio: e.currentTarget.dataset.url,
       
      })
      this.audioContext.play()
      this.setData({
        audioPause: 0
      })
    } else if(this.data.audioPause == 1 && this.data.curAudioIndex == e.currentTarget.dataset.index) {//暂停后恢复播放
        this.audioContext.play()
        this.setData({
          audioPause: 0
        })
    } else if(this.data.audioPause == 0 && this.data.curAudioIndex == e.currentTarget.dataset.index){//暂停播放
      this.audioContext.pause()
      this.setData({
        audioPause: 1
      })
    }
  },

  bindended:function(){
    this.setData({
      audioPause: 0,
      curAudioIndex: -1,
      curAudio: ''
    })
  },

  bindpause:function(){
    this.setData({
      audioPause: 1
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.audioContext = wx.createAudioContext('audio-play')
    this.videoContext = wx.createVideoContext('play-video');// 	创建 video 上下文 VideoContext 对象。
  },

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

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

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

  },

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

  },

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

  },

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

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})