Преглед изворни кода

完善成长轨迹(评价显星),完成作业接口对接

zhangshuling пре 3 година
родитељ
комит
839abef87f

+ 1 - 1
pages/Components/rating/rating.wxml

@@ -1,5 +1,5 @@
 <view>
-  <view class="rating-title" wx:for="{{5}}">
+  <view class="rating-title" >
     <view class="title">{{title}}</view>
     <view class="xing-view">
       <view wx:for="{{5}}" wx:key="index" class="xing-box">

+ 2 - 1
pages/Components/rating/rating.wxss

@@ -11,6 +11,7 @@
   font-size: 32rpx;
   height: 40rpx;
   line-height: 40rpx;
+  width: 150rpx;
 }
 .xing-box image{
   height: 100%;
@@ -18,5 +19,5 @@
 }
 .rating-title{
   width: 90%;
-  margin: 20rpx auto;
+  margin: 20rpx 0 auto;
 }

+ 239 - 42
pages/doTask/doTask.js

@@ -15,13 +15,16 @@ Page({
    * 页面的初始数据
    */
   data: {
+    homeworkId: null,
     talkFlag: false,
     closeName: '开始录音',
     videoList: [],
     videoFlag: 0,
     imgList: [],
-    audioList:[],
-    audioPause: false
+    audioList: [],
+    audioPause: false,
+    content: '',
+    delItems: []
   },
 
   getRecord: function () {
@@ -29,11 +32,11 @@ Page({
     if (that.data.talkFlag) {
       recordManager.stop()
       recordManager.onStop((res) => {  //监听录音停止的事件
-        console.log("监听录音停止事件",res)
+        console.log("监听录音停止事件", res)
         if (res.duration < 1000) {
           wx.showToast({
             title: '录音时间太短',
-            icon: none
+            icon: 'none'
           })
           return;
         } else {
@@ -49,12 +52,10 @@ Page({
               wx.showToast({
                 title: '上传成功',
               })
-            
               const rs = JSON.parse(JSON.parse(JSON.stringify(res.data)))
-              console.log(rs)
-              const list = [rs.data[0].url]
+              const list = [{ url: rs.data[0].url }]
               that.setData({
-                audioList:that.data.audioList.concat(list)
+                audioList: that.data.audioList.concat(list)
               })
             },
             fail(res) {
@@ -65,7 +66,7 @@ Page({
             },
             complete(res) {
               wx.hideLoading({
-                success: (res) => {},
+                success: (res) => { },
               })
             }
           })
@@ -86,7 +87,7 @@ Page({
                 const options = {}
                 recordManager.start(options)
               },
-              fail(){
+              fail() {
                 wx.openSetting({
                   withSubscriptions: true,
                 })
@@ -106,21 +107,21 @@ Page({
     }
   },
 
-  showAudio:function(e){
+  showAudio: function (e) {
     const index = e.currentTarget.dataset.index
-    if(this.data.curAudioIndex != index){
+    if (this.data.curAudioIndex != index) {
       this.setData({
         curAudioIndex: index,
       })
-      audioContext.src = this.data.audioList[index]
+      audioContext.src = this.data.audioList[index].url
       audioContext.play()
-      audioContext.onEnded((res)=>{
+      audioContext.onEnded((res) => {
         this.setData({
           curAudioIndex: '-1',
         })
       })
-    }else{
-      if(this.data.audioPause){
+    } else {
+      if (this.data.audioPause) {
         audioContext.play()
         this.setData({
           audioPause: false
@@ -131,20 +132,27 @@ Page({
           audioPause: true
         })
       }
-    } 
+    }
   },
 
-  delAudio:function(e){
+  delAudio: function (e) {
     const index = e.currentTarget.dataset.index
-    this.data.audioList.splice(index,1);
+    // this.data.audioList.splice(index, 1);
+    // this.setData({
+    //   audioList: this.data.audioList
+    // })
+
+    let records = this.data.audioList;
+    let record = records[index];
+    record.delete = 1
     this.setData({
-      audioList: this.data.audioList
+      audioList: records
     })
   },
 
   uploadTap: function () {
     const that = this
-    
+
     wx.chooseImage({
       count: 6,
       sourceType: ['album', 'camera'],
@@ -163,7 +171,7 @@ Page({
                 title: '上传成功',
               })
               const rs = JSON.parse(JSON.parse(JSON.stringify(res.data)))
-              const list = [rs.data[0].url]
+              const list = [{ url: rs.data[0].url }]
               that.setData({
                 imgList: that.data.imgList.concat(list)
               })
@@ -176,7 +184,7 @@ Page({
             },
             complete(res) {
               wx.hideLoading({
-                success: (res) => {},
+                success: (res) => { },
               })
             }
           })
@@ -187,17 +195,25 @@ Page({
 
   showImg: function (e) {
     const index = e.currentTarget.dataset.index
+    let images = this.data.imgList;
+    let imgs = []
+    images.map(i => {
+      imgs.push(i.url)
+    })
     wx.previewImage({
-      current: this.data.imgList[index],
-      urls: this.data.imgList,
+      current: images[index].url,
+      urls: imgs,
     })
   },
 
   delImg: function (e) {
     const index = e.currentTarget.dataset.index
-    this.data.imgList.splice(index, 1);
+    // this.data.imgList.splice(index, 1);
+    let images = this.data.imgList;
+    let image = images[index]
+    image.delete = 1
     this.setData({
-      imgList: this.data.imgList
+      imgList: images
     })
   },
 
@@ -235,7 +251,7 @@ Page({
 
   showVideo: function (e) {
     const index = e.currentTarget.dataset.index
-    const curVideo = this.data.videoList[index].src
+    const curVideo = this.data.videoList[index].playUrl
     this.setData({
       curVideo
     })
@@ -261,9 +277,15 @@ Page({
 
   delVideo: function (e) {
     const index = e.currentTarget.dataset.index
-    this.data.videoList.splice(index, 1);
+    // this.data.videoList.splice(index, 1);
+    // this.setData({
+    //   videoList: this.data.videoList
+    // })
+    let videos = this.data.videoList;
+    let video = videos[index]
+    video.delete = 1
     this.setData({
-      videoList: this.data.videoList
+      videoList: videos
     })
   },
 
@@ -271,6 +293,59 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    let urls = urlDef.urls;
+    let stu = wx.getStorageSync('student')
+    let homeworkId = options.homeworkId;
+    let studentId = stu.studentId;
+    this.setData({ homeworkId: homeworkId })
+
+    let params = { 'q.homeworkId': homeworkId, 'q.studentId': studentId }
+
+    util.apiPost(urls.homework_receive, params).then(rs => {
+    });
+
+    util.apiPost(urls.my_homework, params).then(rs => {
+      if (rs.length > 0) {
+        let entity = rs[0]
+        let contents;
+        try {
+          contents = JSON.parse(entity.content);
+        } catch (e) {
+          contents = {};
+          console.error(e);
+        }
+
+        this.setData({ content: contents.content })
+        let images = contents.images == null ? [] : contents.images;
+        images.forEach(r => {
+          r.url = urls.oss_file + 'image/' + r.url
+        });
+
+        let records = contents.records == null ? [] : contents.records;
+        records.forEach(r => {
+          r.url = urls.oss_file + 'file/' + r.url
+        });
+
+        let videos = contents.videos == null ? [] : contents.videos;
+
+        this.setData({
+          imgList: images,
+          audioList: records,
+          videoList: videos
+        });
+
+
+        videos.forEach(r => {
+          util.apiPost(urls.video_loadInfo + r.url).then(rs => {
+            r.imgUrl = rs.img
+            r.playUrl = rs.url
+            this.reloadVideos(r)
+          });
+        });
+      }
+    });
+
+
     this.videoContext = wx.createVideoContext('play-video'); // 	创建 video 上下文 VideoContext 对象。
     const that = this
     const createUpLoad = new VODUpload({
@@ -294,22 +369,32 @@ Page({
           //如果uploadInfo.videoId不存在,调用获取视频上传地址和凭证接口
         }
         //从点播服务获取的uploadAuth、uploadAddress和videoId,设置SDK
-        console.log(that.data)
+        // console.log(that.data)
         uploader.setUploadAuthAndAddress(uploadInfo, that.data.uploadAuth, that.data.uploadAddress, that.data.videoId);
       },
       //文件上传成功
       'onUploadSucceed': function (uploadInfo) {
-        // console.log("上传成功:" + JSON.stringify(uploadInfo))
-        var json = {
-          src: uploadInfo.url,
-          img: uploadInfo.coverUrl
-        }
-        var list = [json]
-        that.setData({
-          videoList: that.data.videoList.concat(list)
-        })
-        wx.showToast({
-          title: '上传成功',
+        console.log("上传成功:" + JSON.stringify(uploadInfo))
+
+        let vid = uploadInfo.videoId
+        let stu = wx.getStorageSync('student')
+        var video = { name: vid, videoId: vid, orgId: stu.orgId, size: uploadInfo.fileSize, title: '', content: '' };
+        // 保存一个 video
+        let urls = urlDef.urls
+        util.apiPost(urls.video_save, video, 'application/json').then((rs) => {
+          var json = {
+            url: uploadInfo.videoId,
+            playUrl: uploadInfo.url,
+            imgUrl: uploadInfo.coverUrl
+          }
+          console.log('视频上传成功' + JSON.stringify(json))
+          var list = [json]
+          that.setData({
+            videoList: that.data.videoList.concat(list)
+          })
+          wx.showToast({
+            title: '上传成功',
+          })
         })
         // console.log("onUploadSucceed: " + uploadInfo.file.name + ", endpoint:" + uploadInfo.endpoint + ", bucket:" + uploadInfo.bucket + ", object:" + uploadInfo.object);
       },
@@ -389,5 +474,117 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  doConfirmComplete: function () {
+    console.log('homeworkId ' + this.data.homeworkId)
+    let contents = {};
+
+    let dlist = [];
+    let images = [];
+    if (this.data.imgList.length > 0) {
+      this.data.imgList.forEach(r => {
+        let fid = r.url.substring(r.url.lastIndexOf('/') + 1)
+        if (r.delete == 1) {
+          dlist.push({ id: fid, type: 'image' })
+        } else {
+          images.push({ url: fid })
+        }
+      });
+    }
+
+    let records = [];
+    if (this.data.audioList.length > 0) {
+      this.data.audioList.forEach(r => {
+        let fid = r.url.substring(r.url.lastIndexOf('/') + 1)
+        if (r.delete == 1) {
+          dlist.push({ id: fid, type: 'record' })
+        } else {
+          records.push({ url: fid })
+        }
+      });
+    }
+
+    let videos = [];
+    if (this.data.videoList.length > 0) {
+      this.data.videoList.forEach(r => {
+        if (r.delete == 1) {
+          dlist.push({ id: r.url, type: 'video' })
+        } else {
+          videos.push({ url: r.url })
+        }
+      });
+    }
+
+    this.setData({ delItems: dlist })
+    contents.images = images;
+    contents.videos = videos;
+    contents.records = records;
+    contents.content = this.data.content;
+
+    let stu = wx.getStorageSync('student')
+    let data = {
+      'q.content': JSON.stringify(contents),
+      'q.status': 1,
+      'q.studentId': stu.studentId,
+      'q.homeworkId': this.data.homeworkId
+    }
+
+    util.apiPost(urls.complete_homework, data).then(rs => {
+
+      const msgParams = { 'homeworkId': this.data.homeworkId, 'studentId': stu.studentId };
+      util.apiPost(urls.homework_complete_send_message, msgParams).then((rs) => {
+        console.log('发送通知 ' + JSON.stringify(rs));
+      });
+
+      wx.showToast({
+        title: '已完成作业'
+      })
+      setTimeout(() => {
+        wx.navigateBack({
+          delta: 2, // 返回上一级页面。
+          success: function () {
+            console.log('成功!')
+          }
+        })
+      }, 1000)
+      // 删除文件
+      if (this.data.delItems.length > 0) {
+        // 视频的删除跟文件的删除不一样
+        let delFiles = [];
+        let delVideos = [];
+        this.data.delItems.forEach(r => {
+          if (r.type === 'video') {
+            delVideos.push(r.id);
+          } else {
+            delFiles.push(r.id);
+          }
+        });
+        if (delFiles.length > 0) {
+          const params = { 'keys': delFiles };
+          util.apiPost(urls.file_delete, params).then((rs) => {
+            console.log('删除文件 ... ' + JSON.stringify(params));
+          });
+        }
+        if (delVideos.length > 0) {
+          const params = { 'ids[]': delVideos }
+          util.apiPost(urls.video_delete, params).then((rs) => {
+            console.log('删除视频 ... ' + JSON.stringify(params));
+          });
+        }
+      }
+    })
+
+  },
+  reloadVideos: function (v) {
+    let videos = this.data.videoList
+    videos.map(o => {
+      if (o.url == v.url) {
+        o = v;
+      }
+    })
+    this.setData({ videoList: videos })
+  },
+  doInput: function (e) {
+    this.setData({ content: e.detail.value })
   }
 })

+ 10 - 8
pages/doTask/doTask.wxml

@@ -11,15 +11,15 @@
   <view class="my-task">
     <view class="title">作业完成情况</view>
     <view class="textarea">
-      <textarea placeholder="输入答题内容(200字以内)" maxlength="200"></textarea>
-      <view class="wordNum">0/200</view>
+      <textarea placeholder="输入答题内容(200字以内)" maxlength="200" value="{{content}}" bindinput="doInput"></textarea>
+      <view class="wordNum">{{content.length}}/200</view>
     </view>
 
     <view class="title">上传图片</view>
     <view class="uploadImg-task-view">
-      <view class="my-img-view" wx:for="{{imgList}}" wx:key="index" data-index="{{index}}" catchtap="showImg">
+      <view class="my-img-view" wx:for="{{imgList}}" wx:key="index" data-index="{{index}}" catchtap="showImg" wx:if="{{item.delete != 1}}">
         <view class="new-task-img">
-          <image src="{{item}}"></image>
+          <image src="{{item.url}}"></image>
         </view>
         <view class="del-btn" data-index="{{index}}" catchtap="delImg">X</view>
       </view>
@@ -35,9 +35,9 @@
       src="{{curVideo}}" controls="true" downloadlist></video>
     <view class="title">上传视频</view>
     <view class="uploadImg-task-view">
-      <view class="my-img-view" wx:for="{{videoList}}" wx:key="index" data-index="{{index}}" catchtap="showVideo">
+      <view class="my-img-view" wx:for="{{videoList}}" wx:key="index" data-index="{{index}}" catchtap="showVideo"  wx:if="{{item.delete != 1}}">
         <view class="new-task-img">
-          <image src="{{item.img}}"></image>
+          <image src="{{item.imgUrl}}"></image>
         </view>
         <view class="del-btn" data-index="{{index}}" catchtap="delVideo">X</view>
       </view>
@@ -52,7 +52,7 @@
     <audio id="audio-play" bindpause="bindpause" bindended="bindended" src="{{curAudio}}"></audio>
     <view class="title">上传录音</view>
     <view class="audio-list">
-      <view class="audio-box" wx:for="{{audioList}}" wx:key="index">
+      <view class="audio-box" wx:for="{{audioList}}" wx:key="index"  wx:if="{{item.delete != 1}}">
         <image bindtap="audioShow" src="{{index == curAudioIndex ? '/images/cur-audio.png' : '/images/audio.png'}}"
         class="{{index == curAudioIndex ? 'curAudioStyle' : ''}}" 
         data-index="{{index}}"  catchtap="showAudio"></image>
@@ -70,5 +70,7 @@
 
   </view>
   <!-- end -->
-
+  <view class="toTask" bindtap="doConfirmComplete">
+   完成
+  </view>
 </view>

+ 15 - 0
pages/doTask/doTask.wxss

@@ -199,4 +199,19 @@
 
 .curTalkStyle{
   border-color: #cc6031;
+}
+
+.toTask {
+  width: 400rpx;
+  height: 80rpx;
+  text-align: center;
+  line-height: 80rpx;
+  color: #FFF;
+  background: #cc6031;
+  border-radius: 50rpx;
+  font-size: 36rpx;
+  position: fixed;
+  bottom: 40rpx;
+  left: 50%;
+  margin-left: -200rpx;
 }

+ 49 - 33
pages/evaluation/evaluation.js

@@ -1,25 +1,29 @@
 // pages/evaluation/evaluation.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
+    beginDate: null,
+    endDate: null,
+    flag: 0,
+    list: [
+    ],
     loading: '上拉加载',
     flag: 0,
-    list:[
-      {},
-      {},
-      {},
-      {},
-      {},
-      {},
-    ]
+    pageNum: 0,
+    hasNextPage: true,
   },
 
-  getMore:function(e){
+  getMore: function (e) {
+    let id = e.currentTarget.dataset.id;
+    let item = this.data.list.filter(o => o.id == id)[0]
     wx.navigateTo({
-      url: '/pages/evaluationDetail/evaluationDetail',
+      url: '/pages/evaluationDetail/evaluationDetail?item='+JSON.stringify(item)
     })
   },
 
@@ -27,7 +31,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    let now = new Date();
+    // 显示近7天的预约记录
+    let ed = util.formatTime(now).substring(0, 10).replace(/\//g, '-')
+    let bd = ed.substring(0, 5) + '01-01'
+    this.setData({ beginDate: bd, endDate: ed, list: [] });
+    this.queryList()
   },
 
   /**
@@ -69,28 +78,10 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    if (this.data.flag == 0) {
-      this.setData({
-        loading: '加载中',
-        flag: 1
-      })
-      setTimeout(() => {
-        this.setData({
-          list: [{},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-          ],
-          loading: '没有更多数据',
-          flag: 2
-        })
-      }, 2000);
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
     }
   },
 
@@ -99,5 +90,30 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  queryList: function () {
+    const urls = urlDef.urls;
+    let stu = wx.getStorageSync('student')
+    let params = { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId, 'q.orgId': stu.orgId }
+    params.pageNum = this.data.pageNum
+    util.apiPost(urls.get_student_comment, params).then(rs => {
+      let list = rs.list
+      list.map(o => {
+        if (o.attendTime) {
+          o.attendTime = o.attendTime.substring(0, 10)
+        }
+        if (o.beginTime) {
+          o.beginTime = o.beginTime.substring(11, 17)
+        }
+        if (o.endTime) {
+          o.endTime = o.endTime.substring(11, 17)
+        }
+      })
+      this.setData({
+        'hasNextPage': rs.hasNextPage,
+        'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+        'list': this.data.list.concat(list)
+      })
+    })
   }
 })

+ 6 - 6
pages/evaluation/evaluation.wxml

@@ -7,12 +7,12 @@
   <view class="evaluation-view">
     <view class="evaluation-list">
       <view class="evaluation-box" wx:for="{{list}}" wx:key="index">
-        <view class="flag">集体</view>
-        <view class="title">小鹏钢琴课</view>
-        <view class="date">2021-02-24</view>
-        <view class="time">14:00 ~ 14:50</view>
-        <view class="teacher">老师:小象</view>
-        <view class="more" bindtap="getMore">查看详情</view>
+        <view class="flag">{{item.kind==1?'1v1':'集体'}}</view>
+        <view class="title">{{item.classesName}}</view>
+        <view class="date">{{item.attendTime}}</view>
+        <view class="time">{{item.beginTime}} ~ {{item.endTime}}</view>
+        <view class="teacher">老师: {{item.teacherName}}</view>
+        <view class="more" bindtap="getMore" data-id="{{item.id}}">查看详情</view>
       </view>
     </view>
   </view>

+ 104 - 62
pages/evaluationDetail/evaluationDetail.js

@@ -1,102 +1,75 @@
 // pages/evaluationDetail/evaluationDetail.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    tipList:[
+    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',
-    ],
+    item: null
   },
 
-  getTip:function(){
+  getTip: function () {
     var str = ''
-    for(var i in this.data.tipList){
-      str+= this.data.tipList[i]
+    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',//确定文字的颜色
+      title: '调课说明',
+      content: str,
+      showCancel: false,//是否显示取消按钮
+      cancelText: "否",//默认是“取消”
+      cancelColor: '#999999',//取消文字的颜色
+      confirmText: "我知道了",//默认是“确定”
+      confirmColor: 'skyblue',//确定文字的颜色
     })
   },
 
-  bindfullscreenchange:function(){
-    if(this.data.videoFlag == 0){
+  bindfullscreenchange: function () {
+    if (this.data.videoFlag == 0) {
       this.setData({
-        videoFlag : 1
+        videoFlag: 1
       })
     } else {
       this.setData({
-        videoFlag : 0,
-        curVideo : ""
+        videoFlag: 0,
+        curVideo: ""
       })
     }
   },
 
-  videoShow:function(e){
+  videoShow: function (e) {
     this.setData({
       curVideo: e.currentTarget.dataset.url
     })
-    
+
     this.videoContext.requestFullScreen({	// 设置全屏时视频的方向,不指定则根据宽高比自动判断。
-			direction: 90						// 屏幕逆时针90度
-		});
+      direction: 90						// 屏幕逆时针90度
+    });
   },
 
-  showImg:function(e){
+  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){//播放语音,切换
+  audioShow: function (e) {
+    if (this.data.audioPause == 0 && this.data.curAudioIndex != e.currentTarget.dataset.index) {//播放语音,切换
       this.setData({
         curAudio: ""
       })
@@ -108,12 +81,12 @@ Page({
       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){//暂停播放
+    } 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
@@ -121,7 +94,7 @@ Page({
     }
   },
 
-  bindended:function(){
+  bindended: function () {
     this.setData({
       audioPause: 0,
       curAudioIndex: -1,
@@ -129,7 +102,7 @@ Page({
     })
   },
 
-  bindpause:function(){
+  bindpause: function () {
     this.setData({
       audioPause: 1
     })
@@ -142,6 +115,60 @@ Page({
   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 })
+    }
+
   },
 
   /**
@@ -191,5 +218,20 @@ Page({
    */
   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
+    })
   }
 })

+ 3 - 1
pages/evaluationDetail/evaluationDetail.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "课堂点评",
-  "usingComponents": {}
+  "usingComponents": {
+    "rating":"/pages/Components/rating/rating"
+  }
 }

+ 12 - 10
pages/evaluationDetail/evaluationDetail.wxml

@@ -6,19 +6,21 @@
 
   <!-- 点评内容 -->
   <view class="class-title">
-    <view class="class-type">集体</view>
-    <view class="class-name">小鹏钢琴课</view>
-    <view class="class-date">2021-02-21</view>
+    <view class="class-type">{{item.kind==1?'1v1':'集体'}}</view>
+    <view class="class-name">{{item.classesName}}</view>
+    <view class="class-date">{{item.attendTime}}</view>
   </view>
   <view class="class-teacher">
     <view class="teacher-img">
-      <image src="/images/head.png"></image>
+      <image src="{{item.imageUrl}}"></image>
     </view>
     <view class="teacher-name">张老师</view>
-    <view class="contact-teacher">联系老师</view>
   </view>
+  <view class="stars">
+      <rating wx:for="{{item.stars}}" wx:for-item="star" score="{{star.evaluateStar}}" title="{{star.detailName}}"/>
+    </view>
   <view class="class-desc">
-    点评内容:这是一条测试数据这是一条测试数据这是一条测试数据这是一条测试数据这是一条测试数据这是一条测试数据
+    点评内容:{{item.evaluateContent}}
   </view>
   <!-- end -->
 
@@ -26,15 +28,15 @@
   <view class="img-content">
     <view class="title">图片</view>
     <view class="img-box">
-      <image src="/images/logo.png" wx:for="{{imgList}}" wx:key="index"></image>
+      <image src="{{item.url}}" wx:for="{{item.images}}" wx:key="index" bindtap="showImg" data-url="{{item.url}}"></image>
     </view>
   </view>
 
   <view class="video-content">
     <view class="title">视频</view>
     <view class="video-list">
-      <view wx:for="{{videoList}}" wx:key="index" class="video-img-view" data-url="{{item.url}}" bindtap="videoShow">
-        <image class="videoImg" src="{{item.img}}" mode="aspectFill"></image>
+      <view wx:for="{{item.videos}}" wx:key="index" class="video-img-view" data-url="{{item.playUrl}}" bindtap="videoShow">
+        <image class="videoImg" src="{{item.imgUrl}}" mode="aspectFill"></image>
         <image class="playImg" src="/images/play.png"></image>
       </view>
     </view>
@@ -46,7 +48,7 @@
     <view class="title">语音</view>
     <view class="audio-list">
       <image bindtap="audioShow" src="{{index == curAudioIndex ? '/images/cur-audio.png' : '/images/audio.png'}}"
-        class="{{index == curAudioIndex ? 'curAudioStyle' : ''}}" wx:for="{{audioList}}" wx:key="index"
+        class="{{index == curAudioIndex ? 'curAudioStyle' : ''}}" wx:for="{{item.records}}" wx:key="index"
         data-index="{{index}}" data-url="{{item}}"></image>
     </view>
     <audio id="audio-play" bindpause="bindpause" bindended="bindended" src="{{curAudio}}"></audio>

+ 6 - 1
pages/evaluationDetail/evaluationDetail.wxss

@@ -54,7 +54,7 @@
   color: #cc6031;
 }
 .class-desc{
-  padding: 5rpx 25rpx;
+  padding: 15rpx 25rpx;
   line-height: 40rpx;
   color: #666;
 }
@@ -128,4 +128,9 @@
   position: absolute;
   top: 40rpx;
   left: 100rpx;
+}
+
+.stars{
+  width:90%;
+  margin : auto;
 }

+ 7 - 5
pages/growUp/growUp.js

@@ -58,7 +58,8 @@ Page({
       }
     })
     wx.previewImage({
-      urls: images
+      urls: images,
+      current: e.currentTarget.dataset.url
     })
   },
   audioShow: function (e) {
@@ -187,7 +188,8 @@ Page({
         if (it.type === '1') {
           util.apiPost(urls.query_student_star + '&q.orgId=' + this.data.orgId + '&q.studentId='
             + this.data.studentId + '&q.headId=' + it.id).then((st) => {
-              it.star = st;
+              it.stars = st;
+              this.reloadItems(it)
             }, e => {
               console.log(e);
             });
@@ -220,7 +222,7 @@ Page({
               util.apiPost(urls.video_loadInfo + r.url).then((rs) => {
                 r.imgUrl = rs.img;
                 r.playUrl = rs.url;
-                this.reloadVideos(it)
+                this.reloadItems(it)
               });
             });
 
@@ -229,7 +231,7 @@ Page({
           util.apiPost(urls.video_loadInfo + it.evaluateAttach).then((rs) => {
             it.imgUrl = rs.img;
             it.playUrl = rs.url;
-            this.reloadVideos(it)
+            this.reloadItems(it)
           });
 
         }
@@ -242,7 +244,7 @@ Page({
       })
     })
   },
-  reloadVideos: function (t) {
+  reloadItems: function (t) {
     let list = this.data.list;
     list.map(it => {
       if (it.id == t.id) {

+ 3 - 1
pages/growUp/growUp.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
+  "usingComponents": {
+  "rating":"/pages/Components/rating/rating"
+  }
 }

+ 3 - 1
pages/growUp/growUp.wxml

@@ -7,8 +7,10 @@
         <view class="grow-title" wx:if="{{item.type == '1'}}">
           <view class="grow-time">{{item.beginTime}}</view>
           <view class="grow-name">{{item.classesName}} : {{item.name}}</view>
+          <view>
+           <rating wx:for="{{item.stars}}" wx:for-item="star" score="{{star.evaluateStar}}" title="{{star.detailName}}"/>
+          </view>
           <view class="grow-content">{{item.evaluateContent}}</view>
-
           <view class="task-content">
             <view class="title">图片</view>
             <view class="img-list">

+ 58 - 57
pages/index/index.js

@@ -12,64 +12,64 @@ Page({
     index: 0,
     curStu: {},
     classList: [{
-        img: '/images/kc.png',
-        title: '今日课程',
-        num: '0',
-        url: "/pages/schedule/schedule"
-      },
-      {
-        img: '/images/jtzy.png',
-        title: '今日作业',
-        num: '0',
-        url: "/pages/task/task"
-      },
-      {
-        img: '/images/cq.png',
-        title: '出勤率',
-        num: '0%',
-        url: "/pages/classTotalList/classTotalList"
-      },
+      img: '/images/kc.png',
+      title: '今日课程',
+      num: '0',
+      url: "/pages/schedule/schedule"
+    },
+    {
+      img: '/images/jtzy.png',
+      title: '今日作业',
+      num: '0',
+      url: "/pages/task/task"
+    },
+    {
+      img: '/images/cq.png',
+      title: '出勤率',
+      num: '0%',
+      url: "/pages/classTotalList/classTotalList"
+    },
     ],
     appList: [{
-        img: '/images/kb.png',
-        title: '我的课表',
-        url: "/pages/schedule/schedule"
-      },
-      {
-        img: '/images/zy.png',
-        title: '提交作业',
-        url: "/pages/task/task"
-      },
-      {
-        img: '/images/dp.png',
-        title: '课堂点评',
-        url: "/pages/evaluation/evaluation"
-      },
-      {
-        img: '/images/zj.png',
-        title: '成长足迹',
-        url: "/pages/growUp/growUp"
-      },
-      {
-        img: '/images/qj.png',
-        title: '请假',
-        url: "/pages/leave/leave"
-      },
-      {
-        img: '/images/bk.png',
-        title: '补课',
-        url: "/pages/lessons/lessons"
-      },
-      {
-        img: '/images/jk.png',
-        title: '加课',
-        url: "/pages/addClass/addClass"
-      },
-      {
-        img: '/images/dk.png',
-        title: '调课',
-        url: "/pages/theClasses/theClasses"
-      },
+      img: '/images/kb.png',
+      title: '我的课表',
+      url: "/pages/schedule/schedule"
+    },
+    {
+      img: '/images/zy.png',
+      title: '提交作业',
+      url: "/pages/task/task"
+    },
+    {
+      img: '/images/dp.png',
+      title: '课堂点评',
+      url: "/pages/evaluation/evaluation"
+    },
+    {
+      img: '/images/zj.png',
+      title: '成长足迹',
+      url: "/pages/growUp/growUp"
+    },
+    {
+      img: '/images/qj.png',
+      title: '请假',
+      url: "/pages/leave/leave"
+    },
+    {
+      img: '/images/bk.png',
+      title: '补课',
+      url: "/pages/lessons/lessons"
+    },
+    {
+      img: '/images/jk.png',
+      title: '加课',
+      url: "/pages/addClass/addClass"
+    },
+    {
+      img: '/images/dk.png',
+      title: '调课',
+      url: "/pages/theClasses/theClasses"
+    },
     ],
     bannerList: [],
     userList: [],
@@ -137,8 +137,9 @@ Page({
     if (typeof e.currentTarget.dataset.url == 'undefined') {
       return
     }
+    let today = util.curTime().substring(0, 10).replace(/\//g, '-')
     wx.navigateTo({
-      url: e.currentTarget.dataset.url,
+      url: e.currentTarget.dataset.url + '?beginDate=' + today + '&endDate=' + today,
     })
   },
 

+ 5 - 1
pages/task/task.js

@@ -50,6 +50,8 @@ Page({
   onLoad: function (options) {
     let bd = options.beginDate
     let ed = options.endDate
+    bd = '2020-01-01'
+    ed = '2021-03-01'
     if (bd && ed) {
       this.setData({ 'beginDate': bd, 'endDate': ed })
     } else {
@@ -62,13 +64,15 @@ Page({
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-    this.queryList()
+
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    this.setData({ list: [] })
+    this.queryList()
   },
 
   /**

+ 17 - 9
pages/taskDetail/taskDetail.js

@@ -54,7 +54,8 @@ Page({
     });
 
     wx.previewImage({
-      urls: list
+      urls: list,
+      current: e.currentTarget.dataset.url
     })
   },
   showDoneImg: function (e) {
@@ -63,7 +64,8 @@ Page({
       list.push(o.url);
     });
     wx.previewImage({
-      urls: list
+      urls: list,
+      current: e.currentTarget.dataset.url
     })
   },
   showMarkImg: function (e) {
@@ -72,25 +74,26 @@ Page({
       list.push(o.url);
     });
     wx.previewImage({
-      urls: list
+      urls: list,
+      current: e.currentTarget.dataset.url
     })
   },
 
-  showAudio:function(e){
+  showAudio: function (e) {
     const index = e.currentTarget.dataset.index
-    if(this.data.curAudioIndex != index){
+    if (this.data.curAudioIndex != index) {
       this.setData({
         curAudioIndex: index,
       })
       audioContext.src = this.data.audioList[index]
       audioContext.play()
-      audioContext.onEnded((res)=>{
+      audioContext.onEnded((res) => {
         this.setData({
           curAudioIndex: '-1',
         })
       })
-    }else{
-      if(this.data.audioPause){
+    } else {
+      if (this.data.audioPause) {
         audioContext.play()
         this.setData({
           audioPause: false
@@ -101,7 +104,7 @@ Page({
           audioPause: true
         })
       }
-    } 
+    }
   },
 
   bindended: function () {
@@ -340,5 +343,10 @@ Page({
       }
     })
     this.setData({ entity: o })
+  },
+  toTask: function(e) {
+    wx.navigateTo({
+      url:  '/pages/doTask/doTask?homeworkId='+ this.data.homeworkId
+    })
   }
 })

+ 3 - 3
pages/taskDetail/taskDetail.wxml

@@ -42,7 +42,7 @@
   <!-- end -->
 
   <!-- 作业完成情况 -->
- <view class="done-view" wx:if="{{!doTaskFlag}}">
+ <view class="done-view" wx:if="{{entity.status > 0}}">
   <view class="done-title">作业完成情况</view>
   <view class="task-content">
       <view class="task-desc">
@@ -74,7 +74,7 @@
 
 
    <!-- 作业批改情况 -->
- <view class="done-view" wx:if="{{!doTaskFlag}}">
+ <view class="done-view" wx:if="{{entity.markResult && entity.markResult.length > 0}}">
   <view class="done-title">作业批阅情况</view>
   <view class="task-content">
     <view class="title">得分: {{entity.mark.score}}</view>
@@ -105,7 +105,7 @@
  </view>
   <!-- end -->
 
-  <view class="toTask" bindtap="toTask" wx:if="{{doTaskFlag}}">
+  <view class="toTask" bindtap="toTask">
     做作业
   </view>