ssfg 5 years ago
parent
commit
409a492c0f

BIN
images/nodata.png


+ 20 - 1
pages/Identity/Identity.js

@@ -40,7 +40,7 @@ Page({
             showCancel: false,
             content: res.data.msg,
             success(res) {
-              if (res.confirm) {}
+              // if (res.confirm) {}
             }
           })
         }
@@ -107,6 +107,25 @@ Page({
   },
   onLoad: function () {
     this.initValidate();
+    // wx.login({
+    //   success(res) {
+    //     console.log(res);
+    //     var code = res.code
+    //     wx.request({
+    //       url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
+    //       method: "get",
+    //       data: {
+    //         code
+    //       },
+    //       success: function (res) {
+    //         console.log(res,"我是测试")
+    //         // wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //         // var sessionKey = res.data.sessionKey;
+    //         // _this.tj(sessionKey, params);
+    //       }
+    //     })
+    //   }
+    // })
   },
   initValidate() {
     // 验证字段的规则

+ 1 - 1
pages/agoClass/agoClass.js

@@ -7,7 +7,7 @@ Page({
   getjj(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selClas',
       method: "post",
       data: {
         sessionKey: sessionKey,

+ 60 - 1
pages/dbDetails/dbDetails.js

@@ -8,7 +8,9 @@ Page({
     title: '',
     message: '',
     playTimes: 0,
-    id: 0
+    id: 0,
+    studyLog: {},
+    currentTime: 0
   },
   videoErrorCallback: function (e) {
     console.log('视频错误信息:')
@@ -36,6 +38,60 @@ Page({
       }
     })
   },
+  getStudyLog(sessionKey) {
+    var _this = this;
+    wx.request({
+      method: "post",
+      url: app.globalData.publicUrl + '/wx/course/getStudyLog',
+      data: {
+        sessionKey: sessionKey,
+        courseId: _this.data.id
+      },
+      success: (e) => {
+        console.log(e, "22222222222222")
+        _this.setData({
+          studyLog: e.data.studyLog
+        })
+      }
+    })
+  },
+  timeUpdate: function (e) {
+    // console.log(this.data.studyLog)
+    //实时播放进度 秒数
+    let currentTime = parseInt(e.detail.currentTime)
+    let studyTime = 'studyLog.studyTime'
+    this.setData({
+      [studyTime]: currentTime
+    })
+  },
+  onUnload() {
+    var _this = this;
+    console.log(_this.data.studyLog)
+    wx.request({
+      method: "post",
+      url: app.globalData.publicUrl + '/wx/course/updateStudyLog',
+      data: {
+        studyLog: _this.data.studyLog
+      },
+      success: (e) => {
+        console.log(e, "我修改进度成功了")
+      }
+    })
+  },
+  onHide() {
+    var _this = this;
+    console.log(_this.data.studyLog)
+    wx.request({
+      method: "post",
+      url: app.globalData.publicUrl + '/wx/course/updateStudyLog',
+      data: {
+        studyLog: _this.data.studyLog
+      },
+      success: (e) => {
+        console.log(e, "我修改进度成功了")
+      }
+    })
+  },
   onLoad: function (options) {
     var _this = this;
     _this.setData({
@@ -60,12 +116,14 @@ Page({
                   sessionKey = res.data.sessionKey;
                   wx.setStorageSync('sessionKey', res.data.sessionKey);
                   _this.getdbArr(sessionKey);
+                  _this.getStudyLog(sessionKey);
                 }
               })
             }
           })
         } else {
           _this.getdbArr(sessionKey);
+          _this.getStudyLog(sessionKey);
         }
       },
       fail() {
@@ -84,6 +142,7 @@ Page({
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey;
                 _this.getdbArr(sessionKey);
+                _this.getStudyLog(sessionKey);
               }
             })
           }

+ 1 - 1
pages/dbDetails/dbDetails.wxml

@@ -1,5 +1,5 @@
 <view class="home">
-	<video id="myVideo" src="{{url}}" binderror="videoErrorCallback" show-play-btn="ture" show-mute-btn="true" controls>
+	<video id="myVideo" src="{{url}}" binderror="videoErrorCallback" bindtimeupdate="timeUpdate" show-play-btn="ture" show-mute-btn="true" controls>
 	</video>
 	<view class="text_box">
 		<view class="title">{{title}}</view>

+ 11 - 5
pages/demandCourses/demandCourses.js

@@ -1,7 +1,8 @@
 const app = require('../../utils/util.js');
 Page({
   data: {
-    lbArr: []
+    lbArr: [],
+    showNull: false
   },
   goIn(e) {
     var id = e.currentTarget.dataset.item.id
@@ -18,10 +19,15 @@ Page({
         sessionKey:sessionKey
       },
       success: function (res) {
-        console.log(res)
-        _this.setData({
-          lbArr: res.data.list
-        })
+        if (res.data.list.length == 0) {
+          _this.setData({
+            showNull: true
+          })
+        } else {
+          _this.setData({
+            lbArr: res.data.list
+          })
+        }
       }
     })
   },

+ 15 - 12
pages/demandCourses/demandCourses.wxml

@@ -1,15 +1,18 @@
 <view class="container">
-		<view class="video_box">
-			<view class="video" wx:for="{{lbArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx">
-				<image src='{{item.courseImg}}' mode='aspectFill' class="spbj"></image>
-				<view class="text1">{{item.courseName}}</view>
-				<view class="text2">
-					<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>{{item.playTimes}}人看过
-				</view>
-				<view>
-					<button class="{{item.videoId==null?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}">进入课堂</button>
-				</view>
+	<view class="video_box">
+		<view class="video" wx:for="{{lbArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx">
+			<image src='{{item.courseImg}}' mode='aspectFill' class="spbj"></image>
+			<view class="text1">{{item.courseName}}</view>
+			<view class="text2">
+				<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>{{item.playTimes}}人看过
+			</view>
+			<view>
+				<button class="{{item.videoId==null?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}">进入课堂</button>
 			</view>
 		</view>
-
-	</view>
+	</view>
+	<view wx:if="{{showNull}}">
+		<image src='/images/nodata.png' mode='aspectFill' class="nodata"></image>
+		<view class="nodata_text">暂无数据</view>
+	</view>
+</view>

+ 14 - 0
pages/demandCourses/demandCourses.wxss

@@ -190,4 +190,18 @@
   /* height: 50rpx; */
   /* line-height: 50rpx; */
   font-size: 24rpx;
+}
+.nodata {
+  position: absolute;
+  top: 285rpx;
+  left: 205rpx;
+  width: 340rpx;
+  height: 262rpx;
+}
+.nodata_text{
+  position: absolute;
+  top: 550rpx;
+  left: 310rpx;
+  font-size: 30rpx;
+  color: #666666;
 }

+ 1 - 1
pages/index/index.js

@@ -161,7 +161,7 @@ Page({
     console.log("调取公开课")
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/course/listCategory',
+      url: app.globalData.publicUrl + '/wx/course/listCategory',
       method: "post",
       success: function (res) {
         console.log(res.data.list)

+ 1 - 1
pages/myClass/myClass.wxml

@@ -25,7 +25,7 @@
 	<view class="{{!showMore? 'hiddenmore' : 'showmore'}}">
 		<view class="sp {{idx>2 ? 'none' : ''}}" wx:for="{{kcArr}}" wx:for-index="idx" wx:for-item="item">
 			<image src='{{item.courseImg}}' mode='aspectFill' class="spfm"></image>
-			<!-- <image src='{{item.isfinish}}' mode='aspectFill' class="isfinish"></image> -->
+			<image src='{{item.isDone==0?"/images/unfinish.png":"/images/finish.png"}}' mode='aspectFill' class="isfinish"></image>
 			<view class="sp_text">
 				<view>
 					<view class="fisrt_set">

+ 26 - 1
pages/myInteractions/myInteractions.js

@@ -150,7 +150,32 @@ Page({
               sessionKey: sessionKey
             },
             success: function (res) {
-              console.log("提交成功啦")
+              if (res.cede == 0) {
+                wx.showModal({
+                  showCancel: false,
+                  content: "提交成功",
+                  success(res) {
+                    if (res.confirm) {
+                      wx.switchTab({
+                        url: '../personInfo/personInfo'
+                      })
+                    }
+                  }
+                })
+              }else{
+                wx.showModal({
+                  showCancel: false,
+                  content: "提交失败",
+                  success(res) {
+                    if (res.confirm) {
+                      console.log("失败了")
+                      // wx.switchTab({
+                      //   url: '../index/index'
+                      // })
+                    }
+                  }
+                })
+              }
             }
           })
         }

+ 30 - 10
pages/onlineClass/onlineClass.js

@@ -4,13 +4,27 @@ const app = require('../../utils/util.js');
 Page({
   data: {
     active: 0,
-    zbArr: []
+    zbArr: [],
+    showNull: false
   },
   goIn(e) {
-    var id = e.currentTarget.dataset.item.id
-    wx.navigateTo({
-      url: '../zbDetails/zbDetails?id=' + id
-    })
+    let id = e.currentTarget.dataset.item.id
+    if (e.currentTarget.dataset.item.isActive == 1) {
+      wx.navigateTo({
+        url: '../zbDetails/zbDetails?id=' + id
+      })
+    } else {
+      wx.showModal({
+        showCancel: false,
+        content: "直播还未开始哦",
+        success(res) {
+          if (res.confirm) {
+
+          }
+        }
+      })
+    }
+
   },
   getArr(sessionKey) {
     console.log(sessionKey)
@@ -23,9 +37,15 @@ Page({
       },
       success: function (res) {
         console.log(res, "woshi")
-        _this.setData({
-          zbArr: res.data.list
-        })
+        if (res.data.list.length == 0) {
+          _this.setData({
+            showNull: true
+          })
+        } else {
+          _this.setData({
+            zbArr: res.data.list
+          })
+        }
       }
     })
   },
@@ -34,7 +54,7 @@ Page({
     var _this = this;
     wx.checkSession({
       success: () => {
-        console.log("我有缓存","11111111")
+        console.log("我有缓存", "11111111")
         sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey)
         if (sessionKey == "") {
@@ -56,7 +76,7 @@ Page({
               })
             }
           })
-        }else{
+        } else {
           _this.getArr(sessionKey);
         }
       },

+ 5 - 2
pages/onlineClass/onlineClass.wxml

@@ -13,8 +13,11 @@
 				<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>{{item.playTimes}}人在线观看
 			</view> -->
 			<view class="text3">{{item.courseInfo}}</view>
-			<button class="{{item.videoId==null?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}" class="getinroom">进入课堂</button>
+			<button class="{{item.isActive==1?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}">进入课堂</button>
 		</view>
 	</view>
-
+	<view wx:if="{{showNull}}">
+		<image src='/images/nodata.png' mode='aspectFill' class="nodata" ></image>
+		<view class="nodata_text">暂无数据</view>
+	</view>
 </view>

+ 14 - 0
pages/onlineClass/onlineClass.wxss

@@ -4,6 +4,20 @@
   flex-wrap: wrap;
 }
 
+.nodata {
+  position: absolute;
+  top: 285rpx;
+  left: 205rpx;
+  width: 340rpx;
+  height: 262rpx;
+}
+.nodata_text{
+  position: absolute;
+  top: 550rpx;
+  left: 310rpx;
+  font-size: 30rpx;
+  color: #666666;
+}
 .video {
   width: 340rpx;
   height: 470rpx;

+ 1 - 1
pages/startClass/startClass.js

@@ -6,7 +6,7 @@ Page({
   getjj(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selClas',
       method: "post",
       data: {
         sessionKey: sessionKey,

+ 28 - 1
pages/zbDetails/zbDetails.js

@@ -70,9 +70,26 @@ Page({
     })
     wx.onSocketMessage(function (data) {
       let res = JSON.parse(data.data);
+      console.log(res)
       _this.setData({
         chatContent: _this.data.chatContent.concat(res.msg)
       })
+      if (res.messageType == "system" && res.mag == "socketLiveEnd") {
+        this.setData({
+          url: ""
+        })
+        wx.showModal({
+          showCancel: false,
+          content: "直播结束了",
+          success(res) {
+            if (res.confirm) {
+              wx.switchTab({
+                url: '../index/index'
+              })
+            }
+          }
+        })
+      }
       // _this.setData({
       //   chatContent: res.msg
       // })
@@ -91,7 +108,17 @@ Page({
       // socketMsgQueue.push(msg)
     }
   },
-  onclose() {
+  // onclose() {
+  //   wx.onSocketClose(function () {
+  //     console.log("我关了")
+  //   })
+  // },
+  onHide() {
+    wx.onSocketClose(function () {
+      console.log("我关了")
+    })
+  },
+  onUnload() {
     wx.onSocketClose(function () {
       console.log("我关了")
     })

+ 6 - 6
utils/util.js

@@ -1,11 +1,11 @@
 const globalData = {
-  publicUrl: 'https://sqdx.windd.cn',
-  publicUrl2: 'https://sqdx.windd.cn',
+  // publicUrl: 'https://sqdx.windd.cn',
+  // publicUrl2: 'https://sqdx.windd.cn',
   publicUrl3: 'https://sqdx.windd.cn',
-  publicSocketUrl: 'wss://sqdx.windd.cn',
-  // publicSocketUrl: 'ws://10.16.10.139:8090',
-  // publicUrl: 'http://10.16.10.139:8090', //luyu
-  // publicUrl2: 'http://10.16.4.19:8090', //huyubo
+  // publicSocketUrl: 'wss://sqdx.windd.cn',
+  publicSocketUrl: 'ws://10.16.10.139:8090',
+  publicUrl: 'http://10.16.10.139:8090', //luyu
+  publicUrl2: 'http://10.16.4.19:8090', //huyubo
   // publicUrl3: 'http://10.16.9.28:8090', //zxq
 };
 module.exports = {