123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- // pages/evaluationDetail/evaluationDetail.js
- const app = getApp()
- const util = require("../../utils/util")
- const urlDef = require("../../utils/urls")
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tipList: [
- '人均:该学生在本班历次得分的平均值\r\n',
- '班平:该班级内多有学生得分的平均值\r\n',
- '满星:第一个数是该学生在本班级得满分的次数,第二个数是已评分的次数\r\n',
- ],
- curVideo: '',
- videoFlag: 0,
- videoContext: '',
- curAudio: '',
- curAudioIndex: -1,
- audioPause: 0,
- item: null
- },
- 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 对象。
- const urls = urlDef.urls;
- let it = JSON.parse(options.item)
- if (it.imageUrl) {
- it.imageUrl = urls.oss_file + 'image/' + it.imageUrl
- } else {
- it.imageUrl = "/images/head.png"
- }
- let attachs;
- try {
- if (it.evaluateAttach) {
- attachs = JSON.parse(it.evaluateAttach);
- } else {
- attachs = {};
- }
- } catch (e) {
- console.error(JSON.stringify(e));
- }
- let stu = wx.getStorageSync('student')
- util.apiPost(urls.query_student_star + '&q.orgId=' + stu.orgId + '&q.studentId='
- + stu.studentId + '&q.headId=' + it.id).then((st) => {
- it.stars = st;
- this.reloadItems(it)
- }, e => {
- console.log(e);
- });
- if (attachs) {
- it.images = attachs.images ? attachs.images : [];
- it.videos = attachs.videos ? attachs.videos : [];
- it.records = attachs.records ? attachs.records : [];
- it.images.forEach(rs => {
- rs.url = urls.oss_file + 'image/' + rs.url
- });
- it.records.forEach(rs => {
- rs.url = urls.oss_file + 'file/' + rs.url
- });
- // 加载视频封面
- it.videos.forEach(r => {
- util.apiPost(urls.video_loadInfo + r.url).then((rs) => {
- r.imgUrl = rs.img;
- r.playUrl = rs.url;
- this.reloadItems(it)
- });
- });
- this.setData({ item: it })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- reloadItems: function (it) {
- this.setData({ item: it })
- },
- showImg: function (e) {
- var images = [];
- this.data.item.images.map(it => {
- images.push(it.url)
- })
- let url = e.currentTarget.dataset.url;
- console.log(url)
- wx.previewImage({
- urls: images,
- current: url
- })
- }
- })
|