ssfg 5 tahun lalu
induk
melakukan
4e7d817566

+ 1 - 2
app.json

@@ -25,8 +25,7 @@
     "pages/feedBack/feedBack",
     "pages/studentRegistration/studentRegistration",
     "pages/grade/grade",
-    "pages/answerAfterclass/answerAfterclass",
-    "pages/outpage/outpage"
+    "pages/answerAfterclass/answerAfterclass"
     
   ],
   "window": {

+ 113 - 108
pages/Identity/Identity.js

@@ -1,5 +1,6 @@
 const app = require('../../utils/util.js');
 import WxValidate from '../../utils/WxValidate';
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     isRz: 0,
@@ -51,7 +52,7 @@ Page({
       }
     })
   },
-  formSubmit: function (e) {
+  async formSubmit(e) {
     wx.showLoading({
       mask: true,
       title: '加载中',
@@ -59,65 +60,66 @@ Page({
     let _this = this;
     if (_this.data.isRz == 0) {
       const params = e.detail.value
-      let _this = this;
       if (!this.WxValidate.checkForm(params)) {
         const error = this.WxValidate.errorList[0]
         this.showModal(error)
         wx.hideLoading()
         return false
       }
-      wx.checkSession({
-        success: () => {
-          console.log("我有缓存")
-          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.tj(sessionKey, params);
-                    wx.hideLoading()
-                  }
-                })
-              }
-            })
-          } else {
-            _this.tj(sessionKey, params);
-            wx.hideLoading()
-          }
-        },
-        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.tj(sessionKey, params);
-                  wx.hideLoading()
-                }
-              })
-            }
-          })
-        }
-      })
+      const sessionKey = await tools.checkSessionAndLogin();
+      this.tj(sessionKey, params);
+      // wx.checkSession({
+      //   success: () => {
+      //     console.log("我有缓存")
+      //     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.tj(sessionKey, params);
+      //               wx.hideLoading()
+      //             }
+      //           })
+      //         }
+      //       })
+      //     } else {
+      //       _this.tj(sessionKey, params);
+      //       wx.hideLoading()
+      //     }
+      //   },
+      //   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.tj(sessionKey, params);
+      //             wx.hideLoading()
+      //           }
+      //         })
+      //       }
+      //     })
+      //   }
+      // })
     } else {
       wx.hideLoading()
       wx.showModal({
@@ -157,61 +159,64 @@ Page({
       }
     })
   },
-  onLoad: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        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.getXx(sessionKey);
-                  _this.initValidate();
-                }
-              })
-            }
-          })
-        } else {
-          _this.getXx(sessionKey);
-          _this.initValidate();
-        }
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getXx(sessionKey);
+    this.initValidate();
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     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.getXx(sessionKey);
+    //               _this.initValidate();
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.getXx(sessionKey);
+    //       _this.initValidate();
+    //     }
 
-      },
-      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.getXx(sessionKey);
-                _this.initValidate();
-              }
-            })
-          }
-        })
-      }
-    })
+    //   },
+    //   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.getXx(sessionKey);
+    //             _this.initValidate();
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   },
   // onLoad: function () {
   // this.initValidate();

+ 57 - 55
pages/agoClass/agoClass.js

@@ -1,11 +1,11 @@
-// const app = getApp()
+const tools = require('../../utils/tools.js');
 const app = require('../../utils/util.js');
 Page({
   data: {
     dataArr: []
   },
   getjj(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
       url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
       method: "post",
@@ -13,64 +13,66 @@ Page({
         sessionKey: sessionKey,
         isActive: "2"
       },
-      success: function (res) {
+      success: (res) => {
         console.log(res.data.data.length, "我是往期开班的列表")
-        _this.setData({
+        this.setData({
           dataArr: res.data.data
         })
       }
     })
   },
-  onLoad: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        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.getjj(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.getjj(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.getjj(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+  async onLoad() {
+    // // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     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: (res) => {
+    //               sessionKey = res.data.sessionKey;
+    //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //               this.getjj(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       this.getjj(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: (res) => {
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             let sessionKey = res.data.sessionKey
+    //             this.getjj(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getjj(sessionKey);
   }
 })

+ 3 - 2
pages/agoClass/agoClass.wxml

@@ -3,8 +3,9 @@
 <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">开始单位:{{item.clasBegin}}</view>
+<view class="t2">主办:{{item.remark}}</view>
+<!-- <view class="t2">开始单位:{{item.clasBegin}}</view> -->
+	<view class="t2">开班时间:{{item.beginDate}} 至 {{item.endDate}}</view>
 </view>
 </view>
 </view>

+ 1 - 1
pages/agoClass/agoClass.wxss

@@ -32,7 +32,7 @@ page {
 
 .t1 {
   color: #eb3f33;
-  font-size: 30rpx;
+  font-size: 25rpx;
   margin-top: 10rpx;
   font-weight: 700;
 }

+ 65 - 57
pages/dbDetails/dbDetails.js

@@ -1,6 +1,7 @@
 //index.js
 //获取应用实例
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 // const app = getApp()
 Page({
   data: {
@@ -29,7 +30,7 @@ Page({
     this.setData({
       intervalTime: _this.data.intervalTime + 5
     })
-    if (_this.data.intervalTime > 300) {
+    if (_this.data.intervalTime > 10) {
       _this.data.videoContext.pause()
       this.setData({
         intervalTime: 0
@@ -47,6 +48,7 @@ Page({
     }
     console.log(_this.data.intervalTime, "我是正在加的数")
   },
+  // 点击开始
   bindplay() {
     this.setData({
       videoContext: wx.createVideoContext('myVideo')
@@ -59,6 +61,7 @@ Page({
       }, 5000)
     })
   },
+  // 暂停
   bindpause() {
     clearInterval(this.data.intervalCtx)
     console.log(this.data.intervalTime, "我是暂停时加的所有数")
@@ -119,7 +122,7 @@ Page({
       [studyTime]: currentTime
     })
     let aa = 1;
-    let duration = e.detail.duration
+    // let duration = e.detail.duration
     if (_this.data.video_real_time == 0) {
       var jump_time = parseInt(_this.data.startPlayTime) + parseInt(_this.data.video_real_time)
     } else {
@@ -159,6 +162,7 @@ Page({
   },
   onUnload() {
     var _this = this;
+    clearInterval(_this.data.intervalCtx)
     if (_this.data.startPlayTime < _this.data.studyLog.studyTime) {
       console.log(_this.data.studyLog)
       wx.request({
@@ -175,6 +179,7 @@ Page({
   },
   onHide() {
     var _this = this;
+    clearInterval(_this.data.intervalCtx)
     if (_this.data.studyTime < _this.data.studyLog.studyTime) {
       console.log(_this.data.studyLog)
       wx.request({
@@ -200,63 +205,66 @@ Page({
     //   }
     // })
   },
-  onLoad: function (options) {
-    var _this = this;
-    _this.setData({
+  async onLoad(options) {
+    // var _this = this;
+    this.setData({
       id: options.id
     })
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        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.getdbArr(sessionKey);
-                  _this.getStudyLog(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.getdbArr(sessionKey);
-          _this.getStudyLog(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);
-                _this.getStudyLog(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getdbArr(sessionKey);
+    this.getStudyLog(sessionKey);
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     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.getdbArr(sessionKey);
+    //               _this.getStudyLog(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.getdbArr(sessionKey);
+    //       _this.getStudyLog(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);
+    //             _this.getStudyLog(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 
 })

+ 3 - 3
pages/dbVideo/dbVideo.js

@@ -10,7 +10,7 @@ Page({
     id: 0
   },
   onReady: function () {},
-  onLoad: function (options) {
+  async onLoad (options) {
     let _this = this
     _this.setData({
       id: options.id
@@ -19,13 +19,13 @@ Page({
       method: "POST",
       url: app.globalData.publicUrl + '/wx/course/queryById?id=' + _this.data.id,
       success: (e) => {
-        // if(e.data.list)
+        console.log(e)
         this.setData({
           url: e.data.url,
           show: false,
           title:e.data.list.courseInfo,
           message: e.data.list.courseName,
-          // playTimes: e.data.list.playTimes
+          playTimes: e.data.list.playTimes
         })
       }
     })

+ 1 - 1
pages/dbVideo/dbVideo.json

@@ -1,4 +1,4 @@
 {
   "usingComponents": {},
-  "navigationBarTitleText":"宣传展示"
+  "navigationBarTitleText":""
 }

+ 54 - 51
pages/demandCourses/demandCourses.js

@@ -1,4 +1,5 @@
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     lbArr: [],
@@ -87,56 +88,58 @@ Page({
     const hoursValue = hours % 60; //小时
     return `${hoursValue}时${minutesValue}分${secondValue}秒`;
   },
-  onLoad: function () {
-    var sessionKey = "";
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        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.getArr(sessionKey)
-                }
-              })
-            }
-          })
-        } else {
-          _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',
-              method: "get",
-              data: {
-                code
-              },
-              success: function (res) {
-                sessionKey = res.data.sessionKey;
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                _this.getArr(sessionKey)
-              }
-            })
-          }
-        })
-      }
-    })
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getArr(sessionKey)
+    // var sessionKey = "";
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     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.getArr(sessionKey)
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _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',
+    //           method: "get",
+    //           data: {
+    //             code
+    //           },
+    //           success: function (res) {
+    //             sessionKey = res.data.sessionKey;
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             _this.getArr(sessionKey)
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 21 - 13
pages/exhibitionList/exhibitionList.wxml

@@ -7,9 +7,11 @@
 					<view class="grayblock">
 						<view class="show_text">{{item.courseName}}</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">理论阵地</view>
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
+
+							<!-- <view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">理论阵地</view> -->
+							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
+								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
+							</view>
 						</view>
 					</view>
 				</view>
@@ -22,9 +24,11 @@
 					<view class="grayblock">
 						<view class="show_text">{{item.courseName}}</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">我的学院</view>
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
+
+							<!-- <view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">我的学院</view> -->
+							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
+								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
+							</view>
 						</view>
 					</view>
 				</view>
@@ -37,24 +41,28 @@
 					<view class="grayblock">
 						<view class="show_text">{{item.courseName}}</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">特色课程</view>
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
+
+							<!-- <view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">特色课程</view> -->
+							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
+								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
+							</view>
 						</view>
 					</view>
 				</view>
 			</view>
 		</van-tab>
-		<van-tab title="精细管理" title-style="font-size:25rpx">
+		<van-tab title="特色管理" title-style="font-size:25rpx">
 			<view class="xczs">
 				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
 					<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/qb.png' mode='aspectFill' class="qb"></image>
-							<view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">精细管理</view>
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">{{item.playTimes}}人看过</view>
+
+							<!-- <view style="color:#e82315;font-size:25rpx;font-weight:500;float:left">精细管理</view> -->
+							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
+								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
+							</view>
 						</view>
 					</view>
 				</view>

+ 117 - 96
pages/index/index.js

@@ -1,10 +1,11 @@
-const app1 = getApp();
+// const app1 = getApp();
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     wqdataArr: 0,
     jjdataArr: 0,
-    // kjShow: true,
+    isNeedlogin: false,
     // 课程轮播
     "bnrUrl": [],
     gridArr: [{
@@ -77,7 +78,7 @@ Page({
   },
   // 每个宣传展示跳转详情页
   turnDetails(e) {
-    var num = e.currentTarget.id;
+    let num = e.currentTarget.id;
     wx.navigateTo({
       url: '/pages/exhibitionList/exhibitionList?id=' + num,
     })
@@ -105,15 +106,14 @@ Page({
   },
   // banner图
   getBanner(sessionKey) {
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
-        _this.setData({
+      success: (res) => {
+        this.setData({
           bnrUrl: res.data.data.claList
         })
       }
@@ -121,7 +121,6 @@ Page({
   },
   // 即将开班
   getjjLength(sessionKey) {
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
       method: "post",
@@ -129,10 +128,10 @@ Page({
         sessionKey: sessionKey,
         isActive: "0"
       },
-      success: function (res) {
+      success: (res) => {
         // console.log(res.data.data.length, "我是即将开班的列表")
         if (res.data.data)
-          _this.setData({
+          this.setData({
             jjdataArr: res.data.data.length
           })
       }
@@ -140,7 +139,6 @@ Page({
   },
   // 往期开班
   getwqLength(sessionKey) {
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
       method: "post",
@@ -148,10 +146,10 @@ Page({
         sessionKey: sessionKey,
         isActive: "2"
       },
-      success: function (res) {
+      success: (res) => {
         // console.log(res, "我是往期开班的列表")
         if (res.data.data)
-          _this.setData({
+          this.setData({
             wqdataArr: res.data.data.length
           })
       }
@@ -160,13 +158,12 @@ Page({
   // 四个宣传图
   getfour() {
     console.log("调取公开课")
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/listCategory',
       method: "post",
-      success: function (res) {
-        console.log(res.data.list)
-        _this.setData({
+      success: (res) => {
+        console.log(res.data.list, "调取请求公开课列表")
+        this.setData({
           xczsArr: res.data.list
         })
       },
@@ -176,84 +173,108 @@ Page({
     })
   },
   onReady: function () {},
-  // onLoad() {
-  //   let _this = this;
-  //   console.log(app1.globalData.showAnimation)
-  //   if (app1.globalData.showAnimation == true) {
-  //     setTimeout(function () {
-  //       _this.setData({
-  //         kjShow: false,
-  //       })
-  //     }, 4000)
-  //   }
-  // },
-  // onUnload: function () {
-  //   app1.globalData.showAnimation = false;
-  //   console.log(app1.globalData.showAnimation,"false")
-  // },
-  // onHide: function () {
-  //   app1.globalData.showAnimation = false;
-  //   console.log(app1.globalData.showAnimation,"false")
-  // },
-  onShow: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        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("我没有缓存并去登录请求")
-        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.getBanner(sessionKey);
-                _this.getjjLength(sessionKey);
-                _this.getwqLength(sessionKey);
-                _this.getfour();
-              }
-            })
-          }
-        })
-      }
-    })
-  }
+  async onShow() {
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     let sessionKey = wx.getStorageSync('sessionKey');
+    //     if (sessionKey == '') {
+    //       // this.setData({
+    //       //   isNeedlogin: true
+    //       // })
+    //     } else {
+    //       // wx.request({
+    //       //   url: app.globalData.publicUrl2 + '/inspecttudentSession',
+    //       //   method: "post",
+    //       //   data: {
+    //       //     sessionKey: sessionKey
+    //       //   },
+    //       //   success: (res) => {
+    //       //     console.log(res)
+    //       //     if (res.data == true) {
+    //       //       // this.setData({
+    //       //       //   isNeedlogin: true
+    //       //       // })
+    //       //     }
+    //       //   }
+    //       // })
+    //       // 用sessionKey请求接口,返回两种结果,一种需要重新登陆,一种不需要
+    //       // if(需要重新登陆){isNeedLogin = true;}
+    //       // wx.request({
+    //       //   url: app.globalData.publicUrl2 + '',
+    //       //   method: "post",
+    //       //   data: {
+    //       //     sessionKey: sessionKey,
+    //       //     isPhone: isPhone
+    //       //   },
+    //       //   success: (res) => {
+    //       //     console.log(res)
+    //       //   }
+    //       // })
+    //     }
+    //     if (this.data.isNeedlogin == true) {
+    //       wx.login({
+    //         success(res) {
+    //           console.log(res);
+    //           let code = res.code
+    //           wx.request({
+    //             url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
+    //             method: "get",
+    //             data: {
+    //               code
+    //             },
+    //             success: (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("我没有缓存并去登录请求")
+    //     wx.login({
+    //       success(res) {
+    //         console.log(res);
+    //         let code = res.code
+    //         wx.request({
+    //           url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
+    //           method: "get",
+    //           data: {
+    //             code
+    //           },
+    //           success: (res) => {
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             let sessionKey = res.data.sessionKey
+    //             this.getBanner(sessionKey);
+    //             this.getjjLength(sessionKey);
+    //             this.getwqLength(sessionKey);
+    //             this.getfour();
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
+    // const value = await api.request('queryAllDepts', {}, 'GET');
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getBanner(sessionKey);
+    this.getjjLength(sessionKey);
+    this.getwqLength(sessionKey);
+    this.getfour();
+    // console.log(value,"9999999999");
+  },
+  // onLoad: function () {
+
+  // }
 })

+ 74 - 65
pages/myClass/myClass.js

@@ -1,4 +1,5 @@
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     showMore: false, //更多
@@ -8,9 +9,10 @@ Page({
     notice: "暂无未读通知",
     // className: '',
     // logoImg: '',
-    classInfo:{},
+    classInfo: {},
     kcArr: [],
-    sfmArr: []
+    sfmArr: [],
+    studentName: ""
   },
   // 更多
   listToggle: function () {
@@ -211,17 +213,20 @@ Page({
         sessionKey: sessionKey
       },
       success: function (res) {
-        console.log(res, "wwwwww")
-        if (res.data.data) {
+        console.log(res, "查询学员信息")
+        if (res.data.code == 0 && res.data.data) {
           if (res.data.data.isAgree == 0) {
             _this.setData({
+              studentName: res.data.data.studentName,
               show: true
             });
           } else {
             _this.setData({
+              studentName: res.data.data.studentName,
               show: false
             });
           }
+
         }
       }
     })
@@ -312,66 +317,70 @@ Page({
     const hoursValue = hours % 60; //小时
     return `${hoursValue}时${minutesValue}分${secondValue}秒`;
   },
-  onShow() {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(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.isClass(sessionKey);
-                  // _this.getClassName(sessionKey);
-                  _this.getMycourse(sessionKey);
-                  _this.getMynotice(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.isClass(sessionKey);
-          _this.getMycourse(sessionKey);
-          // _this.getClassName(sessionKey);
-          _this.getMynotice(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);
-                // _this.getClassName(sessionKey);
-                _this.getMynotice(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+  async onShow(){
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.isClass(sessionKey);
+    this.getMycourse(sessionKey);
+    this.getMynotice(sessionKey);
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(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.isClass(sessionKey);
+    //               // _this.getClassName(sessionKey);
+    //               _this.getMycourse(sessionKey);
+    //               _this.getMynotice(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.isClass(sessionKey);
+    //       _this.getMycourse(sessionKey);
+    //       // _this.getClassName(sessionKey);
+    //       _this.getMynotice(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);
+    //             // _this.getClassName(sessionKey);
+    //             _this.getMynotice(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 2 - 5
pages/myClass/myClass.wxml

@@ -2,7 +2,7 @@
 	<van-popup show="{{ show }}" bind:close="onClose">
 		<view class="nr_box">
 			<view class="title">学员培训协议</view>
-			<view class="zw">感谢您信任并使用在线学习教育培训系统,在您使用我的班级之前,请认真阅读<text style="color:red">《学员培训协议》</text>的全部内容,以了解学员权利和个人信息处理规则,感谢您的配合。</view>
+			<view class="zw">感谢您信任并使用在线学习教育培训系统,在您使用我的班级之前,请认真阅读<text style="color:red">《学员培训协议》</text>的全部内容,以了解学员权利和个人信息处理规则,感谢您的配合。</view>
 			<view class="agree_text">点击按钮即表示同意<text style="color:red">《学员培训协议》</text></view>
 			<view class="agree_btn" bindtap="hidePopup">同意协议并进入我的班级</view>
 			<view class="thinking">我再想想</view>
@@ -78,12 +78,9 @@
 	</view>
 	<van-popup show="{{ showzs }}" bind:close="onClose1">
 		<view style="position:relative">
-			<!-- <image src='/images/ewm_closebtn.png' mode='aspectFill' class="ewm_close" bindtap="onClose1"></image> -->
 			<image src='/images/zsbj.jpg' mode='aspectFill' class="zsbj"></image>
 			<view class="byzc">李欣桐同志于2020年07月07日-2020年07月09日参加学习完成规定培训内容,准予结业,特发此证。</view>
-			<!-- <view class="zsdw_text">授予证书单位:XXXXXXXXXXXX</view> -->
-			<!--<view class="save_btn" bindtap="saveImg">保存二维码</view> -->
+			<!-- <view class="byzc">{{studentName}}同志于{{classInfo.beginDate}}-{{classInfo.endDate}}参加学习完成规定培训内容,准予结业,特发此证。</view> -->
 		</view>
-		<!-- <image src='/images/close.png' mode='aspectFill' class="zscloseimg"></image> -->
 	</van-popup>
 </view>

+ 74 - 108
pages/myMission/myMission.js

@@ -1,4 +1,5 @@
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
 
   /**
@@ -8,14 +9,16 @@ Page({
     showewm: false,
     showzs: false,
     kcArr: [],
-    ewmurl: '',
+    // ewmurl: '',
     sfmArr: [],
-    className: '',
+    // className: '',
     istask1: false,
     istask2: false,
     istask3: false,
     istask4: false,
-    istask5: false
+    istask5: false,
+    studentName: "",
+    classInfo: {}
   },
   selectBtn0() {
     this.setData({
@@ -173,6 +176,9 @@ Page({
               istask1: true
             })
           }
+          _this.setData({
+            studentName: res.data.data.studentName,
+          })
         }
       }
     })
@@ -190,8 +196,9 @@ Page({
         console.log(res, "我是返回是否有班级")
         if (res.data.code == 0) {
           _this.setData({
-            className: res.data.data.clasName,
-            ewmurl: res.data.data.codeImg
+            // className: res.data.data.clasName,
+            // ewmurl: res.data.data.codeImg,
+            classInfo: res.data.data
           })
         } else {
           wx.showModal({
@@ -283,64 +290,68 @@ Page({
       }
     })
   },
-  onShow() {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(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.checkTaskList(sessionKey)
-                  _this.isClass(sessionKey);
-                  _this.getMycourse(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.checkTaskList(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.checkTaskList(sessionKey)
-                _this.isClass(sessionKey);
-                _this.getMycourse(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+  async onShow() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.checkTaskList(sessionKey)
+    this.isClass(sessionKey);
+    this.getMycourse(sessionKey);
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(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.checkTaskList(sessionKey)
+    //               _this.isClass(sessionKey);
+    //               _this.getMycourse(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.checkTaskList(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.checkTaskList(sessionKey)
+    //             _this.isClass(sessionKey);
+    //             _this.getMycourse(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   },
   onClose() {
     wx.hideLoading()
@@ -457,50 +468,5 @@ Page({
         }
       }
     })
-  },
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  // onShow: function () {
-
-  // },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
   }
 })

+ 6 - 9
pages/myMission/myMission.wxml

@@ -11,11 +11,11 @@
 		<view style="position:relative">
 			<image src='/images/ewm_closebtn.png' mode='aspectFill' class="ewm_close" bindtap="onClose"></image>
 			<image src='/images/ewmbj.png' mode='aspectFill' class="ewmbj"></image>
-			<view class="bjq_text">{{className}}</view>
+			<view class="bjq_text">{{classInfo.clasName}}</view>
 			<view class="sm_text">扫码进群与老师沟通</view>
-			<image src='{{ewmurl}}' mode='aspectFill' class="bjewm" wx:if='{{ewmurl!==""}}'></image>
-			<view class="save_btn" bindtap="saveImg" wx:if='{{ewmurl!==""}}'>保存二维码</view>
-			<view class="unloadewm_text" wx:if='{{ewmurl==""}}'>您的老师还未上传班级二维码哦</view>
+			<image src='{{classInfo.codeImg}}' mode='aspectFill' class="bjewm" wx:if='{{classInfo.codeImg!==""}}'></image>
+			<view class="save_btn" bindtap="saveImg" wx:if='{{classInfo.codeImg!==""}}'>保存二维码</view>
+			<view class="unloadewm_text" wx:if='{{classInfo.codeImg==""}}'>您的老师还未上传班级二维码哦</view>
 		</view>
 	</van-popup>
 	<view class="step" bindtap="goWrite">
@@ -61,16 +61,13 @@
 	<view class="step">
 		<image src='{{istask5==false?"/images/step_unfinish.png":"/images/step_finish.png"}}' mode='aspectFill' class="finish_img"></image>
 		<view class="lq_btn" bindtap="lq">领取结业证</view>
-		<!-- <image src='/images/lqxy.png' mode='aspectFill' class="lqxyimg" bindtap="lq"></image> -->
+		<view class="pz">注:领取结业证需完成所有课程</view>
 	</view>
 	<van-popup show="{{ showzs }}" bind:close="onClose1">
 		<view style="position:relative">
-			<!-- <image src='/images/ewm_closebtn.png' mode='aspectFill' class="ewm_close" bindtap="onClose1"></image> -->
 			<image src='/images/zsbj.jpg' mode='aspectFill' class="zsbj"></image>
 			<view class="byzc">李欣桐同志于2020年07月07日-2020年07月09日参加学习完成规定培训内容,准予结业,特发此证。</view>
-			<!-- <view class="zsdw_text">授予证书单位:XXXXXXXXXXXX</view> -->
-			<!--<view class="save_btn" bindtap="saveImg">保存二维码</view> -->
+			<!-- <view class="byzc">{{studentName}}同志于{{classInfo.beginDate}}-{{classInfo.endDate}}参加学习完成规定培训内容,准予结业,特发此证。</view> -->
 		</view>
-		<!-- <image src='/images/close.png' mode='aspectFill' class="zscloseimg"></image> -->
 	</van-popup>
 </view>

+ 7 - 0
pages/myMission/myMission.wxss

@@ -327,4 +327,11 @@
   width: 40rpx;
   height: 40rpx;
   border: 1px solid red;
+}
+.pz {
+  font-size: 24rpx;
+  color: #999999;
+  margin-bottom: 50rpx;
+  margin-top: 10rpx;
+  margin-left: 170rpx;
 }

+ 219 - 215
pages/myNotice/myNotice.js

@@ -1,4 +1,5 @@
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 // import WxValidate from '../../utils/WxValidate';
 Page({
   data: {
@@ -80,119 +81,118 @@ Page({
       }
     })
   },
-  onChange(event) {
-    var _this = this;
+  async onChange(event) {
+    // var _this = this;
     if (event.detail.index == 1) {
-      wx.checkSession({
-        success: () => {
-          console.log("我有缓存")
-          var sessionKey = wx.getStorageSync('sessionKey');
-          console.log(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.getArr1(sessionKey);
-                  }
-                })
-              }
-            })
-          } else {
-            _this.getArr1(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.getArr1(sessionKey);
-                  // _this.socketConnect(sessionKey);
-                }
-              })
-            }
-          })
-        }
-      })
+      const sessionKey = await tools.checkSessionAndLogin();
+      this.getArr1(sessionKey);
+      // wx.checkSession({
+      //   success: () => {
+      //     console.log("我有缓存")
+      //     var sessionKey = wx.getStorageSync('sessionKey');
+      //     console.log(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.getArr1(sessionKey);
+      //             }
+      //           })
+      //         }
+      //       })
+      //     } else {
+      //       _this.getArr1(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.getArr1(sessionKey);
+      //             // _this.socketConnect(sessionKey);
+      //           }
+      //         })
+      //       }
+      //     })
+      //   }
+      // })
     } else {
-      wx.checkSession({
-        success: () => {
-          console.log("我有缓存")
-          var sessionKey = wx.getStorageSync('sessionKey');
-          console.log(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.getArr(sessionKey);
-                  }
-                })
-              }
-            })
-          } else {
-            _this.getArr(sessionKey);
-          }
+      const sessionKey = await tools.checkSessionAndLogin();
+      this.getArr(sessionKey);
+      // wx.checkSession({
+      //   success: () => {
+      //     console.log("我有缓存")
+      //     var sessionKey = wx.getStorageSync('sessionKey');
+      //     console.log(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.getArr(sessionKey);
+      //             }
+      //           })
+      //         }
+      //       })
+      //     } else {
+      //       _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',
-                method: "get",
-                data: {
-                  code
-                },
-                success: function (res) {
-                  wx.setStorageSync('sessionKey', res.data.sessionKey);
-                  var sessionKey = res.data.sessionKey;
-                  _this.getArr(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.getArr(sessionKey);
+      //             // _this.socketConnect(sessionKey);
+      //           }
+      //         })
+      //       }
+      //     })
+      //   }
+      // })
     }
-
-    // wx.showToast({
-    //   title: `切换到标签 ${event.detail.name}`,
-    //   icon: 'none',
-    // });
   },
   meRead(sessionKey, noticeId) {
     var _this = this;
@@ -209,116 +209,120 @@ Page({
       }
     })
   },
-  btn(e) {
+  async btn(e) {
     console.log(e.currentTarget.dataset.item.noticeId, "99999")
     let noticeId = e.currentTarget.dataset.item.noticeId;
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(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.meRead(sessionKey, noticeId);
-                }
-              })
-            }
-          })
-        } else {
-          _this.meRead(sessionKey, noticeId);
-        }
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.meRead(sessionKey, noticeId);
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(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.meRead(sessionKey, noticeId);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.meRead(sessionKey, noticeId);
+    //     }
 
-      },
-      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.meRead(sessionKey, noticeId);
-                // _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.meRead(sessionKey, noticeId);
+    //             // _this.socketConnect(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   },
-  onLoad: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(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.getArr(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.getArr(sessionKey);
-        }
+  async onLoad () {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getArr(sessionKey);
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(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.getArr(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _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',
-              method: "get",
-              data: {
-                code
-              },
-              success: function (res) {
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                var sessionKey = res.data.sessionKey;
-                _this.getArr(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.getArr(sessionKey);
+    //             // _this.socketConnect(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 51 - 48
pages/myTraining/myTraining.js

@@ -1,5 +1,6 @@
 //logs.js
 // const util = require('../../utils/util.js')
+const tools = require('../../utils/tools.js');
 const app = require('../../utils/util.js');
 Page({
   data: {
@@ -47,55 +48,57 @@ Page({
       }
     })
   },
-  onLoad: function () {
+  async onLoad () {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getArr(sessionKey);
     // var _this = this;
-    wx.checkSession({
-      success: () => {
-        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.getArr(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          this.getArr(sessionKey);
-        }
+    // wx.checkSession({
+    //   success: () => {
+    //     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.getArr(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       this.getArr(sessionKey);
+    //     }
 
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        wx.login({
-          success(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.getArr(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+    //   },
+    //   fail() {
+    //     console.log("我没有缓存并去登录请求")
+    //     wx.login({
+    //       success(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.getArr(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 3 - 3
pages/myTraining/myTraining.wxml

@@ -4,9 +4,9 @@
 		<view class="sctext">
 			<view class="t1">{{item.clasName}}</view>
 			<view class="t2">主办单位:{{item.remark}}</view>
-			<view class='t3' wx:if='{{item.isActive==0}}'>状态:待开始</view>
-			<view class='t3' wx:elif='{{item.isActive==1}}'>状态:正在开班</view>
-			<view class='t3' wx:elif='{{item.isActive==2}}'>状态:已结束</view>
+			<view class='t3' wx:if='{{item.isActive==0}}'>开班状态:待开始</view>
+			<view class='t3' wx:elif='{{item.isActive==1}}'>开班状态:正在开班</view>
+			<view class='t3' wx:elif='{{item.isActive==2}}'>开班状态:已结束</view>
 		</view>
 	</view>
 		<view wx:if="{{showNull}}">

+ 56 - 53
pages/onlineClass/onlineClass.js

@@ -1,5 +1,6 @@
 //logs.js
 // const util = require('../../utils/util.js')
+const tools = require('../../utils/tools.js');
 const app = require('../../utils/util.js');
 Page({
   data: {
@@ -63,58 +64,60 @@ Page({
       }
     })
   },
-  onLoad: function () {
-    var sessionKey = "";
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存", "11111111")
-        sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        if (sessionKey == "") {
-          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) {
-                  sessionKey = res.data.sessionKey;
-                  wx.setStorageSync('sessionKey', res.data.sessionKey);
-                  _this.getArr(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.getArr(sessionKey);
-        }
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        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) {
-                sessionKey = res.data.sessionKey;
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                _this.getArr(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getArr(sessionKey);
+    // var sessionKey = "";
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存", "11111111")
+    //     sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(sessionKey)
+    //     if (sessionKey == "") {
+    //       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) {
+    //               sessionKey = res.data.sessionKey;
+    //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //               _this.getArr(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.getArr(sessionKey);
+    //     }
+    //   },
+    //   fail() {
+    //     console.log("我没有缓存并去登录请求")
+    //     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) {
+    //             sessionKey = res.data.sessionKey;
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             _this.getArr(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 0 - 66
pages/outpage/outpage.js

@@ -1,66 +0,0 @@
-// pages/outpage/outpage.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
-})

+ 0 - 3
pages/outpage/outpage.json

@@ -1,3 +0,0 @@
-{
-  "usingComponents": {}
-}

+ 0 - 3
pages/outpage/outpage.wxml

@@ -1,3 +0,0 @@
-<!--pages/outpage/outpage.wxml-->
-	
-<web-view src="https://www.baidu.com/"></web-view>

+ 0 - 1
pages/outpage/outpage.wxss

@@ -1 +0,0 @@
-/* pages/outpage/outpage.wxss */

+ 55 - 52
pages/startClass/startClass.js

@@ -1,4 +1,5 @@
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     dataArr: []
@@ -13,64 +14,66 @@ Page({
         isActive: "0"
       },
       success: function (res) {
-        console.log(res.data.data.length, "我是即将开班的列表")
+        console.log(res.data, "我是即将开班的列表")
         _this.setData({
           dataArr: res.data.data
         })
       }
     })
   },
-  onLoad: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        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.getjj(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.getjj(sessionKey);
-        }
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getjj(sessionKey);
+    // var _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     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.getjj(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.getjj(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.getjj(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.getjj(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 })

+ 3 - 2
pages/startClass/startClass.wxml

@@ -3,8 +3,9 @@
 		<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">开始时间:{{item.clasBegin}}</view>
+			<view class="t2">主办:{{item.remark}}</view>
+			<!-- <view class="t2">开班时间:{{item.clasBegin}}</view> -->
+			<view class="t2">开班时间:{{item.beginDate}} 至 {{item.endDate}}</view>
 		</view>
 	</view>
 </view>

+ 1 - 1
pages/startClass/startClass.wxss

@@ -32,7 +32,7 @@ page {
 
 .t1 {
   color: #eb3f33;
-  font-size: 30rpx;
+  font-size: 25rpx;
   margin-top: 10rpx;
   font-weight: 700;
 }

+ 4 - 4
pages/testAnswer/testAnswer.js

@@ -8,22 +8,22 @@ Page({
         "url": "/images/scdj1.jpg",
         "name": "长春市社区工作者线上培训班",
         "zbdw": "李老师",
-        "time": "2020年06月23日"
+        "time": "2020年07月10日"
       },{
         "url": "/images/scdj2.jpg",
         "name": "长春市专职党务工作者线上培训班",
         "zbdw": "刘老师",
-        "time": "2020年06月26日"
+        "time": "2020年07月12日"
       },{
         "url": "/images/scdj4.jpg",
         "name": "区域党建联盟",
         "zbdw": "王老师",
-        "time": "2020年06月29日"
+        "time": "2020年07月15日"
       },{
         "url": "/images/scdj3.jpg",
         "name": "小区党组织建设",
         "zbdw": "张老师",
-        "time": "2020年06月30日"
+        "time": "2020年07月30日"
       }
     ]
   },

+ 131 - 114
pages/zbDetails/zbDetails.js

@@ -1,6 +1,7 @@
 //index.js
 //获取应用实例
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     url: '',
@@ -54,6 +55,7 @@ Page({
     })
   },
   hands() {
+    console.log("我点击举手了")
     this.sendSocketMessage("put up hands")
   },
   submit: function () {
@@ -135,6 +137,7 @@ Page({
     })
   },
   socketConnect(sessionKey) {
+    console.log(sessionKey, "我执行了")
     var _this = this;
     var newSessionkey = encodeURIComponent(sessionKey);
     wx.connectSocket({
@@ -161,10 +164,10 @@ Page({
       console.log("我关了")
     })
     wx.onSocketMessage(function (data) {
+      console.log(data, "2222222222222")
       let res = JSON.parse(data.data);
       console.log(res)
       if (res.msg == "HeartBeat") {
-        // clearInterval(_this.data.timeoutObj);
         return false;
       }
       if (res.messageType == "message" || res.messageType == "system") {
@@ -175,8 +178,12 @@ Page({
       }
       if (res.msg == "socketLiveEnd") {
         _this.setData({
-          url: ""
+          url: "",
         })
+        if (_this.data.socketOpen) {
+          wx.closeSocket()
+        }
+        _this.data.videoContext.stop()
         wx.showModal({
           showCancel: false,
           content: "直播结束了",
@@ -191,6 +198,7 @@ Page({
       }
       if (res.messageType == "studentPushStream") {
         console.log(res, "我收到了举手的推流")
+        _this.data.videoContext.start();
         _this.setData({
           isHands: true,
           pushUrl: res.pushUrl
@@ -198,16 +206,18 @@ Page({
       }
       if (res.messageType == "stopStudentPushStream") {
         console.log(res.pushUrl, "不推了")
+        _this.data.videoContext.stop()
         _this.setData({
           isHands: false,
           pushUrl: ""
         })
-        _this.data.videoContext.stop()
+
       }
     })
   },
   // 发送消息
   sendSocketMessage(msg) {
+    // console.log(this.data.socketOpen)
     if (this.data.socketOpen) {
       wx.sendSocketMessage({
         data: msg
@@ -237,58 +247,60 @@ Page({
   // clearDs() {
   //   clearInterval(this.data.timeoutObj);
   // },
-  onShow() {
-    let _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        if (sessionKey == "") {
-          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) {
-                  sessionKey = res.data.sessionKey;
-                  wx.setStorageSync('sessionKey', res.data.sessionKey);
-                  _this.socketConnect(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _this.socketConnect(sessionKey);
-        }
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        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) {
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                var sessionKey = res.data.sessionKey;
-                _this.socketConnect(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
+  async onShow() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.socketConnect(sessionKey);
+    // let _this = this;
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(sessionKey)
+    //     if (sessionKey == "") {
+    //       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) {
+    //               sessionKey = res.data.sessionKey;
+    //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //               _this.socketConnect(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.socketConnect(sessionKey);
+    //     }
+    //   },
+    //   fail() {
+    //     console.log("我没有缓存并去登录请求")
+    //     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) {
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             var sessionKey = res.data.sessionKey;
+    //             _this.socketConnect(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   },
   onHide() {
     this.setData({
@@ -298,7 +310,7 @@ Page({
       wx.closeSocket()
     }
     clearInterval(this.data.timeoutObj);
-    _this.data.videoContext.stop()
+    this.data.videoContext.stop()
   },
   onUnload() {
     this.setData({
@@ -308,69 +320,74 @@ Page({
       wx.closeSocket()
     }
     clearInterval(this.data.timeoutObj);
-    _this.data.videoContext.stop()
+    this.data.videoContext.stop()
   },
-  onLoad: function (options) {
-    var _this = this;
-    _this.setData({
+  async onLoad (options) {
+    // var _this = this;
+    this.setData({
       id: options.id,
       videoContext: wx.createLivePusherContext("video-livePusher"),
       livectx: wx.createLivePlayerContext('livectx')
     })
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey)
-        if (sessionKey == "") {
-          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) {
-                  sessionKey = res.data.sessionKey;
-                  wx.setStorageSync('sessionKey', res.data.sessionKey);
-                  _this.getZbArr(sessionKey);
-                  // _this.socketConnect(sessionKey);
-                }
-              })
-            }
-          })
-        } else {
-          _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.publicUrl + '/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);
-              }
-            })
-          }
-        })
-      }
-    })
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.getZbArr(sessionKey);
+    this.socketConnect(sessionKey);
+    // wx.checkSession({
+    //   success: () => {
+    //     console.log("我有缓存")
+    //     var sessionKey = wx.getStorageSync('sessionKey');
+    //     console.log(sessionKey)
+    //     if (sessionKey == "") {
+    //       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) {
+    //               sessionKey = res.data.sessionKey;
+    //               wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //               _this.getZbArr(sessionKey);
+    //               _this.socketConnect(sessionKey);
+    //               // _this.socketConnect(sessionKey);
+    //             }
+    //           })
+    //         }
+    //       })
+    //     } else {
+    //       _this.getZbArr(sessionKey);
+    //       _this.socketConnect(sessionKey);
+    //       // _this.socketConnect(sessionKey);
+    //     }
+    //   },
+    //   fail() {
+    //     console.log("我没有缓存并去登录请求")
+    //     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) {
+    //             wx.setStorageSync('sessionKey', res.data.sessionKey);
+    //             var sessionKey = res.data.sessionKey;
+    //             _this.getZbArr(sessionKey);
+    //             _this.socketConnect(sessionKey);
+    //             // _this.socketConnect(sessionKey);
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    // })
   }
 
 })

+ 106 - 0
utils/tools.js

@@ -0,0 +1,106 @@
+const app = require('../utils/util.js');
+const request = (url, data = {}, type = 'GET') => {
+  return new Promise((resolve, reject) => {
+    wx.request({
+      url: `${app.globalData.publicUrl2}${url}`,
+      method: type,
+      data,
+      success({
+        data
+      }) {
+        resolve({
+          status: 0,
+          data,
+          msg: 'request请求成功获取到数据'
+        });
+      },
+      fail(error) {
+        reject({
+          status: 1,
+          msg: 'request请求失败'
+        })
+      }
+    });
+  });
+};
+const checkSessionAndLogin = () => {
+  return new Promise((resolve, reject) => {
+    wx.checkSession({
+      success() {
+        const sessionKey = wx.getStorageSync('sessionKey');
+        wx.request({
+          url: app.globalData.publicUrl2 + '/wx/student/inspectSession',
+          method: "post",
+          data: {
+            sessionKey: sessionKey
+          },
+          success: (res) => {
+            if (res.data.msg == 0) {
+              reject('error');
+            } else {
+              resolve(sessionKey);
+            }
+          }
+        })
+      },
+      fail() {
+        reject('error');
+      }
+    });
+  }).then(value => {
+    return new Promise((resolve, reject) => {
+      if (value != '') {
+        resolve({
+          status: 0,
+          sessionKey,
+          type: 'sessionKey',
+          msg: 'checkSession成功获取到sessionKey'
+        });
+      } else {
+        throw 1;
+      }
+    });
+  }).catch(reason => {
+    return new Promise((resolve, reject) => {
+      wx.login({
+        success(res) {
+          if (res.code) {
+            resolve({
+              status: 0,
+              data: res.code,
+              type: 'code',
+              msg: '成功获取到code'
+            });
+          } else {
+            reject({
+              status: 1,
+              msg: '获取sessionKey失败'
+            });
+          }
+        }
+      });
+    });
+  }).then(
+    value => {
+      return new Promise(async (resolve, reject) => {
+        if (value.type == 'code') {
+          const url = '/wx/user/wx7e7a46e129d6cd0f/login';
+          const {
+            data
+          } = await request(url, {
+            code: value.data
+          }, 'GET');
+          wx.setStorageSync('sessionKey', data.sessionKey);
+          resolve(data.sessionKey);
+        } else {
+          resolve(value);
+        }
+      });
+    }
+  );
+};
+
+module.exports = {
+  request,
+  checkSessionAndLogin
+}

+ 20 - 8
utils/util.js

@@ -1,12 +1,24 @@
 const globalData = {
-  // publicUrl: 'https://sqdx.windd.cn',
-  // publicUrl2: 'https://sqdx.windd.cn',
-  // publicUrl3: 'https://sqdx.windd.cn',
-  // publicSocketUrl: 'wss://sqdx.windd.cn'
-  publicUrl: 'http://10.16.10.139:8090', //luyu
-  publicUrl2: 'http://10.16.10.139:8090', //huyubo
-  publicUrl3: 'http://10.16.10.139:8090', //zxq
-  publicSocketUrl: 'ws://10.16.10.139:8090'
+  // 正式服务器
+  // publicUrl: 'https://sqdx.jiaxintech.com',
+  // publicUrl2: 'https://sqdx.jiaxintech.com',
+  // publicUrl3: 'https://sqdx.jiaxintech.com',
+  // publicSocketUrl: 'wss://sqdx.jiaxintech.com'
+  // 测试服务器
+  publicUrl: 'https://sqdx.windd.cn',
+  publicUrl2: 'https://sqdx.windd.cn',
+  publicUrl3: 'https://sqdx.windd.cn',
+  publicSocketUrl: 'wss://sqdx.windd.cn'
+  // 本地
+  // publicUrl: 'http://10.16.4.19:80', //luyu
+  // publicUrl2: 'http://10.16.4.19:80', //huyubo
+  // publicUrl3: 'http://10.16.4.19:80', //zxq
+  // publicSocketUrl: 'ws://10.16.4.19:80'
+    // 本地
+  // publicUrl: 'http://10.16.10.139:8090', //luyu
+  // publicUrl2: 'http://10.16.10.139:8090', //huyubo
+  // publicUrl3: 'http://10.16.10.139:8090', //zxq
+  // publicSocketUrl: 'ws://10.16.10.139:8090'
 };
 module.exports = {
   globalData: globalData,