ssfg 5 年 前
コミット
7de157a2b2

+ 7 - 138
pages/Identity/Identity.js

@@ -19,7 +19,7 @@ Page({
   },
   tj(sessionKey, params) {
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/uthentication',
+      url: app.globalData.publicUrl + '/wx/student/uthentication',
       method: "post",
       data: {
         studentName: params.userName,
@@ -57,8 +57,8 @@ Page({
       mask: true,
       title: '加载中',
     })
-    let _this = this;
-    if (_this.data.isRz == 0) {
+    // let _this = this;
+    if (this.data.isRz == 0) {
       const params = e.detail.value
       if (!this.WxValidate.checkForm(params)) {
         const error = this.WxValidate.errorList[0]
@@ -68,58 +68,6 @@ Page({
       }
       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({
@@ -129,17 +77,17 @@ Page({
     }
   },
   getXx(sessionKey) {
-    let _this = this;
+    // let _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selStudentSessionKeyEcho',
+      url: app.globalData.publicUrl + '/wx/student/selStudentSessionKeyEcho',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res)=> {
         if (res.data.code == 0) {
           if (res.data.data !== null || res.data.data !== "") {
-            _this.setData({
+            this.setData({
               isRz: 1,
               userName: res.data.data.miniName,
               phone: res.data.data.miniPhone,
@@ -153,9 +101,6 @@ Page({
           console.log("报错额")
         }
         console.log(res)
-        // sessionKey = res.data.sessionKey;
-        // wx.setStorageSync('sessionKey', res.data.sessionKey);
-        // _this.getXx(sessionKey);
       }
     })
   },
@@ -163,83 +108,7 @@ Page({
     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();
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   },
-  // onLoad: function () {
-  // this.initValidate();
-  // wx.login({
-  //   success(res) {
-  //     console.log(res);
-  //     var code = res.code
-  //     wx.request({
-  //       url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-  //       method: "get",
-  //       data: {
-  //         code
-  //       },
-  //       success: function (res) {
-  //         console.log(res,"我是测试")
-  //         // wx.setStorageSync('sessionKey', res.data.sessionKey);
-  //         // var sessionKey = res.data.sessionKey;
-  //         // _this.tj(sessionKey, params);
-  //       }
-  //     })
-  //   }
-  // })
-  // },
   initValidate() {
     // 验证字段的规则
     const rules = {

+ 1 - 53
pages/agoClass/agoClass.js

@@ -5,16 +5,14 @@ Page({
     dataArr: []
   },
   getjj(sessionKey) {
-    // var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
+      url: app.globalData.publicUrl + '/wx/student/selClasToo',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isActive: "2"
       },
       success: (res) => {
-        console.log(res.data.data.length, "我是往期开班的列表")
         this.setData({
           dataArr: res.data.data
         })
@@ -22,56 +20,6 @@ Page({
     })
   },
   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);
   }

+ 1 - 67
pages/dbDetails/dbDetails.js

@@ -30,7 +30,7 @@ Page({
     this.setData({
       intervalTime: _this.data.intervalTime + 5
     })
-    if (_this.data.intervalTime > 10) {
+    if (_this.data.intervalTime > 300) {
       _this.data.videoContext.pause()
       this.setData({
         intervalTime: 0
@@ -113,7 +113,6 @@ Page({
     })
   },
   timeUpdate: function (e) {
-    // console.log(e.detail.duration,"我是视频总长")
     //实时播放进度 秒数
     let _this = this;
     let currentTime = parseInt(e.detail.currentTime) //当前播放秒数
@@ -181,7 +180,6 @@ Page({
     var _this = this;
     clearInterval(_this.data.intervalCtx)
     if (_this.data.studyTime < _this.data.studyLog.studyTime) {
-      console.log(_this.data.studyLog)
       wx.request({
         method: "post",
         url: app.globalData.publicUrl + '/wx/course/updateStudyLog',
@@ -193,78 +191,14 @@ Page({
         }
       })
     }
-    // console.log(_this.data.studyLog)
-    // wx.request({
-    //   method: "post",
-    //   url: app.globalData.publicUrl + '/wx/course/updateStudyLog',
-    //   data: {
-    //     studyLog: _this.data.studyLog
-    //   },
-    //   success: (e) => {
-    //     console.log(e, "我修改进度成功了")
-    //   }
-    // })
   },
   async onLoad(options) {
-    // var _this = this;
     this.setData({
       id: options.id
     })
     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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 
 })

+ 2 - 3
pages/dbVideo/dbVideo.js

@@ -11,13 +11,12 @@ Page({
   },
   onReady: function () {},
   async onLoad (options) {
-    let _this = this
-    _this.setData({
+    this.setData({
       id: options.id
     })
     wx.request({
       method: "POST",
-      url: app.globalData.publicUrl + '/wx/course/queryById?id=' + _this.data.id,
+      url: app.globalData.publicUrl + '/wx/course/queryById?id=' + this.data.id,
       success: (e) => {
         console.log(e)
         this.setData({

+ 13 - 63
pages/demandCourses/demandCourses.js

@@ -13,18 +13,18 @@ Page({
     })
   },
   getArr(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/selectRecordBySessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
-        console.log(res,"lb")
+      success: (res) => {
+        console.log(res, "lb")
         if (res.data.code == 0) {
           console.log(res)
-          _this.setData({
+          this.setData({
             lbArr: res.data.list
           })
           let result = [];
@@ -39,30 +39,30 @@ Page({
           let sfmArr = [];
           for (let i = 0; i < timesArr.length; i++) {
             let value = timesArr[i];
-            const resultValue = _this.handler(value);
+            const resultValue = this.handler(value);
             sfmArr.push({
               courseTime: resultValue
             })
-            _this.setData({
+            this.setData({
               sfmArr: sfmArr
             })
           }
-          if (_this.data.lbArr.length == 0) {
-            _this.setData({
+          if (this.data.lbArr.length == 0) {
+            this.setData({
               showNull: true
             })
           }
         } else {
-          if (_this.data.lbArr.length == 0) {
-            _this.setData({
+          if (this.data.lbArr.length == 0) {
+            this.setData({
               showNull: true
             })
           }
         }
       },
-      fail: function () {
-        if (_this.data.lbArr.length == 0) {
-          _this.setData({
+      fail: () => {
+        if (this.data.lbArr.length == 0) {
+          this.setData({
             showNull: true
           })
         }
@@ -91,55 +91,5 @@ Page({
   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)
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 2 - 2
pages/exhibitionList/exhibitionList.js

@@ -17,7 +17,7 @@ Page({
   },
   onChange(event) {
     console.log(event)
-    let _this = this;
+    // let _this = this;
     let tag = event.detail.name + 1;
     console.log(tag)
     wx.request({
@@ -25,7 +25,7 @@ Page({
       url: app.globalData.publicUrl + '/wx/course/listByCourseTag?tag=' + tag,
       success: (e) => {
         console.log(e, "我是tab点击回来的数据")
-        _this.setData({
+        this.setData({
           xcpArr: e.data.list,
         })
       }

+ 4 - 101
pages/index/index.js

@@ -1,4 +1,3 @@
-// const app1 = getApp();
 const app = require('../../utils/util.js');
 const tools = require('../../utils/tools.js');
 Page({
@@ -51,6 +50,7 @@ Page({
       })
     }
   },
+  // 往期开班
   goagoClass(e) {
     if (e.currentTarget.dataset.item !== 0) {
       wx.navigateTo({
@@ -107,7 +107,7 @@ Page({
   // banner图
   getBanner(sessionKey) {
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
+      url: app.globalData.publicUrl + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -122,7 +122,7 @@ Page({
   // 即将开班
   getjjLength(sessionKey) {
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
+      url: app.globalData.publicUrl + '/wx/student/selClasToo',
       method: "post",
       data: {
         sessionKey: sessionKey,
@@ -140,7 +140,7 @@ Page({
   // 往期开班
   getwqLength(sessionKey) {
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
+      url: app.globalData.publicUrl + '/wx/student/selClasToo',
       method: "post",
       data: {
         sessionKey: sessionKey,
@@ -174,107 +174,10 @@ Page({
   },
   onReady: function () {},
   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 () {
-
-  // }
 })

+ 23 - 86
pages/myClass/myClass.js

@@ -7,8 +7,6 @@ Page({
     show: false,
     SessionKey: "",
     notice: "暂无未读通知",
-    // className: '',
-    // logoImg: '',
     classInfo: {},
     kcArr: [],
     sfmArr: [],
@@ -21,8 +19,7 @@ Page({
     })
   },
   hidePopup() {
-    var _this = this;
-    _this.setData({
+    this.setData({
       show: false
     });
     var sessionKey = "";
@@ -30,7 +27,7 @@ Page({
       success: () => {
         sessionKey = wx.getStorageSync('sessionKey');
         wx.request({
-          url: app.globalData.publicUrl2 + '/wx/student/verification',
+          url: app.globalData.publicUrl + '/wx/student/verification',
           method: "post",
           data: {
             sessionKey: sessionKey
@@ -47,7 +44,7 @@ Page({
             console.log(res);
             var code = res.code
             wx.request({
-              url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
+              url: app.globalData.publicUrl + '/wx/user/wx7e7a46e129d6cd0f/login',
               method: "get",
               data: {
                 code
@@ -56,7 +53,7 @@ Page({
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 wx.request({
-                  url: app.globalData.publicUrl2 + '/wx/student/verification',
+                  url: app.globalData.publicUrl + '/wx/student/verification',
                   method: "post",
                   data: {
                     sessionKey: sessionKey
@@ -172,20 +169,20 @@ Page({
   },
   // 查询我是否有班&&班级名字
   isClass(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selMyClas',
+      url: app.globalData.publicUrl + '/wx/student/selMyClas',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res) =>{
         console.log(res.data.data, "我是返回是否有班级")
         if (res.data.code == 0) {
-          _this.setData({
+          this.setData({
             classInfo: res.data.data
           })
-          _this.isAgree(sessionKey);
+          this.isAgree(sessionKey);
         } else {
           wx.showModal({
             content: "您当前还没有开放的班级!",
@@ -205,23 +202,23 @@ Page({
   },
   // 协议是否已同意  
   isAgree(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selStudentSessionKey',
+      url: app.globalData.publicUrl + '/wx/student/selStudentSessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res) =>{
         console.log(res, "查询学员信息")
         if (res.data.code == 0 && res.data.data) {
           if (res.data.data.isAgree == 0) {
-            _this.setData({
+            this.setData({
               studentName: res.data.data.studentName,
               show: true
             });
           } else {
-            _this.setData({
+            this.setData({
               studentName: res.data.data.studentName,
               show: false
             });
@@ -233,20 +230,20 @@ Page({
   },
   // 我的通知
   getMynotice(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
-      url: app.globalData.publicUrl3 + '/wx/eduNoticeSee/list',
+      url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isSee: 1,
         isNotice: 0
       },
-      success: function (res) {
+      success:  (res) =>{
         console.log(res, "333333333")
         if (res.data.code == 0) {
           if (res.data.list && res.data.list.length !== 0)
-            _this.setData({
+            this.setData({
               notice: res.data.list[0].noticeContent
             });
         }
@@ -262,16 +259,16 @@ Page({
   },
   // // 我的课程
   getMycourse(sessionKey) {
-    var _this = this;
+    // var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res)=> {
         console.log(res, "kckckc")
-        _this.setData({
+        this.setData({
           kcArr: res.data.list
         });
         let result = [];
@@ -287,11 +284,11 @@ Page({
         let sfmArr = [];
         for (let i = 0; i < timesArr.length; i++) {
           let value = timesArr[i];
-          const resultValue = _this.handler(value);
+          const resultValue = this.handler(value);
           sfmArr.push({
             courseTime: resultValue
           })
-          _this.setData({
+          this.setData({
             sfmArr: sfmArr
           })
         }
@@ -322,65 +319,5 @@ Page({
     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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 65 - 264
pages/myInteractions/myInteractions.js

@@ -1,5 +1,5 @@
-// pages/myInteractions/myInteractions.js
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
 
   /**
@@ -25,155 +25,49 @@ Page({
       unactivebg: "#f2f2f2"
     })
   },
-  tab2Show() {
-    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);
-                  wx.request({
-                    url: app.globalData.publicUrl3 + '/wx/board/list',
-                    method: "post",
-                    data: {
-                      sessionKey: sessionKey
-                    },
-                    success: function (res) {
-                      console.log(res, "我是查到的列表")
-                      if (res.data.code == 0) {
-                        if (res.data.list.length == 0) {
-                          wx.showModal({
-                            showCancel: false,
-                            content: "您还没有提问哦"
-                          })
-                        } else {
-                          _this.setData({
-                            listArr: res.data.list,
-                            isshow1: true,
-                            isshow2: false,
-                            activebg: "#f2f2f2",
-                            unactivebg: "#ffeae9"
-                          })
-                        }
-                      } else {
-                        wx.showModal({
-                          showCancel: false,
-                          content: "您还没有提问哦"
-                        })
-                      }
-                    }
-                  })
-                }
-              })
-            }
-          })
-        } else {
-          wx.request({
-            url: app.globalData.publicUrl3 + '/wx/board/list',
-            method: "post",
-            data: {
-              sessionKey: sessionKey
-            },
-            success: function (res) {
-              if (res.data.code == 0) {
-                if (res.data.list.length == 0) {
-                  wx.showModal({
-                    showCancel: false,
-                    content: "您还没有提问哦"
-                  })
-                } else {
-                  _this.setData({
-                    listArr: res.data.list,
-                    isshow1: true,
-                    isshow2: false,
-                    activebg: "#f2f2f2",
-                    unactivebg: "#ffeae9"
-                  })
-                }
-              } else {
-                wx.showModal({
-                  showCancel: false,
-                  content: "您还没有提问哦"
-                })
-              }
-            }
-          })
-        }
+  askingList(sessionKey) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/board/list',
+      method: "post",
+      data: {
+        sessionKey: 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;
-                wx.request({
-                  url: app.globalData.publicUrl3 + '/wx/board/list',
-                  method: "post",
-                  data: {
-                    sessionKey: sessionKey
-                  },
-                  success: function (res) {
-                    console.log(res,"66666")
-                    if (res.data.code == 0) {
-                      if (res.data.list.length == 0) {
-                        wx.showModal({
-                          showCancel: false,
-                          content: "您还没有提问哦"
-                        })
-                      } else {
-                        _this.setData({
-                          listArr: res.data.list,
-                          isshow1: true,
-                          isshow2: false,
-                          activebg: "#f2f2f2",
-                          unactivebg: "#ffeae9"
-                        })
-                      }
-                    } else {
-                      wx.showModal({
-                        showCancel: false,
-                        content: "您还没有提问哦"
-                      })
-                    }
-                  }
-                })
-              }
+      success: (res) => {
+        console.log(res, "我是查到的列表")
+        if (res.data.code == 0) {
+          if (res.data.list.length == 0) {
+            wx.showModal({
+              showCancel: false,
+              content: "您还没有提问哦"
+            })
+          } else {
+            this.setData({
+              listArr: res.data.list,
+              isshow1: true,
+              isshow2: false,
+              activebg: "#f2f2f2",
+              unactivebg: "#ffeae9"
             })
           }
-        })
+        } else {
+          wx.showModal({
+            showCancel: false,
+            content: "您还没有提问哦"
+          })
+        }
       }
     })
   },
+  async tab2Show() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.askingList(sessionKey)
+  },
   gojjDetails(e) {
-    console.log(e.currentTarget.dataset.item, "我是带过来的值")
     let id = e.currentTarget.dataset.item.id
     if (e.currentTarget.dataset.item.replyContent == "" || e.currentTarget.dataset.item.replyContent == null) {
       wx.showModal({
         showCancel: false,
-        content: "您还没收到回复哦",
-        success(res) {}
+        content: "您还没收到回复哦"
       })
     } else {
       wx.navigateTo({
@@ -182,137 +76,44 @@ Page({
     }
 
   },
-  bindFormSubmit: function (e) {
-    // var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        var input_val = e.detail.value.textarea;
-        console.log(input_val)
-        if (input_val == "" || input_val == undefined) {
-          wx.showToast({
-            title: '反馈不能为空',
-            icon: 'none',
-            duration: 1000
-          })
-          return false;
-        } else {
-          wx.request({
-            url: app.globalData.publicUrl3 + '/wx/board/add',
-            method: "post",
-            data: {
-              content: input_val,
-              sessionKey: sessionKey
-            },
-            success: function (res) {
-              if (res.data.code == 0) {
-                wx.showModal({
-                  showCancel: false,
-                  content: "提交成功",
-                  success(res) {
-                    if (res.confirm) {
-                      wx.switchTab({
-                        url: '../personInfo/personInfo'
-                      })
-                    }
-                  }
-                })
-              } else {
-                wx.showModal({
-                  showCancel: false,
-                  content: res.data.msg,
-                  success(res) {}
+  async bindFormSubmit(e) {
+    let input_val = e.detail.value.textarea;
+    const sessionKey = await tools.checkSessionAndLogin();
+    if (input_val == "" || input_val == undefined) {
+      wx.showToast({
+        title: '反馈不能为空',
+        icon: 'none',
+        duration: 1000
+      })
+      return false;
+    }
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/board/add',
+      method: "post",
+      data: {
+        content: input_val,
+        sessionKey: sessionKey
+      },
+      success: (res) => {
+        if (res.data.code == 0) {
+          wx.showModal({
+            showCancel: false,
+            content: "提交成功",
+            success(res) {
+              if (res.confirm) {
+                wx.switchTab({
+                  url: '../personInfo/personInfo'
                 })
               }
             }
           })
+        } else {
+          wx.showModal({
+            showCancel: false,
+            content: res.data.msg
+          })
         }
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        wx.login({
-          success(res) {
-            console.log(res);
-            var code = res.code
-            wx.request({
-              url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-              method: "get",
-              data: {
-                code
-              },
-              success: function (res) {
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                var sessionKey = res.data.sessionKey;
-                wx.request({
-                  url: app.globalData.publicUrl3 + '/wx/board/add',
-                  method: "post",
-                  data: {
-                    content: input_val,
-                    sessionKey: sessionKey
-                  },
-                  success: function (res) {
-                    console.log("提交成功啦")
-                  }
-                })
-              }
-            })
-          }
-        })
       }
     })
-    // console.log(e.detail.value.textarea)
-  },
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
   }
 })

+ 4 - 6
pages/myInteractionsDetais/myInteractionsDetais.js

@@ -6,20 +6,18 @@ Page({
     teacherContent: ""
   },
   onLoad: function (options) {
-    var _this = this;
-    _this.setData({
+    this.setData({
       id: Number(options.id)
     })
     wx.request({
-      url: app.globalData.publicUrl3 + '/wx/board/detail/' + this.data.id,
+      url: app.globalData.publicUrl + '/wx/board/detail/' + this.data.id,
       method: "get",
-      success: function (res) {
+      success:  (res)=> {
         console.log(res,"我是详情")
-        _this.setData({
+        this.setData({
           myContent: res.data.content,
           teacherContent: res.data.replyContent
         })
-        // console.log(res, "woakndaola")
       }
     })
   }

+ 20 - 138
pages/myMission/myMission.js

@@ -102,16 +102,15 @@ Page({
     // }
   },
   getMycourse(sessionKey) {
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res) =>{
         if (res.data.code == 0 && res.data.list.length !== 0) {
-          _this.setData({
+          this.setData({
             kcArr: res.data.list,
             istask3: res.data.allDone
           });
@@ -128,11 +127,11 @@ Page({
           let sfmArr = [];
           for (let i = 0; i < timesArr.length; i++) {
             let value = timesArr[i];
-            const resultValue = _this.handler(value);
+            const resultValue = this.handler(value);
             sfmArr.push({
               courseTime: resultValue
             })
-            _this.setData({
+            this.setData({
               sfmArr: sfmArr
             })
           }
@@ -161,22 +160,21 @@ Page({
   },
   // 学员身份认证 检查第一个任务
   checkTaskList(sessionKey) {
-    var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selStudentSessionKey',
+      url: app.globalData.publicUrl + '/wx/student/selStudentSessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res)=> {
         console.log(res.data, "wwwwww")
         if (res.data.code == 0) {
           if (res.data.data.remark == 1) {
-            _this.setData({
+            this.setData({
               istask1: true
             })
           }
-          _this.setData({
+          this.setData({
             studentName: res.data.data.studentName,
           })
         }
@@ -185,19 +183,16 @@ Page({
   },
   // 查询我是否有班&&班级名字
   isClass(sessionKey) {
-    var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selMyClas',
+      url: app.globalData.publicUrl + '/wx/student/selMyClas',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success:  (res)=> {
         console.log(res, "我是返回是否有班级")
         if (res.data.code == 0) {
-          _this.setData({
-            // className: res.data.data.clasName,
-            // ewmurl: res.data.data.codeImg,
+          this.setData({
             classInfo: res.data.data
           })
         } else {
@@ -219,139 +214,29 @@ Page({
   },
   // 记录二维码已经点击
   ewmClick(sessionKey) {
-    let _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/wxGroup',
+      url: app.globalData.publicUrl + '/wx/student/wxGroup',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
-        console.log(res)
-        _this.setData({
+      success:  (res)=> {
+        this.setData({
           showewm: true,
           istask1: true
         })
       }
     })
   },
-  // ewmGet(sessionKey) {
-  //   let _this = this;
-  //   wx.request({
-  //     url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
-  //     method: "post",
-  //     data: {
-  //       sessionKey: sessionKey
-  //     },
-  //     success: function (res) {
-  //       console.log(res.data.data, "22222222")
-  //       var filterArr = res.data.data.claList.filter(o => o.isActive == 5)
-  //       console.log(filterArr, "111111111111")
-  //       if (filterArr.length !== 0) {
-  //         _this.setData({
-  //           ewmurl: filterArr[0].codeImg
-  //         })
-  //       }
-  //     }
-  //   })
-  // },
-  showEwm() {
-    var sessionKey = "";
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        sessionKey = wx.getStorageSync('sessionKey');
-        // console.log(sessionKey)
-        _this.ewmClick(sessionKey)
-        // _this.ewmGet(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.ewmClick(sessionKey)
-                // _this.ewmGet(sessionKey)
-              }
-            })
-          }
-        })
-      }
-    })
+  async showEwm() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.ewmClick(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()
@@ -368,10 +253,8 @@ Page({
    * 生命周期函数--监听页面初次渲染完成
    */
   saveImg() {
-    let _this = this;
-    console.log(_this.data.ewmurl)
     wx.getSetting({
-      success(res) {
+      success:(res)=> {
         if (!res.authSetting['scope.writePhotosAlbum']) {
           wx.authorize({
             scope: 'scope.writePhotosAlbum',
@@ -380,7 +263,7 @@ Page({
               wx.showLoading({
                 title: '保存中...'
               })
-              var imgSrc = _this.data.ewmurl;
+              var imgSrc = this.data.ewmurl;
               wx.downloadFile({
                 url: imgSrc,
                 success: function (res) {
@@ -420,11 +303,10 @@ Page({
                   })
                 }
               })
-              console.log('授权成功')
             }
           })
         } else {
-          var imgSrc = _this.data.ewmurl
+          var imgSrc = this.data.ewmurl
           wx.downloadFile({
             url: imgSrc,
             success: function (res) {

+ 19 - 235
pages/myNotice/myNotice.js

@@ -10,319 +10,103 @@ Page({
     showNull1: false
   },
   getArr(sessionKey) {
-    let _this = this;
+    // let _this = this;
     wx.request({
-      url: app.globalData.publicUrl3 + '/wx/eduNoticeSee/list',
+      url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isSee: 1,
         isNotice: 0
       },
-      success: function (res) {
+      success: (res) => {
         if (res.data.code == 0) {
           if (res.data.list.length !== 0) {
-            _this.setData({
+            this.setData({
               showNull: false,
               wdArr: res.data.list
             })
           } else {
-            _this.setData({
+            this.setData({
               wdArr: res.data.list,
               showNull: true
             })
           }
         } else {
-          _this.setData({
+          this.setData({
             showNull: true
           })
         }
       },
-      fail: function () {
-        _this.setData({
+      fail: () => {
+        this.setData({
           showNull: true
         })
       }
     })
   },
   getArr1(sessionKey) {
-    let _this = this;
     wx.request({
-      url: app.globalData.publicUrl3 + '/wx/eduNoticeSee/list',
+      url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isSee: 0,
         isNotice: 0
       },
-      success: function (res) {
+      success: (res) => {
         if (res.data.code == 0) {
           if (res.data.list.length !== 0) {
-            _this.setData({
+            this.setData({
               showNull1: false,
               ydArr: res.data.list
             })
           } else {
-            _this.setData({
+            this.setData({
               ydArr: res.data.list,
               showNull1: true
             })
           }
         } else {
-          _this.setData({
+          this.setData({
             showNull1: true
           })
         }
       },
-      fail: function () {
-        _this.setData({
+      fail: () => {
+        this.setData({
           showNull1: true
         })
       }
     })
   },
   async onChange(event) {
-    // var _this = this;
     if (event.detail.index == 1) {
       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 {
-      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);
-      //           }
-      //         })
-      //       }
-      //     })
-      //   }
-      // })
     }
   },
   meRead(sessionKey, noticeId) {
-    var _this = this;
     wx.request({
-      url: app.globalData.publicUrl3 + '/wx/eduNoticeSee/edit',
+      url: app.globalData.publicUrl + '/wx/eduNoticeSee/edit',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isSee: 0,
         noticeId: noticeId
       },
-      success: function (res) {
-        _this.getArr(sessionKey)
+      success: () => {
+        this.getArr(sessionKey)
       }
     })
   },
   async btn(e) {
-    console.log(e.currentTarget.dataset.item.noticeId, "99999")
     let noticeId = e.currentTarget.dataset.item.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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   },
-  async onLoad () {
+  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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 11 - 63
pages/myTraining/myTraining.js

@@ -1,5 +1,3 @@
-//logs.js
-// const util = require('../../utils/util.js')
 const tools = require('../../utils/tools.js');
 const app = require('../../utils/util.js');
 Page({
@@ -13,92 +11,42 @@ Page({
     })
   },
   getArr(sessionKey) {
-    var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selWholeClas',
+      url: app.globalData.publicUrl + '/wx/student/selWholeClas',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success: (res) => {
         console.log(res.data.data, "22222")
         if (res.data.code == 0) {
-          _this.setData({
+          this.setData({
             dataArr: res.data.data
           })
-          if (_this.data.dataArr.length == 0) {
-            _this.setData({
+          if (this.data.dataArr.length == 0) {
+            this.setData({
               showNull: true
             })
           }
         } else {
-          if (_this.data.dataArr.length == 0) {
-            _this.setData({
+          if (this.data.dataArr.length == 0) {
+            this.setData({
               showNull: true
             })
           }
         }
       },
-      fail: function () {
-        if (_this.data.dataArr.length == 0) {
-          _this.setData({
+      fail: () => {
+        if (this.data.dataArr.length == 0) {
+          this.setData({
             showNull: true
           })
         }
       }
     })
   },
-  async onLoad () {
+  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);
-    //     }
-
-    //   },
-    //   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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 1 - 1
pages/myTraining/myTraining.wxss

@@ -26,7 +26,7 @@
 
 .t1 {
   color: #eb3f33;
-  font-size: 30rpx;
+  font-size: 25rpx;
   font-weight: 700;
 }
 .t2 {

+ 9 - 72
pages/onlineClass/onlineClass.js

@@ -1,5 +1,3 @@
-//logs.js
-// const util = require('../../utils/util.js')
 const tools = require('../../utils/tools.js');
 const app = require('../../utils/util.js');
 Page({
@@ -17,47 +15,38 @@ Page({
     } else {
       wx.showModal({
         showCancel: false,
-        content: "直播还未开始哦",
-        success(res) {
-          if (res.confirm) {
-
-          }
-        }
+        content: "直播还未开始哦"
       })
     }
-
   },
   getArr(sessionKey) {
-    console.log(sessionKey)
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/selectLivesBySessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
       },
-      success: function (res) {
+      success: (res) => {
         if (res.data.code == 0) {
-          _this.setData({
+          this.setData({
             zbArr: res.data.list
           })
           if (res.data.list.length == 0) {
-            _this.setData({
+            this.setData({
               showNull: true
             })
           }
         } else {
-          if (_this.data.zbArr.length == 0) {
-            _this.setData({
+          if (this.data.zbArr.length == 0) {
+            this.setData({
               showNull: true
             })
           }
         }
-        // console.log(res)
       },
-      fail: function () {
-        if (_this.data.zbArr.length == 0) {
-          _this.setData({
+      fail: () => {
+        if (this.data.zbArr.length == 0) {
+          this.setData({
             showNull: true
           })
         }
@@ -67,57 +56,5 @@ Page({
   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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 3 - 55
pages/startClass/startClass.js

@@ -5,17 +5,16 @@ Page({
     dataArr: []
   },
   getjj(sessionKey) {
-    var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
+      url: app.globalData.publicUrl + '/wx/student/selClasToo',
       method: "post",
       data: {
         sessionKey: sessionKey,
         isActive: "0"
       },
-      success: function (res) {
+      success:  (res)=> {
         console.log(res.data, "我是即将开班的列表")
-        _this.setData({
+        this.setData({
           dataArr: res.data.data
         })
       }
@@ -24,56 +23,5 @@ Page({
   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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 })

+ 1 - 56
pages/welcome/welcome.js

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

+ 40 - 183
pages/zbDetails/zbDetails.js

@@ -1,5 +1,3 @@
-//index.js
-//获取应用实例
 const app = require('../../utils/util.js');
 const tools = require('../../utils/tools.js');
 Page({
@@ -24,22 +22,6 @@ Page({
     _timeout: 5000,
     isCloseStatus: false
   },
-  // startBf: function () {
-  //   //pullUrl: `rtmp://hnb.spaceships.cn/education/live56?auth_key=1593654178-0-0-30f7fa190656ddb994151d23cf30d3b7`
-  //   var _this = this;
-  //   _this.setData({
-  //     pushUrl: _this.data.pushUrl,
-  //     // isPush: false
-  //   })
-  //   _this.data.videoContext.start();
-  // },
-  // stopBf: function () {
-  //   this.setData({
-  //     pushUrl: ``,
-  //     // isPush: true
-  //   })
-  //   this.data.videoContext.stop()
-  // },
   statechange: function (e) {
     console.log(e)
   },
@@ -59,18 +41,14 @@ Page({
     this.sendSocketMessage("put up hands")
   },
   submit: function () {
-    let _this = this;
-    let input_val = _this.data.inputValue;
-    _this.sendSocketMessage(input_val)
+    let input_val = this.data.inputValue;
+    this.sendSocketMessage(input_val)
     this.setData({
       inputValue: ''
     })
   },
-  fullScreen: function () {
-    var that = this;
-    //全屏
-    // var vidoHeight = wx.getSystemInfoSync().windowHeight;
-    var fullScreenFlag = that.data.fullScreenFlag;
+  fullScreen: function() {
+    var fullScreenFlag = this.data.fullScreenFlag;
     if (fullScreenFlag) {
       fullScreenFlag = false;
     } else {
@@ -78,52 +56,51 @@ Page({
     }
     if (fullScreenFlag) {
       //全屏
-      that.data.livectx.requestFullScreen({
-        success: res => {
-          that.setData({
+      this.data.livectx.requestFullScreen({
+        success: () => {
+          this.setData({
             fullScreenFlag: fullScreenFlag,
             spfx: "horizontal",
             spfx1: "horizontal"
           });
-          if (that.data.isHands == true) {
-            that.setData({
+          if (this.data.isHands == true) {
+            this.setData({
               isHands: false
             })
-            that.setData({
+            this.setData({
               isHands: true
             })
           }
           console.log('我要全屏执行了');
         },
-        fail: res => {
+        fail: () => {
           console.log('我要全屏执行失败了');
         }
       });
     } else {
       //缩小
-      that.data.livectx.exitFullScreen({
-        success: res => {
+      this.data.livectx.exitFullScreen({
+        success: () => {
           console.log('fullscreen success');
-          that.setData({
+          this.setData({
             fullScreenFlag: fullScreenFlag,
             spfx: "vertical",
             spfx1: "vertical"
           });
         },
-        fail: res => {
+        fail: () => {
           console.log('exit fullscreen success');
         }
       });
     }
   },
   getZbArr(sessionKey) {
-    var _this = this;
     wx.request({
       url: app.globalData.publicUrl + '/wx/course/selectLiveByCourseId',
       method: "post",
       data: {
         sessionKey: sessionKey,
-        courseId: _this.data.id
+        courseId: this.data.id
       },
       success: (e) => {
         console.log(e, "11111111111111111")
@@ -137,23 +114,19 @@ Page({
     })
   },
   socketConnect(sessionKey) {
-    var _this = this;
     var newSessionkey = encodeURIComponent(sessionKey);
     wx.connectSocket({
-      url: app.globalData.publicSocketUrl + '/live/socket?sessionkey=' + newSessionkey + "&courseId=" + _this.data.id
+      url: app.globalData.publicSocketUrl + '/live/socket?sessionkey=' + newSessionkey + "&courseId=" + this.data.id
     })
-    wx.onSocketOpen(function () {
+    wx.onSocketOpen(() => {
       console.log("我连上啦")
-      _this.setData({
+      this.setData({
         socketOpen: true
       })
-      // _this.data.timeoutObj = setInterval(() => {
-      //   _this.startHeart(sessionKey)
-      // }, _this.data._timeout)
-      _this.setData({
-        timeoutObj: setInterval(function () {
-          _this.startHeart(sessionKey)
-        }, _this.data._timeout)
+      this.setData({
+        timeoutObj: setInterval( ()=> {
+          this.startHeart(sessionKey)
+        }, this.data._timeout)
       })
     })
     wx.onSocketError(function () {
@@ -162,27 +135,26 @@ Page({
     wx.onSocketClose(function () {
       console.log("我关了")
     })
-    wx.onSocketMessage(function (data) {
+    wx.onSocketMessage((data) => {
       console.log(data, "2222222222222")
       let res = JSON.parse(data.data);
-      console.log(res)
       if (res.msg == "HeartBeat") {
         return false;
       }
       if (res.messageType == "message" || res.messageType == "system") {
-        _this.setData({
-          chatContent: _this.data.chatContent.concat(res),
+        this.setData({
+          chatContent: this.data.chatContent.concat(res),
           bottom: 'scrollBottom'
         })
       }
       if (res.msg == "socketLiveEnd") {
-        _this.setData({
+        this.setData({
           url: "",
         })
-        if (_this.data.socketOpen) {
+        if (this.data.socketOpen) {
           wx.closeSocket()
         }
-        _this.data.videoContext.stop()
+        this.data.videoContext.stop()
         wx.showModal({
           showCancel: false,
           content: "直播结束了",
@@ -197,26 +169,24 @@ Page({
       }
       if (res.messageType == "studentPushStream") {
         console.log(res, "我收到了举手的推流")
-        _this.data.videoContext.start();
-        _this.setData({
+        this.data.videoContext.start();
+        this.setData({
           isHands: true,
           pushUrl: res.pushUrl
         })
       }
       if (res.messageType == "stopStudentPushStream") {
         console.log(res.pushUrl, "不推了")
-        _this.data.videoContext.stop()
-        _this.setData({
+        this.data.videoContext.stop()
+        this.setData({
           isHands: false,
           pushUrl: ""
         })
-
       }
     })
   },
   // 发送消息
   sendSocketMessage(msg) {
-    // console.log(this.data.socketOpen)
     if (this.data.socketOpen) {
       wx.sendSocketMessage({
         data: msg
@@ -225,81 +195,26 @@ Page({
   },
   // 心跳
   startHeart(sessionKey) {
-    let _this = this;
     wx.sendSocketMessage({
       data: "HeartBeat",
-      success(res) {
+      success: (res) => {
         console.log(res, "发送心跳成功")
       },
-      fail(err) {
+      fail: (err) => {
         console.log(err, "发送心跳失败")
-        if (_this.data.isCloseStatus == false) {
+        if (this.data.isCloseStatus == false) {
           wx.closeSocket();
-          clearInterval(_this.data.timeoutObj);
-          _this.socketConnect(sessionKey);
+          clearInterval(this.data.timeoutObj);
+          this.socketConnect(sessionKey);
         } else {
-          clearInterval(_this.data.timeoutObj);
+          clearInterval(this.data.timeoutObj);
         }
       }
     })
   },
-  // clearDs() {
-  //   clearInterval(this.data.timeoutObj);
-  // },
   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({
@@ -321,8 +236,7 @@ Page({
     clearInterval(this.data.timeoutObj);
     this.data.videoContext.stop()
   },
-  async onLoad (options) {
-    // var _this = this;
+  async onLoad(options) {
     this.setData({
       id: options.id,
       videoContext: wx.createLivePusherContext("video-livePusher"),
@@ -330,63 +244,6 @@ Page({
     })
     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);
-    //           }
-    //         })
-    //       }
-    //     })
-    //   }
-    // })
   }
 
 })

+ 2 - 2
utils/tools.js

@@ -2,7 +2,7 @@ const app = require('../utils/util.js');
 const request = (url, data = {}, type = 'GET') => {
   return new Promise((resolve, reject) => {
     wx.request({
-      url: `${app.globalData.publicUrl2}${url}`,
+      url: `${app.globalData.publicUrl}${url}`,
       method: type,
       data,
       success({
@@ -29,7 +29,7 @@ const checkSessionAndLogin = () => {
       success() {
         const sessionKey = wx.getStorageSync('sessionKey');
         wx.request({
-          url: app.globalData.publicUrl2 + '/wx/student/inspectSession',
+          url: app.globalData.publicUrl + '/wx/student/inspectSession',
           method: "post",
           data: {
             sessionKey: sessionKey

+ 7 - 15
utils/util.js

@@ -1,23 +1,15 @@
 const globalData = {
   // 正式服务器
-  // publicUrl: 'https://sqdx.jiaxintech.com',
-  // publicUrl2: 'https://sqdx.jiaxintech.com',
-  // publicUrl3: 'https://sqdx.jiaxintech.com',
-  // publicSocketUrl: 'wss://sqdx.jiaxintech.com'
+  publicUrl: '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: 'https://sqdx.windd.cn',
+  // publicSocketUrl: 'wss://sqdx.windd.cn'
   // 本地huyubo
-  // publicUrl: 'http://10.16.4.19:8090',
-  // publicUrl2: 'http://10.16.4.19:8090', 
-  // publicUrl3: 'http://10.16.4.19:8090',
+  // publicUrl: 'http://10.16.4.19:8090',,
   // publicSocketUrl: 'ws://10.16.4.19:8090'
-    // 本地luyu 
-  // publicUrl: 'http://10.16.10.139:8090',
-  // publicUrl2: 'http://10.16.10.139:8090', 
-  // publicUrl3: 'http://10.16.10.139:8090', 
+  // 本地luyu 
+  // publicUrl: 'http://10.16.10.139:8090', 
   // publicSocketUrl: 'ws://10.16.10.139:8090'
 };
 module.exports = {