浏览代码

627版本

ssfg 5 年之前
父节点
当前提交
4998e785ea
共有 41 个文件被更改,包括 1385 次插入750 次删除
  1. 4 37
      app.js
  2. 0 2
      app.json
  3. 二进制
      images/show1.jpg
  4. 二进制
      images/show2.jpg
  5. 二进制
      images/show3.jpg
  6. 二进制
      images/show4.jpg
  7. 133 15
      pages/Identity/Identity.js
  8. 24 26
      pages/agoClass/agoClass.js
  9. 69 14
      pages/dbDetails/dbDetails.js
  10. 1 1
      pages/dbDetails/dbDetails.json
  11. 0 1
      pages/dbDetails/dbDetails.wxml
  12. 5 6
      pages/dbVideo/dbVideo.js
  13. 19 24
      pages/demandCourses/demandCourses.js
  14. 11 14
      pages/demandCourses/demandCourses.wxml
  15. 124 16
      pages/demandCourses/demandCourses.wxss
  16. 1 1
      pages/evaluationCourse/evaluationCourse.js
  17. 3 9
      pages/exhibitionList/exhibitionList.js
  18. 1 1
      pages/feedBack/feedBack.js
  19. 1 1
      pages/grade/grade.js
  20. 115 66
      pages/index/index.js
  21. 10 10
      pages/index/index.wxml
  22. 198 115
      pages/myClass/myClass.js
  23. 2 2
      pages/myClass/myClass.wxml
  24. 170 9
      pages/myInteractions/myInteractions.js
  25. 6 23
      pages/myInteractions/myInteractions.wxml
  26. 1 1
      pages/myInteractions/myInteractions.wxss
  27. 21 7
      pages/myInteractionsDetais/myInteractionsDetais.js
  28. 2 7
      pages/myInteractionsDetais/myInteractionsDetais.wxml
  29. 171 140
      pages/myMission/myMission.js
  30. 13 8
      pages/myMission/myMission.wxml
  31. 69 46
      pages/myTraining/myTraining.js
  32. 4 4
      pages/myTraining/myTraining.wxml
  33. 42 12
      pages/onlineClass/onlineClass.js
  34. 1 30
      pages/onlineClass/onlineClass.wxml
  35. 2 2
      pages/onlineClass/onlineClass.wxss
  36. 1 3
      pages/personInfo/personInfo.js
  37. 23 40
      pages/startClass/startClass.js
  38. 1 4
      pages/studentRegistration/studentRegistration.js
  39. 95 19
      pages/zbDetails/zbDetails.js
  40. 1 1
      project.config.json
  41. 41 33
      utils/util.js

+ 4 - 37
app.js

@@ -1,41 +1,8 @@
-//app.js
 App({
   globalData: {
-    // publicUrl: 'http://10.16.10.139:8090', //luyu
-    publicUrl2: 'http://10.16.4.19:8090', //huyubo
-    publicUrl: 'https://sqdx.windd.cn', //fwq
-    // publicUrl2: 'https://sqdx.windd.cn', //fwq
-  },
-  getSessionkey() {
-    var sessionKey = "";
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        return sessionKey;
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        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) {
-                sessionKey = res.data.sessionKey;
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                return sessionKey;
-              }
-            })
-          }
-        })
-      }
-    })
+    publicUrl: 'http://sqdx.windd.cn',
+    publicUrl2: 'http://sqdx.windd.cn',
+    publicUrl3: 'http://sqdx.windd.cn',
+    publicSocketUrl: 'ws://sqdx.windd.cn'
   }
 })

+ 0 - 2
app.json

@@ -2,10 +2,8 @@
   "pages": [
     "pages/index/index",
     "pages/zbDetails/zbDetails",
-   
     "pages/personInfo/personInfo",
     "pages/myMission/myMission",
-   
     "pages/dbDetails/dbDetails",
     "pages/myClass/myClass",
     "pages/testAnswer/testAnswer",

二进制
images/show1.jpg


二进制
images/show2.jpg


二进制
images/show3.jpg


二进制
images/show4.jpg


+ 133 - 15
pages/Identity/Identity.js

@@ -1,4 +1,4 @@
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     userName: "",
@@ -11,21 +11,21 @@ Page({
       phone,
       card
     } = e.detail.value;
-    if (userName=="") {
+    if (userName == "") {
       wx.showToast({
         title: '姓名为空,请重新输入',
         icon: 'none',
         duration: 1500
       })
       return false
-    } else if (phone=="") {
+    } else if (phone == "") {
       wx.showToast({
         title: '手机号为空,请重新输入',
         icon: 'none',
         duration: 1500
       })
       return false
-    } else if (card=="") {
+    } else if (card == "") {
       wx.showToast({
         title: '身份证号为空,请重新输入',
         icon: 'none',
@@ -34,18 +34,136 @@ Page({
       return false
     }
     console.log(e.detail.value)
-    var sessionKey = wx.getStorageSync('sessionKey');
-    wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/uthentication',
-      method: "post",
-      data: {
-        studentName: e.detail.value.userName,
-        studentCard: e.detail.value.card,
-        phone: e.detail.value.phone,
-        sessionKey: sessionKey
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        wx.request({
+          url: app.globalData.publicUrl2 + '/education/student/wx/uthentication',
+          method: "post",
+          data: {
+            studentName: e.detail.value.userName,
+            studentCard: e.detail.value.card,
+            phone: e.detail.value.phone,
+            sessionKey: sessionKey
+          },
+          success: function (res) {
+            if (res.data.code == 0) {
+              wx.showModal({
+                showCancel: false,
+                content: res.data.msg,
+                success(res) {
+                  if (res.confirm) {
+                    wx.switchTab({
+                      url: '../index/index'
+                    })
+                  }
+                }
+              })
+            } else {
+              wx.showModal({
+                showCancel: false,
+                content: res.data.msg,
+                success(res) {
+                  if (res.confirm) {
+                    wx.switchTab({
+                      url: '../index/index'
+                    })
+                  }
+                }
+              })
+            }
+            var msg = res.msg;
+            wx.showModal({
+              showCancel: false,
+              content: msg,
+              success(res) {
+                if (res.confirm) {
+                  wx.switchTab({
+                    url: '../index/index'
+                  })
+                } else if (res.cancel) {
+                  wx.switchTab({
+                    url: '../index/index'
+                  })
+                }
+              }
+            })
+          }
+        })
       },
-      success: function (res) {
-        wx.showToast(res.msg)
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                wx.request({
+                  url: app.globalData.publicUrl2 + '/education/student/wx/uthentication',
+                  method: "post",
+                  data: {
+                    studentName: e.detail.value.userName,
+                    studentCard: e.detail.value.card,
+                    phone: e.detail.value.phone,
+                    sessionKey: sessionKey
+                  },
+                  success: function (res) {
+                    if (res.code == 0) {
+                      wx.showModal({
+                        showCancel: false,
+                        content: "认证成功",
+                        success(res) {
+                          if (res.confirm) {
+                            wx.switchTab({
+                              url: '../index/index'
+                            })
+                          }
+                        }
+                      })
+                    } else {
+                      wx.showModal({
+                        showCancel: false,
+                        content: "认证失败",
+                        success(res) {
+                          if (res.confirm) {
+                            wx.switchTab({
+                              url: '../index/index'
+                            })
+                          }
+                        }
+                      })
+                    }
+                    var msg = res.msg;
+                    wx.showModal({
+                      showCancel: false,
+                      content: msg,
+                      success(res) {
+                        if (res.confirm) {
+                          wx.switchTab({
+                            url: '../index/index'
+                          })
+                        } else if (res.cancel) {
+                          wx.switchTab({
+                            url: '../index/index'
+                          })
+                        }
+                      }
+                    })
+                  }
+                })
+              }
+            })
+          }
+        })
       }
     })
   },

+ 24 - 26
pages/agoClass/agoClass.js

@@ -1,36 +1,33 @@
-//logs.js
-// const util = require('../../utils/util.js')
-const app = getApp()
+// const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
-    dataArr:[
-     
-    ]
+    dataArr: []
   },
-  checkboxChange(){
-
+  getjj(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        isActive: "2"
+      },
+      success: function (res) {
+        console.log(res.data.data.length, "我是往期开班的列表")
+        _this.setData({
+          dataArr: res.data.data
+        })
+      }
+    })
   },
   onLoad: function () {
-    var sessionKey = "" ;
     var _this = this;
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/selClas?sessionKey=' + sessionKey + '&isActive=2',
-          method: "post",
-          // data:{
-          //   isActive:0
-          // },
-          success: function (res) {
-            console.log (res,"我是往期开班的列表")
-            _this.setData({
-              dataArr: res.data.data
-            })
-          }
-        })
+        var sessionKey = wx.getStorageSync('sessionKey');
+        this.getjj(sessionKey);
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -45,8 +42,9 @@ Page({
                 code
               },
               success: function (res) {
-                sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey
+                this.getjj(sessionKey);
               }
             })
           }
@@ -54,4 +52,4 @@ Page({
       }
     })
   }
-})
+})

+ 69 - 14
pages/dbDetails/dbDetails.js

@@ -1,13 +1,13 @@
 //index.js
 //获取应用实例
-const request = require('../../utils/request.js');
-const app = getApp()
+const app = require('../../utils/util.js');
+// const app = getApp()
 Page({
   data: {
     url: '',
-    title:'',
-    message:'',
-    playTimes:0,
+    title: '',
+    message: '',
+    playTimes: 0,
     id: 0
   },
   videoErrorCallback: function (e) {
@@ -15,25 +15,80 @@ Page({
     console.log(e.detail.errMsg)
   },
   onReady: function () {},
-  onLoad: function (options) {
-    let _this = this
-    _this.setData({
-      id: options.id
-    })
+  getdbArr(sessionKey) {
+    var _this = this;
     wx.request({
-      method: "get",
-      url: app.globalData.publicUrl + '/wx/course/selectRecordByCourseId/S6vZqa6S6Fzyomehw==/' + _this.data.id,
+      method: "post",
+      url: app.globalData.publicUrl + '/wx/course/selectRecordByCourseId',
+      data: {
+        sessionKey: sessionKey,
+        courseId: _this.data.id
+      },
       success: (e) => {
-        // console.log(e,"11111111111111111")
+        console.log(e, "2222222222")
         this.setData({
           url: e.data.url,
           show: false,
-          title:e.data.course.courseInfo,
+          title: e.data.course.courseInfo,
           message: e.data.course.courseName,
           playTimes: e.data.course.playTimes
         })
       }
     })
   },
+  // onLoad: function (options) {
+  //   let _this = this
+  //   _this.setData({
+  //     id: options.id
+  //   })
+  //   wx.request({
+  //     method: "get",
+  //     url: app.globalData.publicUrl + '/wx/course/selectRecordByCourseId/S6vZqa6S6Fzyomehw==/' + _this.data.id,
+  //     success: (e) => {
+  //       // console.log(e,"11111111111111111")
+  //       this.setData({
+  //         url: e.data.url,
+  //         show: false,
+  //         title:e.data.course.courseInfo,
+  //         message: e.data.course.courseName,
+  //         playTimes: e.data.course.playTimes
+  //       })
+  //     }
+  //   })
+  // },
+  onLoad: function (options) {
+    var _this = this;
+    _this.setData({
+      id: options.id
+    })
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        _this.getdbArr(sessionKey);
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                _this.getdbArr(sessionKey);
+              }
+            })
+          }
+        })
+      }
+    })
+  }
 
 })

+ 1 - 1
pages/dbDetails/dbDetails.json

@@ -1,4 +1,4 @@
 {
   "usingComponents": {},
-  "navigationBarTitleText":"播详情"
+  "navigationBarTitleText":"播详情"
 }

+ 0 - 1
pages/dbDetails/dbDetails.wxml

@@ -4,7 +4,6 @@
 	<view class="text_box">
 		<view class="title">{{title}}</view>
 		<view class="bfnum">{{playTimes}}次播放</view>
-		<!-- <view class="zj">主讲:授课教师</view> -->
 		<view class="zw">{{message}}
 		</view>
 	</view>

+ 5 - 6
pages/dbVideo/dbVideo.js

@@ -1,7 +1,6 @@
 //index.js
 //获取应用实例
-const request = require('../../utils/request.js');
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     url: '',
@@ -10,10 +9,10 @@ Page({
     playTimes:0,
     id: 0
   },
-  videoErrorCallback: function (e) {
-    console.log('视频错误信息:')
-    console.log(e.detail.errMsg)
-  },
+  // videoErrorCallback: function (e) {
+  //   console.log('视频错误信息:')
+  //   console.log(e.detail.errMsg)
+  // },
   onReady: function () {},
   onLoad: function (options) {
     let _this = this

+ 19 - 24
pages/demandCourses/demandCourses.js

@@ -1,4 +1,4 @@
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     lbArr: []
@@ -9,24 +9,29 @@ Page({
       url: '../dbDetails/dbDetails?id=' + id
     })
   },
+  getArr(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/selectRecordBySessionKey',
+      method: "post",
+      data:{
+        sessionKey:sessionKey
+      },
+      success: function (res) {
+        console.log(res)
+        _this.setData({
+          lbArr: res.data.list
+        })
+      }
+    })
+  },
   onLoad: function () {
     var sessionKey = "";
     var _this = this;
     wx.checkSession({
       success: () => {
-        console.log("我有缓存")
         sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        wx.request({
-          url: app.globalData.publicUrl + '/wx/course/selectRecordBySessionKey/'+sessionKey,
-          method: "get",
-          success: function (res) {
-            console.log(res)
-            _this.setData({
-              lbArr: res.data.list
-            })
-          }
-        })
+        _this.getArr(sessionKey)
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -43,22 +48,12 @@ Page({
               success: function (res) {
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                _this.getArr(sessionKey)
               }
             })
           }
         })
       }
     })
-    // var _this=this;
-    // wx.request({
-    //   url: app.globalData.publicUrl + '/wx/course/selectRecordBySessionKey/S6vZqa6S6Fzyomehw==',
-    //   method: "get",
-    //   success: function (res) {
-    //     console.log(res)
-    //     _this.setData({
-    //       lbArr:res.data.list
-    //     })
-    //   }
-    // })
   }
 })

+ 11 - 14
pages/demandCourses/demandCourses.wxml

@@ -1,18 +1,15 @@
-	<view class="xczs">
-		<view class="zb1" wx:for="{{lbArr}}" wx:for-index="idx" wx:for-item="item" bindtap="turnDetails" id="{{idx}}" wx:key="idx">
-			<view style="position:relative">
-				<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
-				<view class="grayblock">
-					<view class="show_text">{{item.courseName}}</view>
-					<view class="viedoxx">
-						<image src='/images/clock.png' mode='aspectFill' class="qb"></image>
-						<view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">{{item.time}}</view>
-						<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
-					</view>
+<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>
-			<!-- <view class="btn {{item.videoId==null?'getinroom':'nogetinroom'}}">
-			<button bindtap="goIn" data-item="{{item}}" type="primary" plain="true" style="width:128rpx">进入课堂</button>
-			</view> -->
 		</view>
+
 	</view>

+ 124 - 16
pages/demandCourses/demandCourses.wxss

@@ -1,9 +1,9 @@
-.xczs {
+/* .xczs {
   width: 720rpx;
-  margin-left: 20rpx;
+  margin-left: 20rpx; */
   /* height: 250rpx; */
   /* border: 1px solid yellow; */
-  margin-top: 20rpx;
+  /* margin-top: 20rpx;
   margin-bottom: 20rpx;
   display: flex;
   display: block;
@@ -18,15 +18,14 @@
   overflow: hidden;
   float: left;
   position: relative;
-  /* border: 1px solid red; */
-}
-
+} */
+/* 
 .show1 {
   width: 338rpx;
   height: 283rpx;
-}
+} */
 
-.show_text {
+/* .show_text {
   font-size: 22rpx;
   margin-top: 10rpx;
 }
@@ -49,15 +48,15 @@
 }
 .btn{
   width:  128rpx;
-}
-.getinroom {
+} */
+/* .getinroom { */
   /* margin: 0 auto; */
   /* width: 10%; */
-  width: 128rpx;
+  /* width: 128rpx;
   height: 40rpx;
   border: 1px solid red;
   color: #d72c1a;
-  margin-left: 100rpx;
+  margin-left: 100rpx; */
   /* border: 1px solid #f2b09d; */
   /* text-align: center; */
   /* border-radius: 20rpx; */
@@ -67,11 +66,11 @@
   /* height: 50rpx; */
   /* line-height: 50rpx; */
   /* font-size: 24rpx; */
-}
-button{
+/* } */
+/* button{
   margin-top: 30rpx;
   margin-bottom: 30rpx;
-}
+} */
 /* .nogetinroom {
   color: #999999;
   border: 1px solid #999999;
@@ -82,4 +81,113 @@ button{
   margin-top: 15rpx;
   height: 50rpx;
   font-size: 24rpx;
-} */
+} */
+.video_box {
+  display: flex;
+  width: 750rpx;
+  flex-wrap: wrap;
+}
+
+.video {
+  width: 340rpx;
+  height: 470rpx;
+  margin-left: 20rpx;
+  position: relative;
+}
+
+.spbj {
+  width: 100%;
+  height: 250rpx;
+  border-radius: 20rpx 20rpx 0 0;
+}
+
+.onlinenumicon {
+  width: 30rpx;
+  height: 30rpx;
+}
+
+.text1 {
+  color: #373737;
+  font-size: 25rpx;
+  margin-top: 10rpx;
+  margin-left: 10rpx;
+}
+
+.text2 {
+  color: #e40000;
+  font-size: 25rpx;
+  margin-top: 10rpx;
+  margin-left: 10rpx;
+}
+
+.text3 {
+  color: #9b9b9b;
+  font-size: 25rpx;
+  margin-top: 10rpx;
+  margin-left: 10rpx;
+}
+
+.zbz {
+  display: flex;
+  border-radius: 0 0 10rpx 10rpx;
+  height: 40rpx;
+  background-color: #ba5047;
+  position: absolute;
+  left: 20rpx;
+  padding-right: 10rpx;
+}
+
+.dzb {
+  display: flex;
+  border-radius: 0 0 10rpx 10rpx;
+  height: 40rpx;
+  background-color: #5d6a69;
+  position: absolute;
+  left: 20rpx;
+  padding-right: 10rpx;
+}
+
+.onlineimg {
+  width: 25rpx;
+  height: 25rpx;
+  margin-left: 10rpx;
+  margin-top: 8rpx;
+}
+
+.onlinetext {
+  font-size: 20rpx;
+  color: white;
+  margin-left: 10rpx;
+  line-height: 40rpx;
+}
+
+.getinroom {
+  color: #d72c1a;
+  border: 1px solid #f2b09d;
+  text-align: center;
+  width: 100%;
+  /* border-radius: 20rpx; */
+  /* width: 20%; */
+  /* margin-left: 25%; */
+  /* margin-top: 15rpx; */
+  /* height: 50rpx; */
+  /* line-height: 50rpx; */
+  font-size: 20rpx;
+  /* margin: 0 auto; */
+  /* width: 60%; */
+  /* border: 1px solid red; */
+}
+
+.nogetinroom {
+  color: #999999;
+  border: 1px solid #999999;
+  text-align: center;
+  border-radius: 20rpx;
+  width: 20%;
+  /* width: 50%;
+  margin-left: 25%;
+  margin-top: 15rpx; */
+  /* height: 50rpx; */
+  /* line-height: 50rpx; */
+  font-size: 24rpx;
+}

+ 1 - 1
pages/evaluationCourse/evaluationCourse.js

@@ -1,6 +1,6 @@
 //logs.js
 // const util = require('../../utils/util.js')
-
+// const app = require('../../utils/util.js');
 Page({
   data: {
     showSelect: false, //多选的问题

+ 3 - 9
pages/exhibitionList/exhibitionList.js

@@ -1,7 +1,6 @@
 //logs.js
 // const util = require('../../utils/util.js')
-const request = require('../../utils/request.js');
-const app = getApp();
+const app = require('../../utils/util.js');
 Page({
   data: {
     active: 0,
@@ -26,7 +25,6 @@ Page({
 
   },
   goSeevideo(e) {
-    // console.log(e.currentTarget.dataset.item.id)
     var id = e.currentTarget.dataset.item.id
     wx.navigateTo({
       url: '/pages/dbVideo/dbVideo?id=' + id,
@@ -47,10 +45,6 @@ Page({
         })
       }
     })
-    // wx.showToast({
-    //   title: `切换到标签 ${event.detail.name}`,
-    //   icon: 'none',
-    // });
   },
   onLoad: function (options) {
     var that = this;
@@ -58,9 +52,9 @@ Page({
       active: Number(options.id)
     })
     // console.log(that.data.active)
-    var _active = that.data.active+1
+    var _active = that.data.active + 1
     wx.request({
-      method: "POST",
+      method: "post",
       url: app.globalData.publicUrl + '/wx/course/listByCourseTag?tag=' + _active,
       success: (e) => {
         that.data.xcpArr = [];

+ 1 - 1
pages/feedBack/feedBack.js

@@ -1,6 +1,6 @@
 //index.js
 //获取应用实例
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     nameIsTrue: false, //名字是否填写

+ 1 - 1
pages/grade/grade.js

@@ -1,6 +1,6 @@
 //index.js
 //获取应用实例
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     // 课程轮播

+ 115 - 66
pages/index/index.js

@@ -1,26 +1,11 @@
-//index.js
-//获取应用实例
-const util = require('../../utils/util.js')
-const app = getApp()
+// const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
+    wqdataArr: 0,
+    jjdataArr: 0,
     // 课程轮播
-    "bnrUrl": [{
-      "url": "/images/zbfm.png",
-      "name": "长春市城市社区“两委”成员线上培训班",
-      "zbf": "长春市委组织部",
-      "starttime": "2020年6月18日"
-    }, {
-      "url": "/images/zbfm.png",
-      "name": "长春市城市社区“两委”成员线上培训班",
-      "zbf": "长春市委组织部",
-      "starttime": "2020年6月19日"
-    }, {
-      "url": "/images/zbfm.png",
-      "name": "长春市城市社区“两委”成员线上培训班",
-      "zbf": "长春市委组织部",
-      "starttime": "2020年6月20日"
-    }],
+    "bnrUrl": [],
     gridArr: [{
       "url": "/images/icon1.png",
       "name": "在线直播",
@@ -34,27 +19,7 @@ Page({
       "url": "/images/icon4.png",
       "name": "测试答卷",
     }],
-    xczsArr: [{
-      "url": "/images/show1.jpg",
-      "name": "社区干部综合素质提升培训",
-      "title": "宣传片展播",
-      "people": "1234"
-    }, {
-      "url": "/images/show2.jpg",
-      "name": "社区干部综合素质提升培训",
-      "title": "媒体报道链接",
-      "people": "1234"
-    }, {
-      "url": "/images/show3.jpg",
-      "name": "社区干部综合素质提升培训",
-      "title": "主题活动",
-      "people": "1234"
-    }, {
-      "url": "/images/show4.jpg",
-      "name": "社区干部综合素质提升培训",
-      "title": "特色课程",
-      "people": "1234"
-    }]
+    xczsArr: []
   },
   gomyClass() {
     wx.switchTab({
@@ -106,14 +71,114 @@ Page({
       })
     }
   },
+  // banner图
+  getBanner(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        _this.setData({
+          bnrUrl: res.data.data.claList
+        })
+      }
+    })
+  },
+  // 即将开班
+  getjjLength(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        isActive: "0"
+      },
+      success: function (res) {
+        // console.log(res.data.data.length, "我是即将开班的列表")
+        if (res.data.data)
+          _this.setData({
+            jjdataArr: res.data.data.length
+          })
+      }
+    })
+  },
+  // 往期开班
+  getwqLength(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        isActive: "2"
+      },
+      success: function (res) {
+        // console.log(res, "我是往期开班的列表")
+        if (res.data.data)
+          _this.setData({
+            wqdataArr: res.data.data.length
+          })
+      }
+    })
+  },
+  // 四个宣传图
+  getfour() {
+    console.log("调取公开课")
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/wx/course/listCategory',
+      method: "post",
+      success: function (res) {
+        console.log(res.data.list)
+        _this.setData({
+          xczsArr: res.data.list
+        })
+      },
+      fail(res) {
+        console.log(res, "调取请求公开课失败")
+      }
+    })
+  },
   onReady: function () {},
   onLoad: function () {
-    var sessionKey;
+    var _this = this;
+    // if (app.globalData.testData && app.globalData.testData != '') {}
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
+        var sessionKey = wx.getStorageSync('sessionKey');
+        if (sessionKey == "") {
+          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) {
+                  sessionKey = res.data.sessionKey;
+                  wx.setStorageSync('sessionKey', res.data.sessionKey);
+                  _this.getBanner(sessionKey);
+                  _this.getjjLength(sessionKey);
+                  _this.getwqLength(sessionKey);
+                  _this.getfour();
+                }
+              })
+            }
+          })
+        } else {
+          _this.getBanner(sessionKey);
+          _this.getjjLength(sessionKey);
+          _this.getwqLength(sessionKey);
+          _this.getfour();
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -128,33 +193,17 @@ Page({
                 code
               },
               success: function (res) {
-                sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey
+                this.getBanner(sessionKey);
+                this.getjjLength(sessionKey);
+                this.getwqLength(sessionKey);
+                this.getfour();
               }
             })
           }
         })
       }
     })
-  },
-  // getPhoneNumber: function (e) {
-  //   var that = this;
-  //   console.log(e.detail.errMsg == "getPhoneNumber:ok");
-  //   if (e.detail.errMsg == "getPhoneNumber:ok") {
-  //     // 手机号解密
-  //     wx.request({
-  //       url: '',
-  //       data: {
-  //         encryptedData: e.detail.encryptedData,
-  //         iv: e.detail.iv,
-  //         sessionKey: that.data.session_key,
-  //         uid: "",
-  //       },
-  //       method: "post",
-  //       success: function (res) {
-  //         console.log(res);
-  //       }
-  //     })
-  //   }
-  // }
+  }
 })

+ 10 - 10
pages/index/index.wxml

@@ -3,11 +3,11 @@
 		<swiper class='u-wrp-bnr' indicator-dots="true" interval='5000' duration='1000'>
 			<block wx:for="{{bnrUrl}}" wx:for-index="index" wx:key="idx">
 				<swiper-item>
-					<image src='{{item.url}}' class='u-img-slide' mode='aspectFill'></image>
-					<view class="text text1">{{item.name}}</view>
-					<view class="text text2">主办方:{{item.zbf}}</view>
-					<view class="text text3">开班时间:{{item.starttime}}</view>
-					<image src='/images/goclass.png' mode='aspectFill' class="text gozbbtn"  bindtap="gomyClass"></image>
+					<image src='{{item.clasImg}}' class='u-img-slide' mode='aspectFill'></image>
+					<view class="text text1">{{item.clasName}}</view>
+					<view class="text text2">主办方:{{item.remark}}</view>
+					<view class="text text3">开班时间:{{item.clasBegin}}</view>
+					<image src='/images/goclass.png' mode='aspectFill' class="text gozbbtn"  bindtap="gomyClass" wx:if='{{item.isActive==5}}'></image>
 				</swiper-item>
 			</block>
 		</swiper>
@@ -16,12 +16,12 @@
 		<view class="sec_item" bindtap="gostartClass">
 			<image src="/images/jjkb.png" mode='aspectFill' class="secimg"></image>
 			<view class="text4">即将开班</view>
-			<view class="text5">即将开班:4个</view>
+			<view class="text5">即将开班:{{jjdataArr}}个</view>
 		</view>
 		<view class="sec_item1" bindtap="goagoClass">
 			<image src="/images/wqpx.png" mode='aspectFill' class="secimg"></image>
 			<view class="text4">往期开班</view>
-			<view class="text5">往期开班:4个</view>
+			<view class="text5">往期开班:{{wqdataArr}}个</view>
 		</view>
 	</view>
 	<van-grid class="gridbox">
@@ -36,13 +36,13 @@
 	</view>
 	<view class="xczs">
 		<view class="zb1" wx:for="{{xczsArr}}" wx:for-index="idx" wx:for-item="item" bindtap="turnDetails" id="{{idx}}" wx:key="idx">
-			<image src='{{item.url}}' mode='aspectFill' class="show1"></image>
+			<image src='{{item.img}}' mode='aspectFill' class="show1"></image>
 			<view class="grayblock">
 				<view class="show_text">{{item.name}}</view>
 				<view class="viedoxx">
 					<image src='/images/qb.png' mode='aspectFill' class="qb"></image>
-					<view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">{{item.title}}</view>
-					<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.people}}人看过</view>
+					<view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">{{item.tag}}</view>
+					<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
 				</view>
 			</view>
 		</view>

+ 198 - 115
pages/myClass/myClass.js

@@ -1,77 +1,12 @@
-//index.js
-//获取应用实例
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     showMore: false, //更多
     show: false,
-    notice: "通知通知我是通知通知通知我是通知通知通知我是通知通知通知我是通知",
+    SessionKey: "",
+    notice: "",
+    className: '',
     kcArr: [],
-    // "spxxArr": [{
-    //     "isfinish": "/images/unfinish.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/zb.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png"
-    //   }, {
-    //     "isfinish": "/images/finish.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/db.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png"
-    //   }, {
-    //     "isfinish": "/images/unstart.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/db.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png",
-    //   },
-    //   {
-    //     "isfinish": "/images/unstart.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/db.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png"
-    //   },
-    //   {
-    //     "isfinish": "/images/unstart.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/db.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png"
-    //   },
-    //   {
-    //     "isfinish": "/images/unstart.png",
-    //     "spfm": "/images/spfm.jpg",
-    //     "iszburl": "/images/db.png",
-    //     "name": "一期素质教育培训",
-    //     "startdate": "6月9日",
-    //     "starttime": "19:30",
-    //     "isstartstudy": "/images/startstudy.png",
-    //     "isdtxs": "/images/dtxs.png",
-    //     "ispjkc": "/images/pjkc.png"
-    //   }
-    // ],
     "myactiveArr": [{
         "name": "现场体验:长山花园社区",
         "cysj": "2020/06/20 07:09",
@@ -88,9 +23,6 @@ Page({
       }
     ]
   },
-  // showPopup() {
-
-  // },
   // 更多
   listToggle: function () {
     this.setData({
@@ -98,20 +30,20 @@ Page({
     })
   },
   hidePopup() {
-    this.setData({
+    var _this = this;
+    _this.setData({
       show: false
     });
     var sessionKey = "";
-    // var _this = this;
     wx.checkSession({
       success: () => {
-        console.log("我有缓存")
         sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
         wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/verification?sessionKey=' + sessionKey,
+          url: app.globalData.publicUrl2 + '/education/student/wx/verification',
           method: "post",
-          // data:
+          data: {
+            sessionKey: sessionKey
+          },
           success: function (res) {
             console.log(res, "我成功了")
           }
@@ -132,6 +64,16 @@ Page({
               success: function (res) {
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                wx.request({
+                  url: app.globalData.publicUrl2 + '/education/student/wx/verification',
+                  method: "post",
+                  data: {
+                    sessionKey: sessionKey
+                  },
+                  success: function (res) {
+                    console.log(res, "我成功了")
+                  }
+                })
               }
             })
           }
@@ -179,43 +121,150 @@ Page({
       url: '../feedBack/feedBack'
     })
   },
-  onReady: function () {},
-  onLoad: function () {
-    var sessionKey = "";
+  // 跳转直播点播页面
+  goStudy(e){
+    if(e.currentTarget.dataset.item.isLive==1){
+      wx.navigateTo({
+        url: '../onlineClass/onlineClass'
+      })
+    }else{
+      wx.navigateTo({
+        url: '../demandCourses/demandCourses'
+      })
+    }
+   
+  },
+  // 我的班级名字
+  getClassName(sessionKey) {
     var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        var enSessionKey = encodeURIComponent(sessionKey)
-        console.log(enSessionKey,"woshi zhuanyi")
-        wx.request({
-            url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey?sessionKey=' + enSessionKey,
-            method: "post",
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res.data.data, "22222222")
+        var filterArr = res.data.data.claList.filter(o => o.isActive == 5)
+        console.log(filterArr)
+        if (filterArr.length !== 0) {
+          _this.setData({
+            className: filterArr[0].clasName
+          })
+        }
+      }
+    })
+  },
+  // 查询我是否有班
+  isClass(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res.data, "我是返回的班级列表")
+        var filterArr = res.data.data.claList.filter(o => o.isActive == 5)
+        console.log(filterArr, "我是筛选出来的数组")
+        if (filterArr.length == 0) {
+          wx.showModal({
+            title: '您还未加入班级',
+            content: '跳转至身份认证',
             success: function (res) {
-              console.log(res, "333")
-              if (res.data.data.isAgree == 0) {
-                _this.setData({
-                  show: true
-                });
+              if (res.confirm) {
+                wx.redirectTo({
+                  url: '../Identity/Identity'
+                })
               } else {
-                _this.setData({
-                  show: false
-                });
+                wx.switchTab({
+                  url: '../index/index'
+                })
               }
             }
-          }),
-          wx.request({
-            url: app.globalData.publicUrl + '/wx/course/selectBySessionKey/' + sessionKey,
-            method: "get",
-            success: function (res) {
-              console.log(res)
-              _this.setData({
-                kcArr: res.data.list
-              })
-            }
           })
+          return false;
+        } else {
+          _this.isAgree(sessionKey);
+        }
+      }
+    })
+  },
+  // 协议是否已同意  
+  isAgree(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res.data, "wwwwww")
+        if (res.data.data) {
+          if (res.data.data.isAgree == 0) {
+            _this.setData({
+              show: true
+            });
+          } else {
+            _this.setData({
+              show: false
+            });
+          }
+        }
+      }
+    })
+  },
+  // 我的通知
+  getMynotice(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl3 + '/education/eduNoticeSee/list',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        isSee: 1,
+        isPublish: 0,
+        isNotice: 0
+      },
+      success: function (res) {
+        console.log(res, "333333333")
+        if (res.data)
+          _this.setData({
+            notice: res.data.rows[0].noticeContent
+          });
+      }
+    })
+  },
+  // // 我的课程
+  getMycourse(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res)
+        _this.setData({
+          kcArr: res.data.list
+        });
+      }
+    })
+  },
+  onLoad: function () {
+    var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        console.log(sessionKey, "我有缓存")
+        // _this.isClass(sessionKey);
+        _this.isAgree(sessionKey);
+        _this.getClassName(sessionKey);
+        _this.getMynotice(sessionKey);
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -230,8 +279,13 @@ Page({
                 code
               },
               success: function (res) {
-                sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                // _this.isClass(sessionKey);
+                _this.isAgree(sessionKey);
+                _this.getClassName(sessionKey);
+               
+                _this.getMynotice(sessionKey);
               }
             })
           }
@@ -239,9 +293,38 @@ Page({
       }
     })
   },
-  // onShow: function () {
-  //   this.setData({
-  //     show: true
-  //   });
-  // }
+  onShow(){
+    var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        console.log(sessionKey, "我有缓存")
+        _this.isClass(sessionKey);
+        _this.getMycourse(sessionKey);
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                _this.isClass(sessionKey);
+                _this.getMycourse(sessionKey);
+              }
+            })
+          }
+        })
+      }
+    })
+  }
 })

+ 2 - 2
pages/myClass/myClass.wxml

@@ -14,7 +14,7 @@
 	</view>
 	<van-divider contentPosition="center" customStyle="color: #eb3f33; border-color: #eb3f33; font-size: 30rpx;font-weight:900;position:relative">
 		<!-- <view style="height:30rpx;width:8rpx;background-color:#eb3f33;position:absolute;left:0"></view> -->
-		<text>长春市城市社区“两委”成员线上培训班</text>
+		<text>{{className}}</text>
 		<!-- <view style="height:30rpx;width:8rpx;background-color:#eb3f33"></view> -->
 	</van-divider>
 	<view class="layout" bindtap="goWrite">
@@ -33,7 +33,7 @@
 					</view>
 					<view class="start_text">开始时间:{{item.courseStart}}</view>
 					<view>
-						<image src='/images/startstudy.png' mode='aspectFill' class="an"></image>
+						<image src='/images/startstudy.png' mode='aspectFill' class="an" data-item="{{item}}" bindtap="goStudy"></image>
 						<image src='/images/dtxs.png' mode='aspectFill' class="an" bindtap="gokhAnswer"></image>
 						<image src='/images/pjkc.png' mode='aspectFill' class="an" bindtap="gopjClass"></image>
 					</view>

+ 170 - 9
pages/myInteractions/myInteractions.js

@@ -1,4 +1,5 @@
 // pages/myInteractions/myInteractions.js
+const app = require('../../utils/util.js');
 Page({
 
   /**
@@ -6,9 +7,11 @@ Page({
    */
   data: {
     isshow1: false,
-    isshow2:true,
+    isshow2: true,
     activebg: "#ffeae9",
-    unactivebg:"#fff"
+    unactivebg: "#fff",
+    mytip: "",
+    listArr: []
   },
 
   /**
@@ -17,24 +20,182 @@ Page({
   tab1Show() {
     this.setData({
       isshow1: false,
-      isshow2:true,
+      isshow2: true,
       activebg: "#ffeae9",
-      unactivebg:"#fff"
+      unactivebg: "#fff"
     })
   },
   tab2Show() {
-    this.setData({
+    var _this = this;
+    _this.setData({
       isshow1: true,
-      isshow2:false,
+      isshow2: false,
       activebg: "#fff",
-      unactivebg:"#ffeae9"
+      unactivebg: "#ffeae9"
+    })
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        wx.request({
+          url: app.globalData.publicUrl3 + '/education/board/list',
+          method: "post",
+          data: {
+            sessionKey: sessionKey
+          },
+          success: function (res) {
+            console.log(res.data.rows, "我是查到的列表")
+            _this.setData({
+              listArr: res.data.rows
+            })
+
+          }
+        })
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                wx.request({
+                  url: app.globalData.publicUrl3 + '/education/board/list',
+                  method: "post",
+                  data: {
+                    sessionKey: sessionKey
+                  },
+                  success: function (res) {
+                    console.log(res, "我是查到的列表")
+                  }
+                })
+              }
+            })
+          }
+        })
+      }
     })
   },
-  gojjDetails(){
+  gojjDetails(e) {
+    console.log(e.currentTarget.dataset.item.id, "我是带过来的值")
+    var id = e.currentTarget.dataset.item.id
     wx.navigateTo({
-      url: '/pages/myInteractionsDetais/myInteractionsDetais',
+      url: '/pages/myInteractionsDetais/myInteractionsDetais?id=' + id,
+    })
+  },
+  bindFormSubmit: function (e) {
+    // var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        var input_val = e.detail.value.textarea;
+        console.log(input_val)
+        if (input_val == "" || input_val == undefined) {
+          wx.showToast({
+            title: '反馈不能为空',
+            icon: 'none',
+            duration: 1000
+          })
+          return false;
+        } else {
+          wx.request({
+            url: app.globalData.publicUrl3 + '/education/board/add',
+            method: "post",
+            data: {
+              content: input_val,
+              sessionKey: sessionKey
+            },
+            success: function (res) {
+              console.log("提交成功啦")
+            }
+          })
+        }
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                wx.request({
+                  url: app.globalData.publicUrl3 + '/education/board/add',
+                  method: "post",
+                  data: {
+                    content: input_val,
+                    sessionKey: sessionKey
+                  },
+                  success: function (res) {
+                    console.log("提交成功啦")
+                  }
+                })
+              }
+            })
+          }
+        })
+      }
     })
+    // console.log(e.detail.value.textarea)
   },
+  // 提交我的问题
+  // submit() {
+  //   var _this = this;
+  //   console.log(_this.data.mytip)
+  //   wx.checkSession({
+  //     success: () => {
+  //       console.log("我有缓存")
+  //       var sessionKey = wx.getStorageSync('sessionKey');
+  //       wx.request({
+  //         url: app.globalData.publicUrl3 + '/education/board/add',
+  //         method: "post",
+  //         data: {
+  //           content: _this.data.mytip
+  //         },
+  //         success: function (res) {
+  //           console.log(res)
+  //         }
+  //       })
+  //     },
+  //     fail() {
+  //       console.log("我没有缓存并去登录请求")
+  //       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) {
+  //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+  //               var sessionKey = res.data.sessionKey
+
+  //             }
+  //           })
+  //         }
+  //       })
+  //     }
+  //   })
+  // },
   onLoad: function (options) {
 
   },

+ 6 - 23
pages/myInteractions/myInteractions.wxml

@@ -10,32 +10,15 @@
 		</view>
 	</view>
 	<view class="textarea_box" hidden="{{isshow1}}">
-		<textarea placeholder="请详细填写你的问题,老师会及时给你的提问做出解答!" auto-focus maxlength="-1" style="height:700rpx" />
-    <view class="submit_btn">提交问题</view>
-		<!-- <image src="/images/hd_submit.png" mode='aspectFill' class="submit_btn"></image> -->
+		<form bindsubmit="bindFormSubmit">
+			<textarea value="{{mytip}}" name="textarea" placeholder="请详细填写你的问题,老师会及时给你的提问做出解答!" auto-focus maxlength="-1" style="height:700rpx" />
+			<button form-type="submit" type="button" class="submit_btn"> 提交 </button>
+    </form>
     </view> 
     <view class="myanswer_box" hidden="{{isshow2}}">
-      <view class="tip" bindtap="gojjDetails">
+      <view class="tip" bindtap="gojjDetails" wx:for="{{listArr}}" wx:for-index="idx" wx:for-item="item"  wx:key="idx" bindtap="gojjDetails" data-item="{{item}}">
       <image src="/images/file.png" mode='aspectFill' class="file_img"></image>
-      <view class="tp">连麦老师听不到我的声音怎么办<view class="wjj">未解答</view></view>
+      <view class="tp">{{item.content}}<view class="wjj">{{item.replyContent==null?"未解答":"已解答"}}</view></view>
       </view>
-       <view class="tip">
-      <image src="/images/file.png" mode='aspectFill' class="file_img"></image>
-      <view class="tp">连麦老师听不到我的声音怎么办<view class="jj">已解答</view></view>
-      </view>
-       <view class="tip">
-      <image src="/images/file.png" mode='aspectFill' class="file_img"></image>
-      <view class="tp">连麦老师听不到我的声音怎么办<view class="jj">已解答</view></view>
-      </view>
-       <view class="tip">
-      <image src="/images/file.png" mode='aspectFill' class="file_img"></image>
-      <view class="tp">连麦老师听不到我的声音怎么办<view class="wjj">未解答</view></view>
-      </view>
-       <view class="tip">
-      <image src="/images/file.png" mode='aspectFill' class="file_img"></image>
-      	<!-- <view class="lq_btn" bindtap="lq"></view> -->
-      <view class="tp">连麦老师听不到我的声音怎么办<view class="jj">已解答</view></view>
-      </view>
-
     </view> 
 </view>

+ 1 - 1
pages/myInteractions/myInteractions.wxss

@@ -41,7 +41,7 @@
 .submit_btn {
   width: 559rpx;
   height: 77rpx;
-  line-height: 77rpx;
+  /* line-height: 77rpx; */
   margin-left: 75rpx;
   border-radius: 40rpx;
   font-size: 29rpx;

+ 21 - 7
pages/myInteractionsDetais/myInteractionsDetais.js

@@ -1,11 +1,25 @@
-//logs.js
-// const util = require('../../utils/util.js')
-
+const app = require('../../utils/util.js');
 Page({
   data: {
-   
+    id: 0,
+    myContent: "",
+    teacherContent: ""
   },
-  onLoad: function () {
-   
+  onLoad: function (options) {
+    var _this=this;
+    _this.setData({
+      id: Number(options.id)
+    })
+    wx.request({
+      url: app.globalData.publicUrl3 + '/education/board/detail/' + this.data.id,
+      method: "get",
+      success: function (res) {
+        _this.setData({
+        myContent:res.data.content,
+        teacherContent:res.data.replyContent
+        })
+        // console.log(res, "woakndaola")
+      }
+    })
   }
-})
+})

+ 2 - 7
pages/myInteractionsDetais/myInteractionsDetais.wxml

@@ -3,7 +3,7 @@
 		<view style="margin-left:20rpx;font-size:27rpx">我的提问</view>
 		<view class="mytw_nr">
 			<image src="/images/my_sjx.png" mode='aspectFill' class="myimg"></image>
-			<view class="wt_text">问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题</view>
+			<view class="wt_text">{{myContent}}</view>
 		</view>
 	</view>
 	<view class="teacher">
@@ -11,13 +11,8 @@
 		<view class="teacher_says">
 			<image src="/images/teacher_sjx.png" mode='aspectFill' class="timg"></image>
 			<view class="twords">
-				回答回答我是回答回答回答我是回答回答回答我是回答回答回答我是回答回答回答我是回答回答回答我是回答回答回答我是回答回答回答我是回答
+				{{teacherContent}}
 				</view>
 			</view>
-
-			<!-- <view class="mytw_nr">
-			<image src="/images/teacher_sjx.png" mode='aspectFill' class="timg"></image>
-			<view class="wt_text1">问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题问题问题我是问题</view>
-		</view> -->
 		</view>
 	</view>

+ 171 - 140
pages/myMission/myMission.js

@@ -1,5 +1,5 @@
 // pages/learningReport/learningReport.js
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
 
   /**
@@ -8,47 +8,7 @@ Page({
   data: {
     showewm: false,
     showzs: false,
-    "spxxArr": [{
-      "isfinish": "/images/unfinish.png",
-      "spfm": "/images/spfm.jpg",
-      "iszburl": "/images/zb.png",
-      "name": "一期素质教育培训",
-      "startdate": "6月9日",
-      "starttime": "19:30",
-      "isstartstudy": "/images/startstudy.png",
-      "isdtxs": "/images/dtxs.png",
-      "ispjkc": "/images/pjkc.png"
-    }, {
-      "isfinish": "/images/finish.png",
-      "spfm": "/images/spfm.jpg",
-      "iszburl": "/images/db.png",
-      "name": "一期素质教育培训",
-      "startdate": "6月9日",
-      "starttime": "19:30",
-      "isstartstudy": "/images/startstudy.png",
-      "isdtxs": "/images/dtxs.png",
-      "ispjkc": "/images/pjkc.png"
-    }, {
-      "isfinish": "/images/unstart.png",
-      "spfm": "/images/spfm.jpg",
-      "iszburl": "/images/db.png",
-      "name": "一期素质教育培训",
-      "startdate": "6月9日",
-      "starttime": "19:30",
-      "isstartstudy": "/images/startstudy.png",
-      "isdtxs": "/images/dtxs.png",
-      "ispjkc": "/images/pjkc.png"
-    }, {
-      "isfinish": "/images/unstart.png",
-      "spfm": "/images/spfm.jpg",
-      "iszburl": "/images/db.png",
-      "name": "一期素质教育培训",
-      "startdate": "6月9日",
-      "starttime": "19:30",
-      "isstartstudy": "/images/startstudy.png",
-      "isdtxs": "/images/dtxs.png",
-      "ispjkc": "/images/pjkc.png"
-    }],
+    kcArr: []
   },
   selectBtn0() {
     this.setData({
@@ -96,60 +56,184 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
-
+  getMycourse(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res)
+        _this.setData({
+          kcArr: res.data.list
+        });
+      }
+    })
   },
-  showEwm() {
-    var sessionKey = "";
+  isClass(sessionKey) {
     var _this = this;
-    wx.checkSession({
-        success: () => {
-          console.log("我有缓存")
-          sessionKey = wx.getStorageSync('sessionKey');
-          console.log(sessionKey)
-          wx.request({
-            url: app.globalData.publicUrl2 + '/education/student/wx/selClas?sessionKey=' + sessionKey + '&isActive=1',
-            method: "post",
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res.data, "我是返回的班级列表")
+        var filterArr = res.data.data.claList.filter(o => o.isActive == 5)
+        console.log(filterArr, "我是筛选出来的数组")
+        if (filterArr.length == 0) {
+          wx.showModal({
+            title: '您还未加入班级',
+            content: '跳转至身份认证',
             success: function (res) {
-              if (res.data.data.isAgree == 0) {
-                _this.setData({
-                  show: true
-                });
+              if (res.confirm) {
+                wx.redirectTo({
+                  url: '../Identity/Identity'
+                })
               } else {
-                _this.setData({
-                  show: false
-                });
+                wx.switchTab({
+                  url: '../index/index'
+                })
               }
             }
           })
-        },
-        fail() {
-          console.log("我没有缓存并去登录请求")
-          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) {
-                  sessionKey = res.data.sessionKey;
-                  wx.setStorageSync('sessionKey', res.data.sessionKey);
-                }
-              })
-            }
-          })
+          return false;
+        } else {
+          _this.isAgree(sessionKey);
         }
-      })
-      // this.setData({
-      //   showewm: true
-      // });
+      }
+    })
+  },
+  onLoad: function () {
+    var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        _this.getMycourse(sessionKey);
+        // _this.isClass(sessionKey);
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                _this.getMycourse(sessionKey);
+                // _this.isClass(sessionKey);
+              }
+            })
+          }
+        })
+      }
+    })
+  },
+  showEwm() {
+    var sessionKey = "";
+    var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        sessionKey = wx.getStorageSync('sessionKey');
+        console.log(sessionKey)
+        wx.request({
+          url: app.globalData.publicUrl2 + '/education/student/wx/wxGroup',
+          method: "post",
+          data: {
+            sessionKey: sessionKey
+          },
+          success: function (res) {
+            console.log(res)
+            _this.setData({
+              showewm: true
+            })
+          }
+        })
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                sessionKey = res.data.sessionKey;
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                wx.request({
+                  url: app.globalData.publicUrl2 + '/education/student/wx/wxGroup',
+                  method: "post",
+                  data: {
+                    sessionKey: sessionKey
+                  },
+                  success: function (res) {
+                    console.log(res)
+                    _this.setData({
+                      showewm: true
+                    })
+                  }
+                })
+              }
+            })
+          }
+        })
+      }
+    })
+    // this.setData({
+    //   showewm: true
+    // });
   },
   // showzs(){
   // },
+  onShow(){
+    var _this = this;
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        console.log(sessionKey, "我有缓存")
+        _this.isClass(sessionKey);
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                _this.isClass(sessionKey);
+              }
+            })
+          }
+        })
+      }
+    })
+  },
   onClose() {
     wx.hideLoading()
     this.setData({
@@ -263,59 +347,6 @@ Page({
         }
       }
     })
-    // wx.showLoading({
-    //   title: '保存中...'
-    // })
-    // wx.getSetting({
-    //   success(res) {
-    //     console.log(res)
-    //     if (res.authSetting['scope.writePhotosAlbum']) {
-    //       wx.authorize({
-    //         scope: 'scope.writePhotosAlbum',
-    //         success() {
-    //           var imgSrc = "http://sqdx.windd.cn/files/21.png"
-    //           wx.downloadFile({
-    //             url: imgSrc,
-    //             success: function (res) {
-    //               console.log(res);
-    //               //图片保存到本地
-    //               wx.saveImageToPhotosAlbum({
-    //                 filePath: res.tempFilePath,
-    //                 success: function (data) {
-    //                   wx.hideLoading();
-    //                   wx.showToast({
-    //                     title: '保存成功',
-    //                     icon: 'success',
-    //                     duration: 2000
-    //                   })
-    //                 },
-    //                 fail: function (err) {
-    //                   console.log(err);
-    //                   if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
-    //                     console.log("当初用户拒绝,再次发起授权")
-    //                     wx.openSetting({
-    //                       success(settingdata) {
-    //                         console.log(settingdata)
-    //                         if (settingdata.authSetting['scope.writePhotosAlbum']) {
-    //                           console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
-    //                         } else {
-    //                           console.log('获取权限失败,给出不给权限就无法正常使用的提示')
-    //                         }
-    //                       }
-    //                     })
-    //                   }
-    //                 },
-    //                 complete(res) {
-    //                   console.log(res);
-    //                 }
-    //               })
-    //             }
-    //           })
-    //         }
-    //       })
-    //     }
-    //   }
-    // })
   },
   onReady: function () {
 
@@ -324,9 +355,9 @@ Page({
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  // onShow: function () {
 
-  },
+  // },
 
   /**
    * 生命周期函数--监听页面隐藏

+ 13 - 8
pages/myMission/myMission.wxml

@@ -26,19 +26,24 @@
 	<view class="step" style="height:500rpx;">
 		<image src='/images/step_finish.png' mode='aspectFill' class="finish_img"></image>
 		<view class="sp_bigbox">
-			<view class="sp" wx:for="{{spxxArr}}" wx:for-index="idx" wx:for-item="item">
+			<view class="sp" wx:for="{{kcArr}}" wx:for-index="idx" wx:for-item="item">
 				<!-- <image src='{{item.spfm}}' mode='aspectFill' class="spfm"></image> -->
-				<image src='{{item.isfinish}}' mode='aspectFill' class="isfinish"></image>
-				<view class="sp_text">
+						<!-- <image src='{{item.courseImg}}' mode='aspectFill' class="spfm"></image> -->
+			<!-- <image src='{{item.isfinish}}' mode='aspectFill' class="isfinish"></image> -->
+			<view class="sp_text">
+				<view>
 					<view class="fisrt_set">
-						<image src='{{item.iszburl}}' mode='aspectFill' class="dbimg"></image><text class="name">{{item.name}}</text>
+						<image src='{{item.isLive==1?"/images/zb.png":"/images/db.png"}}' mode='aspectFill' class="dbimg"></image><text class="name">{{item.courseName}}</text>
+					</view>
+					<view class="start_text">开始时间:{{item.courseStart}}</view>
+					<view>
+						<image src='/images/startstudy.png' mode='aspectFill' class="an"></image>
+						<image src='/images/dtxs.png' mode='aspectFill' class="an" bindtap="gokhAnswer"></image>
+						<image src='/images/pjkc.png' mode='aspectFill' class="an" bindtap="gopjClass"></image>
 					</view>
-					<view class="start_text">开始时间:{{item.startdate}} <text class="time">{{item.starttime}}</text></view>
-					<image src='/images/startstudy.png' mode='aspectFill' class="an"></image>
-					<image src='/images/dtxs.png' mode='aspectFill' class="an" bindtap="gokhAnswer"></image>
-					<image src='/images/pjkc.png' mode='aspectFill' class="an" bindtap="gopjClass"></image>
 				</view>
 			</view>
+			</view>
 		</view>
 	</view>
 	<view class="step" style="padding-top:30rpx" bindtap="goWrite2">

+ 69 - 46
pages/myTraining/myTraining.js

@@ -1,64 +1,42 @@
 //logs.js
 // const util = require('../../utils/util.js')
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
-    dataArr:[
-      // {
-      //   "url": "/images/sc_img.png",
-      //   "name": "长春市社区工作者线上培训班",
-      //   "zbdw": "宽城区委组织部",
-      //   "status": "已结束"
-      // },{
-      //   "url": "/images/sc_img.png",
-      //   "name": "长春市专职党务工作者线上培训班",
-      //   "zbdw": "长春市委组织部",
-      //   "status": "已结束"
-      // },{
-      //   "url": "/images/sc_img.png",
-      //   "name": "区域党建联盟",
-      //   "zbdw": "宽城区委组织部",
-      //   "status": "已结束"
-      // },{
-      //   "url": "/images/sc_img.png",
-      //   "name": "小区党组织建设",
-      //   "zbdw": "宽城区委组织部",
-      //   "status": "已结束"
-      // }
-    ]
+    dataArr: []
   },
-  gomyClass(){
+  gomyClass() {
     wx.switchTab({
       url: '../myClass/myClass'
     })
   },
-  onLoad: function () {
-    var sessionKey = "";
+  getArr(sessionKey) {
     var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selWholeClas',
+      method: "post",
+      data:{
+        sessionKey:sessionKey
+      },
+      success: function (res) {
+        console.log(res.data.data, "22222")
+        _this.setData({
+          dataArr: res.data.data
+        })
+      }
+    })
+  },
+  onLoad: function () {
+    // var _this = this;
     wx.checkSession({
       success: () => {
-        console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/selWholeClas?sessionKey=' + sessionKey,
-          method: "post",
-          success: function (res) {
-            console.log(res.data.data,"22222")
-            _this.setData({
-              dataArr: res.data.data
-            })
-            // if(dataArr){
-
-            // }
-          }
-        })
+        var sessionKey = wx.getStorageSync('sessionKey');
+        this.getArr(sessionKey);
       },
       fail() {
         console.log("我没有缓存并去登录请求")
         wx.login({
           success(res) {
-            console.log(res);
             var code = res.code
             wx.request({
               url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
@@ -67,8 +45,9 @@ Page({
                 code
               },
               success: function (res) {
-                sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey
+                this.getArr(sessionKey);
               }
             })
           }
@@ -76,4 +55,48 @@ Page({
       }
     })
   }
-})
+  // onLoad: function () {
+  //   var sessionKey = "";
+  //   var _this = this;
+  //   wx.checkSession({
+  //     success: () => {
+  //       console.log("我有缓存")
+  //       sessionKey = wx.getStorageSync('sessionKey');
+  //       console.log(sessionKey)
+  //       wx.request({
+  //         url: app.globalData.publicUrl2 + '/education/student/wx/selWholeClas?sessionKey=' + sessionKey,
+  //         method: "post",
+  //         success: function (res) {
+  //           console.log(res.data.data,"22222")
+  //           _this.setData({
+  //             dataArr: res.data.data
+  //           })
+  //           // if(dataArr){
+
+  //           // }
+  //         }
+  //       })
+  //     },
+  //     fail() {
+  //       console.log("我没有缓存并去登录请求")
+  //       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) {
+  //               sessionKey = res.data.sessionKey;
+  //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+  //             }
+  //           })
+  //         }
+  //       })
+  //     }
+  //   })
+  // }
+})

+ 4 - 4
pages/myTraining/myTraining.wxml

@@ -1,13 +1,13 @@
 <view class="container">
-<view class="class_box" wx:for="{{dataArr}}" wx:for-index="idx" wx:for-item="item" bindtap="gomyClass">
+<view class="class_box" wx:for="{{dataArr}}" wx:for-index="idx" wx:for-item="item">
 <image src="{{item.clasImg}}" mode='aspectFill' class="scimg"></image>
 <view class="sctext">
 <view class="t1">{{item.clasName}}</view>
 <view class="t2">主办单位:{{item.remark}}</view>
 <!-- <view class="t2" id="isActive">培训状态:{{item.isActive==0?"已结束":"正在开班"}}</view> -->
-<rich-text class='t2' wx:if='{{item.isActive==0}}'>待开始</rich-text>
-<rich-text class='t2' wx:elif='{{item.isActive==1}}'>正在开班</rich-text>
-<rich-text class='t2' wx:else>已结束</rich-text>
+<rich-text class='t2' wx:if='{{item.isActive==0}}'>状态:待开始</rich-text>
+<rich-text class='t2' wx:elif='{{item.isActive==1}}'>状态:正在开班</rich-text>
+<rich-text class='t2' wx:elif='{{item.isActive==2}}'>状态:已结束</rich-text>
 </view>
 </view>
 </view>

+ 42 - 12
pages/onlineClass/onlineClass.js

@@ -1,6 +1,6 @@
 //logs.js
 // const util = require('../../utils/util.js')
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     active: 0,
@@ -12,24 +12,53 @@ Page({
       url: '../zbDetails/zbDetails?id=' + id
     })
   },
+  getArr(sessionKey) {
+    console.log(sessionKey)
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/selectLivesBySessionKey',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        console.log(res, "woshi")
+        _this.setData({
+          zbArr: res.data.list
+        })
+      }
+    })
+  },
   onLoad: function () {
     var sessionKey = "";
     var _this = this;
     wx.checkSession({
       success: () => {
-        console.log("我有缓存")
+        console.log("我有缓存","11111111")
         sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey)
-        wx.request({
-          url: app.globalData.publicUrl + '/wx/course/selectLivesBySessionKey/' + sessionKey,
-          method: "get",
-          success: function (res) {
-            console.log(res, "woshi ")
-            _this.setData({
-              zbArr: res.data.list
-            })
-          }
-        })
+        if (sessionKey == "") {
+          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) {
+                  sessionKey = res.data.sessionKey;
+                  wx.setStorageSync('sessionKey', res.data.sessionKey);
+                  _this.getArr(sessionKey);
+                }
+              })
+            }
+          })
+        }else{
+          _this.getArr(sessionKey);
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -46,6 +75,7 @@ Page({
               success: function (res) {
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                _this.getArr(sessionKey);
               }
             })
           }

+ 1 - 30
pages/onlineClass/onlineClass.wxml

@@ -1,4 +1,3 @@
-<!--logs.wxml-->
 <view class="container">
 	<view class="video_box">
 		<view class="video" wx:for="{{zbArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx">
@@ -13,36 +12,8 @@
 				<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}}">进入课堂</button>
+			<button class="{{item.videoId==null?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}" class="getinroom">进入课堂</button>
 		</view>
-		<!-- <view class="video">
-		<view class="dzb">
-			<image src='../../images/online_icon.png' mode='aspectFill' class="onlineimg"></image>
-			<view class="onlinetext">待直播</view>
-			<view class="onlinetext"> 7:00开始</view>
-		</view>
-		<image src='../../images/spfm.jpg' mode='aspectFill' class="spbj"></image>
-		<view class="text1">社区干部综合素质提升培训</view>
-		<view class="text2">
-			<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>0人在线观看
-		</view>
-		<view class="text3">社区干部综合素质提升培训...</view>
-		<view class="nogetinroom">进入课堂</view>
-	</view> -->
-		<!-- <view class="video">
-		<view class="dzb">
-			<image src='../../images/online_icon.png' mode='aspectFill' class="onlineimg"></image>
-			<view class="onlinetext">待直播</view>
-			<view class="onlinetext"> 7:00开始</view>
-		</view>
-		<image src='../../images/spfm.jpg' mode='aspectFill' class="spbj"></image>
-		<view class="text1">社区干部综合素质提升培训</view>
-		<view class="text2">
-			<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>0人在线观看
-		</view>
-		<view class="text3">社区干部综合素质提升培训...</view>
-		<view class="nogetinroom">进入课堂</view>
-	</view> -->
 	</view>
 
 </view>

+ 2 - 2
pages/onlineClass/onlineClass.wxss

@@ -82,10 +82,10 @@
   border: 1px solid #f2b09d;
   text-align: center;
   border-radius: 20rpx;
-  width: 20%;
+  /* width: 100rpx; */
   margin-left: 25%;
   margin-top: 15rpx;
-  height: 50rpx;
+  /* height: 50rpx; */
   /* line-height: 50rpx; */
   font-size: 24rpx;
 }

+ 1 - 3
pages/personInfo/personInfo.js

@@ -1,6 +1,4 @@
-//logs.js
-// const util = require('../../utils/util.js')
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     logs: []

+ 23 - 40
pages/startClass/startClass.js

@@ -1,50 +1,32 @@
-//logs.js
-// const util = require('../../utils/util.js')
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
-    dataArr: [
-    //   {
-    //   "url": "/images/sc_img.png",
-    //   "name": "长春市社区工作者线上培训班",
-    //   "zbdw": "宽城区委组织部",
-    //   "time": "2020年06月23日"
-    // }, {
-    //   "url": "/images/sc_img.png",
-    //   "name": "长春市专职党务工作者线上培训班",
-    //   "zbdw": "长春市委组织部",
-    //   "time": "2020年06月26日"
-    // }, {
-    //   "url": "/images/sc_img.png",
-    //   "name": "区域党建联盟",
-    //   "zbdw": "宽城区委组织部",
-    //   "time": "2020年06月29日"
-    // }, {
-    //   "url": "/images/sc_img.png",
-    //   "name": "小区党组织建设",
-    //   "zbdw": "宽城区委组织部",
-    //   "time": "2020年06月30日"
-    // }
-  ]
+    dataArr: []
+  },
+  getjj(sessionKey) {
+    var _this = this;
+    wx.request({
+      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        isActive: "0"
+      },
+      success: function (res) {
+        console.log(res.data.data.length, "我是即将开班的列表")
+        _this.setData({
+          dataArr: res.data.data
+        })
+      }
+    })
   },
   onLoad: function () {
-    var sessionKey = "" ;
     var _this = this;
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/selClas?sessionKey=' + sessionKey + '&isActive=0',
-          method: "post",
-          success: function (res) {
-            console.log (res,"我是即将开班的列表")
-            _this.setData({
-              dataArr: res.data.data
-            })
-          }
-        })
+        var sessionKey = wx.getStorageSync('sessionKey');
+        this.getjj(sessionKey);
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -59,8 +41,9 @@ Page({
                 code
               },
               success: function (res) {
-                sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey
+                this.getjj(sessionKey);
               }
             })
           }

+ 1 - 4
pages/studentRegistration/studentRegistration.js

@@ -1,6 +1,6 @@
 //index.js
 //获取应用实例
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     nameIsTrue: false, //名字是否填写
@@ -115,9 +115,6 @@ Page({
       peixunText :''
     });
   },
-
-
-
   parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
     var that = this
     var this_checked = e.currentTarget.dataset.id

+ 95 - 19
pages/zbDetails/zbDetails.js

@@ -1,38 +1,114 @@
 //index.js
 //获取应用实例
-const request = require('../../utils/request.js');
-const app = getApp()
+const app = require('../../utils/util.js');
 Page({
   data: {
     url: '',
-    title:'',
-    message:'',
-    playTimes:0,
-    id: 0
-  },
-  videoErrorCallback: function (e) {
-    console.log('视频错误信息:')
-    console.log(e.detail.errMsg)
+    title: '',
+    message: '',
+    playTimes: 0,
+    id: 0,
+    socketOpen: false
   },
+  // videoErrorCallback: function (e) {
+  //   console.log('视频错误信息:')
+  //   console.log(e.detail.errMsg)
+  // },
   onReady: function () {},
-  onLoad: function (options) {
-    let _this = this
-    _this.setData({
-      id: options.id
-    })
+  getZbArr(sessionKey) {
+    var _this = this;
     wx.request({
-      method: "get",
-      url: app.globalData.publicUrl + '/wx/course/selectLiveByCourseId/S6vZqa6S6Fzyomehw==/' + _this.data.id,
+      url: app.globalData.publicUrl + '/wx/course/selectLiveByCourseId',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        courseId: _this.data.id
+      },
       success: (e) => {
-        console.log(e,"11111111111111111")
+        console.log(e, "11111111111111111")
         this.setData({
           url: e.data.pullUrl.flvUrl,
-          title:e.data.course.courseName,
+          title: e.data.course.courseName,
           message: e.data.course.courseInfo,
           playTimes: e.data.course.playTimes
         })
       }
     })
   },
+  socketConnect(sessionKey) {
+    var _this = this;
+    wx.connectSocket({
+      url: app.globalData.publicSocketUrl+'/live/socket/' + sessionKey + '/' + _this.data.id
+      // header:{
+      //   'content-type': 'application/json'
+      // },
+      // protocols: ['protocol1']
+    })
+    wx.onSocketOpen(function () {
+      // console.log("我连上啦")
+      _this.setData({
+        socketOpen: true
+      })
+      _this.sendSocketMessage("hsdushh");
+    })
+    wx.onSocketError(function () {
+      console.log("我连接出错了")
+    })
+    wx.onSocketMessage(function (data) {
+      console.log(data, "我收到消息了")
+    })
+    // var socketMsgQueue=[];
+  },
+  sendSocketMessage(msg) {
+    if (this.data.socketOpen) {
+      wx.sendSocketMessage({
+        data: msg
+      })
+    } else {
+      // socketMsgQueue.push(msg)
+    }
+  },
+  onclose() {
+    wx.onSocketClose(function () {
+      console.log("我关了")
+    })
+  },
+  onLoad: function (options) {
+    var _this = this;
+    _this.setData({
+      id: options.id
+    })
+    wx.checkSession({
+      success: () => {
+        console.log("我有缓存")
+        var sessionKey = wx.getStorageSync('sessionKey');
+        console.log(sessionKey)
+        _this.getZbArr(sessionKey);
+        _this.socketConnect(sessionKey);
+      },
+      fail() {
+        console.log("我没有缓存并去登录请求")
+        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) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey);
+                var sessionKey = res.data.sessionKey;
+                _this.getZbArr(sessionKey);
+                _this.socketConnect(sessionKey);
+              }
+            })
+          }
+        })
+      }
+    })
+  }
 
 })

+ 1 - 1
project.config.json

@@ -4,7 +4,7 @@
 		"ignore": []
 	},
 	"setting": {
-		"urlCheck": false,
+		"urlCheck": true,
 		"es6": true,
 		"postcss": true,
 		"preloadBackgroundData": false,

+ 41 - 33
utils/util.js

@@ -1,35 +1,43 @@
-const app = getApp();
-var filters = {
-  getSessionKey: function () {
-    wx.checkSession({
-      success: (res) => {
-        console.log(res.errMsg);
-        app.globalData.publicUrl = res.errMsg;
-        return res.errMsg;
-      },
-      fail() {
-        wx.login({
-          success(res) {
-            console.log(res);
-            var code = res.code
-            wx.request({
-              url: app.globalData.publicUrl + '/wx/user/wx7e7a46e129d6cd0f/login',
-              method: "get",
-              data: {
-                code
-              },
-              success: function (res) {
-                console.log(res.data.openid);
-                that.setData(res.data);
-                return res.data
-              }
-            })
-          }
-        })
-      }
-    })
-  }
-}
+const globalData = {
+  publicUrl: 'https://sqdx.windd.cn',
+  publicUrl2: 'https://sqdx.windd.cn',
+  publicUrl3: 'https://sqdx.windd.cn',
+  publicSocketUrl: 'wss://sqdx.windd.cn'
+};
+// const app = getApp();
+// var filters = {
+//   getSessionKey: function () {
+//     var sessionKey = "";
+//     var _this = this;
+//     wx.checkSession({
+//       success: () => {
+//         sessionKey = wx.getStorageSync('sessionKey');
+//         return sessionKey
+//       },
+//       fail() {
+//         console.log("我没有缓存并去登录请求")
+//         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) {
+//                 sessionKey = res.data.sessionKey;
+//                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+//                 return sessionKey;
+//               }
+//             })
+//           }
+//         })
+//       }
+//     })
+//   }
+// }
 module.exports = {
-  getSessionKey: filters.getSessionKey
+  globalData: globalData
 }