Procházet zdrojové kódy

feature 录播课到了开始时间才可以看

tiedan před 4 roky
rodič
revize
4e1cfeaa82

+ 30 - 6
pages/myMission/myMission.js

@@ -457,6 +457,7 @@ Page({
     let courseUrl = e.currentTarget.dataset.item.courseUrl //此课程的id
     let courseName = e.currentTarget.dataset.item.courseName //此课程的id
     let courseInfo = e.currentTarget.dataset.item.courseInfo //此课程的id
+    let courseitem=e.currentTarget.dataset.item
     if (!this.data.istask2) {
       wx.showModal({
         showCancel: false,
@@ -499,9 +500,16 @@ Page({
         // 没学或者没学完
         if (e.currentTarget.dataset.item.isDone == 0) {
           if (id == this.data.currentId) {
-            wx.navigateTo({
-              url: '../dbDetails/dbDetails?id=' + id
-            })
+            if(courseitem.courseStart!=null&&this.checkStartTime(courseitem.courseStart)){
+              wx.showModal({
+                showCancel: false,
+                content: "课程学习的时间还没到"
+              })
+            }else{
+              wx.navigateTo({
+                url: '../dbDetails/dbDetails?id=' + id
+              })
+            }
           } else {
             wx.showModal({
               showCancel: false,
@@ -515,12 +523,28 @@ Page({
           })
         }
       } else {
-        wx.navigateTo({
-          url: '../dbDetails/dbDetails?id=' + id
-        })
+        if(courseitem.courseStart!=null&&this.checkStartTime(courseitem.courseStart)){
+          wx.showModal({
+            showCancel: false,
+            content: "课程学习的时间还没到"
+          })
+        }else{
+          wx.navigateTo({
+            url: '../dbDetails/dbDetails?id=' + id
+          })
+        }
+        
       }
     }
   },
+  //checkStartTime
+  checkStartTime(str){
+    let date=Date.parse(str);
+    let t=new Date(date)
+    let n=new Date(Date.now());
+
+    return n<t;
+  },
   // 去考试
   gokhAnswer(e) {
     if (!this.data.istask2) {

+ 1 - 0
pages/myMission/myMission.wxml

@@ -86,6 +86,7 @@
 					<image src='/images/ckcj.png' wx:if='{{item.isNeedExam==1&&item.isExam==1}}' mode='aspectFill' class="an" data-item="{{item}}" bindtap="gockcj"></image>
 					<image src='/images/pjkc.png' wx:if='{{item.isFeedback==0}}' mode='aspectFill' class="an" data-item="{{item}}" bindtap="gopjClass"></image>
 					<image src='/images/ckpj.png' wx:if='{{item.isFeedback==1}}' mode='aspectFill' class="an" data-item="{{item}}" bindtap="gockpj"></image>
+					<view class="courseTime1" wx:if="{{item.courseStart!=null&&item.isLive==-1}}">开始时间:{{item.courseStart}}</view>
 				</view>
 			</view>
 		</view>

+ 7 - 2
pages/myMission/myMission.wxss

@@ -1,3 +1,8 @@
+.courseTime1{
+  font-weight: normal;
+  font-size: 26rpx;
+  color:#999999;
+}
 .sp_showmore{
 
 height:74rpx;
@@ -354,7 +359,7 @@ align-items: center;
 .sp {
   width: 580rpx;
   margin-left: 20rpx;
-  height: 180rpx;
+ 
   margin-top: 20rpx;
   margin-bottom: 20rpx;
   position: relative;
@@ -388,7 +393,7 @@ align-items: center;
 .sp_text {
   width: 580rpx;
   height: 100%;
-  float: left;
+  /* float: left; */
   margin-left: 10rpx;
 }