123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- const app = getApp()
- const util = require("../../utils/util")
- const urlDef = require("../../utils/urls")
- const audioContext = wx.createInnerAudioContext()
- 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: "我知道了",
-
- })
- },
- 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
- });
- },
- showImg: function (e) {
-
- const index = e.currentTarget.dataset.index
- wx.previewImage({
- current: this.data.imgList[index],
- urls: this.data.imgList,
- })
- },
- showAudio: function (e) {
- const index = e.currentTarget.dataset.index
- if (this.data.curAudioIndex != index) {
- this.setData({
- curAudioIndex: index,
- })
- audioContext.src = this.data.item.records[index].url
- audioContext.play()
- audioContext.onEnded((res) => {
- this.setData({
- curAudioIndex: '-1',
- })
- })
- } else {
- if (this.data.audioPause) {
- audioContext.play()
- this.setData({
- audioPause: false
- })
- } else {
- audioContext.pause()
- this.setData({
- audioPause: true
- })
- }
- }
- },
- bindended: function () {
- this.setData({
- audioPause: 0,
- curAudioIndex: -1,
- curAudio: ''
- })
- },
- bindpause: function () {
- this.setData({
- audioPause: 1
- })
- },
-
- onLoad: function (options) {
- this.videoContext = wx.createVideoContext('play-video');
- 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.classesId=' + it.classesId + '&q.studentId='
- + stu.studentId + '&q.headId=' + it.headId).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 () {
- audioContext.stop()
- },
-
- 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
- })
- }
- })
|