فهرست منبع

Signed-off-by: yukangzhe <382985154@qq.com>

yukangzhe 4 سال پیش
والد
کامیت
19b301672f

+ 100 - 36
pages/doTask/doTask.js

@@ -15,6 +15,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    uploadIng: false,
     homeworkId: null,
     talkFlag: false,
     closeName: '开始录音',
@@ -25,17 +26,17 @@ Page({
     audioPause: false,
     content: '',
     delItems: [],
-    contents:null,
+    contents: null,
   },
 
-  renderTime:function(date) { 
-    var dateee = new Date(date).toJSON(); 
-    return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')  
-  }, 
+  renderTime: function (date) {
+    var dateee = new Date(date).toJSON();
+    return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
+  },
 
   getRecord: function () {
     const that = this
-    if(that.data.audioList.length>=6){
+    if (that.data.audioList.length >= 6) {
       wx.showToast({
         title: '最多上传6段录音',
         icon: 'none'
@@ -44,7 +45,7 @@ Page({
     }
     if (that.data.talkFlag) {
       recordManager.stop()
-      recordManager.onStop((res) => {  //监听录音停止的事件
+      recordManager.onStop((res) => { //监听录音停止的事件
         console.log("监听录音停止事件", res)
         if (res.duration < 1000) {
           wx.showToast({
@@ -66,7 +67,9 @@ Page({
                 title: '上传成功',
               })
               const rs = JSON.parse(JSON.parse(JSON.stringify(res.data)))
-              const list = [{ url: rs.data[0].url }]
+              const list = [{
+                url: rs.data[0].url
+              }]
               that.setData({
                 audioList: that.data.audioList.concat(list)
               })
@@ -79,7 +82,7 @@ Page({
             },
             complete(res) {
               wx.hideLoading({
-                success: (res) => { },
+                success: (res) => {},
               })
             }
           })
@@ -165,7 +168,7 @@ Page({
 
   uploadTap: function () {
     const that = this
-    if(that.data.imgList.length>=6){
+    if (that.data.imgList.length >= 6) {
       wx.showToast({
         title: '最多上传6张图片',
         icon: 'none'
@@ -190,7 +193,9 @@ Page({
                 title: '上传成功',
               })
               const rs = JSON.parse(JSON.parse(JSON.stringify(res.data)))
-              const list = [{ url: rs.data[0].url }]
+              const list = [{
+                url: rs.data[0].url
+              }]
               that.setData({
                 imgList: that.data.imgList.concat(list)
               })
@@ -203,7 +208,7 @@ Page({
             },
             complete(res) {
               wx.hideLoading({
-                success: (res) => { },
+                success: (res) => {},
               })
             }
           })
@@ -238,7 +243,7 @@ Page({
 
   upLoadVideo: function () {
     const that = this
-    if(that.data.videoList.length>=6){
+    if (that.data.videoList.length >= 6) {
       wx.showToast({
         title: '最多上传6部视频',
         icon: 'none'
@@ -265,6 +270,12 @@ Page({
             uploadAddress: d.UploadAddress,
             videoId: d.VideoId,
           })
+          wx.showLoading({
+            title: '上传中...',
+          })
+          that.setData({
+            uploadIng: true
+          })
           uploader.addFile(file, null, null, null, userData)
           uploader.startUpload();
           // uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress, videoId);
@@ -323,12 +334,16 @@ Page({
     let stu = wx.getStorageSync('student')
     let homeworkId = options.homeworkId;
     let studentId = stu.studentId;
-    this.setData({ homeworkId: homeworkId })
+    this.setData({
+      homeworkId: homeworkId
+    })
 
-    let params = { 'q.homeworkId': homeworkId, 'q.studentId': studentId }
+    let params = {
+      'q.homeworkId': homeworkId,
+      'q.studentId': studentId
+    }
 
-    util.apiPost(urls.homework_receive, params).then(rs => {
-    });
+    util.apiPost(urls.homework_receive, params).then(rs => {});
 
     util.apiPost(urls.my_homework, params).then(rs => {
       if (rs.length > 0) {
@@ -336,7 +351,7 @@ Page({
         let contents;
         try {
           contents = entity
-          contents.receiveDate=this.renderTime(contents.receiveDate)
+          contents.receiveDate = this.renderTime(contents.receiveDate)
           this.setData({
             contents
           })
@@ -345,7 +360,9 @@ Page({
           console.error(e);
         }
 
-        this.setData({ content: contents.content })
+        this.setData({
+          content: contents.content
+        })
         let images = contents.images == null ? [] : contents.images;
         images.forEach(r => {
           r.url = urls.oss_file + 'image/' + r.url
@@ -387,10 +404,7 @@ Page({
       retryDuration: 2,
       //开始上传
       'onUploadstarted': function (uploadInfo) {
-        wx.showLoading({
-          title: '上传中...',
-          mask: true
-        })
+        console.log("开始上传")
         // console.log("onUploadStarted:" + uploadInfo.file.name + ", endpoint:" + uploadInfo.endpoint + ", bucket:" + uploadInfo.bucket + ", object:" + uploadInfo.object)
         //上传方式1,需要根据uploadInfo.videoId是否有值,调用点播的不同接口获取uploadauth和uploadAddress,如果videoId有值,调用刷新视频上传凭证接口,否则调用创建视频上传凭证接口
         if (uploadInfo.videoId) {
@@ -408,7 +422,14 @@ Page({
 
         let vid = uploadInfo.videoId
         let stu = wx.getStorageSync('student')
-        var video = { name: vid, videoId: vid, orgId: stu.orgId, size: uploadInfo.fileSize, title: '', content: '' };
+        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) => {
@@ -425,6 +446,9 @@ Page({
           wx.showToast({
             title: '上传成功',
           })
+          that.setData({
+            uploadIng: false
+          })
         })
         // console.log("onUploadSucceed: " + uploadInfo.file.name + ", endpoint:" + uploadInfo.endpoint + ", bucket:" + uploadInfo.bucket + ", object:" + uploadInfo.object);
       },
@@ -457,6 +481,18 @@ Page({
     uploader = createUpLoad
   },
 
+  removeUpload: function () {
+    uploader.stopUpload()
+    uploader.cleanList();
+    wx.showToast({
+      title: '取消上传',
+      icon: 'none'
+    })
+    this.setData({
+      uploadIng: false
+    })
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -515,9 +551,14 @@ Page({
       this.data.imgList.forEach(r => {
         let fid = r.url.substring(r.url.lastIndexOf('/') + 1)
         if (r.delete == 1) {
-          dlist.push({ id: fid, type: 'image' })
+          dlist.push({
+            id: fid,
+            type: 'image'
+          })
         } else {
-          images.push({ url: fid })
+          images.push({
+            url: fid
+          })
         }
       });
     }
@@ -527,9 +568,14 @@ Page({
       this.data.audioList.forEach(r => {
         let fid = r.url.substring(r.url.lastIndexOf('/') + 1)
         if (r.delete == 1) {
-          dlist.push({ id: fid, type: 'record' })
+          dlist.push({
+            id: fid,
+            type: 'record'
+          })
         } else {
-          records.push({ url: fid })
+          records.push({
+            url: fid
+          })
         }
       });
     }
@@ -538,14 +584,21 @@ Page({
     if (this.data.videoList.length > 0) {
       this.data.videoList.forEach(r => {
         if (r.delete == 1) {
-          dlist.push({ id: r.url, type: 'video' })
+          dlist.push({
+            id: r.url,
+            type: 'video'
+          })
         } else {
-          videos.push({ url: r.url })
+          videos.push({
+            url: r.url
+          })
         }
       });
     }
 
-    this.setData({ delItems: dlist })
+    this.setData({
+      delItems: dlist
+    })
     contents.images = images;
     contents.videos = videos;
     contents.records = records;
@@ -561,7 +614,10 @@ Page({
 
     util.apiPost(urls.complete_homework, data).then(rs => {
 
-      const msgParams = { 'homeworkId': this.data.homeworkId, 'studentId': stu.studentId };
+      const msgParams = {
+        'homeworkId': this.data.homeworkId,
+        'studentId': stu.studentId
+      };
       util.apiPost(urls.homework_complete_send_message, msgParams).then((rs) => {
         console.log('发送通知 ' + JSON.stringify(rs));
       });
@@ -590,13 +646,17 @@ Page({
           }
         });
         if (delFiles.length > 0) {
-          const params = { 'keys': delFiles };
+          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 }
+          const params = {
+            'ids[]': delVideos
+          }
           util.apiPost(urls.video_delete, params).then((rs) => {
             console.log('删除视频 ... ' + JSON.stringify(params));
           });
@@ -612,9 +672,13 @@ Page({
         o = v;
       }
     })
-    this.setData({ videoList: videos })
+    this.setData({
+      videoList: videos
+    })
   },
   doInput: function (e) {
-    this.setData({ content: e.detail.value })
+    this.setData({
+      content: e.detail.value
+    })
   }
 })

+ 2 - 0
pages/doTask/doTask.wxml

@@ -47,6 +47,8 @@
           <view>添加视频</view>
         </view>
       </view>
+      <view class="removeUploadBg" wx:if="{{uploadIng}}"></view>
+      <view class="removeUpload" wx:if="{{uploadIng}}" >取消上传</view>
     </view>
 
     <audio id="audio-play" bindpause="bindpause" bindended="bindended" src="{{curAudio}}"></audio>

+ 22 - 0
pages/doTask/doTask.wxss

@@ -214,4 +214,26 @@
   left: 50%;
   margin-left: -200rpx;
   margin-top: 60rpx;
+}
+.removeUpload{
+  position: fixed;
+  width: 200rpx;
+  left: 50%;
+  margin-left: -100rpx;
+  height: 80rpx;
+  line-height: 80rpx;
+  background: #eee;
+  text-align: center;
+  margin-top: -200rpx;
+  z-index: 2;
+}
+.removeUploadBg{
+  background: #333;
+  opacity: 0.1;
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 750rpx;
+  height: 100%;
+  z-index: 1;
 }

+ 1 - 2
pages/evaluationDetail/evaluationDetail.js

@@ -1,7 +1,7 @@
 // pages/evaluationDetail/evaluationDetail.js
 const app = getApp()
 const util = require("../../utils/util")
-const urlDef = require("../../utils/urls")
+const urlDef = require("../../utils/urls") 
 
 const audioContext = wx.createInnerAudioContext() //音频播放对象
 Page({
@@ -123,7 +123,6 @@ Page({
     const urls = urlDef.urls;
     let it = JSON.parse(options.item)
 
-
     if (it.imageUrl) {
       it.imageUrl = urls.oss_file + 'image/' + it.imageUrl
     } else {

+ 1 - 1
pages/evaluationDetail/evaluationDetail.wxml

@@ -14,7 +14,7 @@
     <view class="teacher-img">
       <image src="{{item.imageUrl}}"></image>
     </view>
-    <view class="teacher-name">张老师</view>
+    <view class="teacher-name">{{item.teacherName}}</view>
   </view>
   <view class="stars">
       <rating wx:for="{{item.stars}}" wx:key="index" wx:for-item="star" score="{{star.evaluateStar}}" title="{{star.detailName}}"/>

+ 3 - 3
pages/growUp/growUp.wxml

@@ -8,7 +8,7 @@
           <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}}"/>
+           <rating wx:for="{{item.stars}}" wx:key="index" wx:for-item="star" score="{{star.evaluateStar}}" title="{{star.detailName}}"/>
           </view>
           <view class="grow-content">{{item.evaluateContent}}</view>
           <view class="task-content">
@@ -17,8 +17,8 @@
               <image  wx:for="{{item.images}}" wx:for-item="img" src="{{img.url}}" mode="aspectFill" wx:key="index" bindtap="showImg" data-url="{{img.url}}"  data-id="{{item.id}}"></image>
             </view>
 
-            <view class="title">视频</view>
-            <view class="video-list">
+            <view class="title" wx:if="{{item.videos.length > 0}}">视频</view>
+            <view class="video-list" wx:if="{{item.videos > 0}}">
               <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>

+ 5 - 1
pages/leave/leave.js

@@ -26,7 +26,11 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    let date = options.beginDate;
+    // let date = options.beginDate;
+    const curDate = new Date()
+    const month = (curDate.getMonth()+1)>=10 ? curDate.getMonth()+1 : "0"+(curDate.getMonth()+1)
+    const day = curDate.getDate()>=10? curDate.getDate() : "0"+curDate.getDate()
+    let date = curDate.getFullYear()+"-"+ month+"-"+day
     if (date) {
       this.setData({
         bd: date

+ 1 - 1
pages/quan/quan.js

@@ -115,7 +115,7 @@ Page({
     })
     this.queryList()
   },
-  submitCilck: function (e) {
+  submitCilck: function (e) {console.log(JSON.stringify(e))
     const urls = urlDef.urls;
     let item = this.data.list[e.currentTarget.dataset.index]
     if (item.receiveDate) {

+ 2 - 2
pages/quan/quan.wxml

@@ -48,13 +48,13 @@
               </view>
             </view>
 
-            <view class="btnbx" wx:if="{{status == '0' && item.flag!= 0}}"> 
+            <view class="btnbx" wx:elif="{{status == '0' && item.flag!= 0}}"> 
               <view class="btnw btnBgActive">
                 <view class="btnn-ed">已领取</view>
               </view>
             </view>
 
-            <view class="moveCm-ed btnbx-ed"  wx:elif="status != '0'">
+            <view class="moveCm-ed btnbx-ed"  wx:elif="{{status != '0'}}">
               <view class="btnw btnBgGray">
                 <view wx:if="{{item.couponStatus == 1}}" class="btnn-ed">可使用</view>
                 <view wx:if="{{item.couponStatus == 2}}" class="btnn-ed">已使用</view>

+ 1 - 1
pages/taskDetail/taskDetail.wxss

@@ -131,7 +131,7 @@
   text-align: center;
   line-height: 80rpx;
   color: #FFF;
-  background: #cc6031;
+  background: #005033;
   border-radius: 50rpx;
   font-size: 32rpx;
   position: fixed;