ssfg 5 年之前
父节点
当前提交
9fa2ef4a21
共有 6 个文件被更改,包括 108 次插入141 次删除
  1. 6 58
      pages/index/index.js
  2. 40 43
      pages/myClass/myClass.js
  3. 59 35
      pages/myMission/myMission.js
  4. 1 0
      pages/personInfo/personInfo.js
  5. 0 3
      pages/zbDetails/zbDetails.js
  6. 2 2
      utils/util.js

+ 6 - 58
pages/index/index.js

@@ -183,58 +183,6 @@ Page({
         kjShow: false
         kjShow: false
       })
       })
     }, 4000)
     }, 4000)
-    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.getfour();
-                }
-              })
-            }
-          })
-        } else {
-          _this.getBanner(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.getfour();
-              }
-            })
-          }
-        })
-      }
-    })
   },
   },
   onShow: function () {
   onShow: function () {
     var _this = this;
     var _this = this;
@@ -256,19 +204,19 @@ Page({
                 success: function (res) {
                 success: function (res) {
                   sessionKey = res.data.sessionKey;
                   sessionKey = res.data.sessionKey;
                   wx.setStorageSync('sessionKey', res.data.sessionKey);
                   wx.setStorageSync('sessionKey', res.data.sessionKey);
-                  // _this.getBanner(sessionKey);
+                  _this.getBanner(sessionKey);
                   _this.getjjLength(sessionKey);
                   _this.getjjLength(sessionKey);
                   _this.getwqLength(sessionKey);
                   _this.getwqLength(sessionKey);
-                  // _this.getfour();
+                  _this.getfour();
                 }
                 }
               })
               })
             }
             }
           })
           })
         } else {
         } else {
-          // _this.getBanner(sessionKey);
+          _this.getBanner(sessionKey);
           _this.getjjLength(sessionKey);
           _this.getjjLength(sessionKey);
           _this.getwqLength(sessionKey);
           _this.getwqLength(sessionKey);
-          // _this.getfour();
+          _this.getfour();
         }
         }
       },
       },
       fail() {
       fail() {
@@ -286,10 +234,10 @@ Page({
               success: function (res) {
               success: function (res) {
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey
                 var sessionKey = res.data.sessionKey
-                // this.getBanner(sessionKey);
+                this.getBanner(sessionKey);
                 this.getjjLength(sessionKey);
                 this.getjjLength(sessionKey);
                 this.getwqLength(sessionKey);
                 this.getwqLength(sessionKey);
-                // this.getfour();
+                this.getfour();
               }
               }
             })
             })
           }
           }

+ 40 - 43
pages/myClass/myClass.js

@@ -4,7 +4,7 @@ Page({
     showMore: false, //更多
     showMore: false, //更多
     show: false,
     show: false,
     SessionKey: "",
     SessionKey: "",
-    notice: "",
+    notice: "暂无通知",
     className: '',
     className: '',
     kcArr: [],
     kcArr: [],
     sfmArr: []
     sfmArr: []
@@ -107,7 +107,7 @@ Page({
     //   title: '领取成功'
     //   title: '领取成功'
     // })
     // })
   },
   },
-  goQmks(){
+  goQmks() {
     wx.showModal({
     wx.showModal({
       showCancel: false,
       showCancel: false,
       content: "此功能暂时还未开放哦",
       content: "此功能暂时还未开放哦",
@@ -148,59 +148,55 @@ Page({
       })
       })
     }
     }
   },
   },
-  // 我的班级名字
-  getClassName(sessionKey) {
-    var _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)
-        if (filterArr.length !== 0) {
-          _this.setData({
-            className: filterArr[0].clasName
-          })
-        }
-      }
-    })
-  },
-  // 查询我是否有班
+  // 查询我是否有班&&班级名字
   isClass(sessionKey) {
   isClass(sessionKey) {
     var _this = this;
     var _this = this;
     wx.request({
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selMyClas',
       method: "post",
       method: "post",
       data: {
       data: {
         sessionKey: sessionKey
         sessionKey: sessionKey
       },
       },
       success: function (res) {
       success: function (res) {
-        console.log(res.data, "我是返回的班级列表")
-        var filterArr = res.data.data.claList.filter(o => o.isActive == 5)
-        console.log(filterArr, "我是筛选出来的数组")
-        if (filterArr.length == 0) {
+        console.log(res, "我是返回的班级列表")
+        if (res.data.code == 0) {
+          if (res.data.data !== null || res.data.data !== "") {
+            _this.setData({
+              className: res.data.data.clasName
+            })
+          } else {
+            wx.showModal({
+              content: "您还未加入班级,快去认证吧!",
+              success(res) {
+                if (res.confirm) {
+                  wx.navigateTo({
+                    url: '../Identity/Identity'
+                  })
+                } else {
+                  wx.switchTab({
+                    url: '../myClass/myClass'
+                  })
+                }
+              }
+            })
+            return false;
+          }
+        } else {
           wx.showModal({
           wx.showModal({
-            // showCancel: false,
             content: "您还未加入班级,快去认证吧!",
             content: "您还未加入班级,快去认证吧!",
             success(res) {
             success(res) {
               if (res.confirm) {
               if (res.confirm) {
                 wx.navigateTo({
                 wx.navigateTo({
                   url: '../Identity/Identity'
                   url: '../Identity/Identity'
                 })
                 })
-              }else{
-                wx.navigateTo({
+              } else {
+                wx.switchTab({
                   url: '../myClass/myClass'
                   url: '../myClass/myClass'
                 })
                 })
               }
               }
             }
             }
           })
           })
           return false;
           return false;
-        } else {
-          _this.isAgree(sessionKey);
         }
         }
       }
       }
     })
     })
@@ -244,7 +240,7 @@ Page({
       },
       },
       success: function (res) {
       success: function (res) {
         console.log(res, "333333333")
         console.log(res, "333333333")
-        if (res.data)
+        if (res.data.list && res.data.list.length !== 0)
           _this.setData({
           _this.setData({
             notice: res.data.list[0].noticeContent
             notice: res.data.list[0].noticeContent
           });
           });
@@ -266,11 +262,12 @@ Page({
           kcArr: res.data.list
           kcArr: res.data.list
         });
         });
         let result = [];
         let result = [];
-        for (var i = 0; i < res.data.list.length; i++) {
-          result.push({
-            courseTime: res.data.list[i].courseTime
-          });
-        }
+        if (res.data.list)
+          for (var i = 0; i < res.data.list.length; i++) {
+            result.push({
+              courseTime: res.data.list[i].courseTime
+            });
+          }
         const timesArr = result.map((item) => {
         const timesArr = result.map((item) => {
           return item.courseTime;
           return item.courseTime;
         });
         });
@@ -329,7 +326,7 @@ Page({
                   sessionKey = res.data.sessionKey;
                   sessionKey = res.data.sessionKey;
                   wx.setStorageSync('sessionKey', res.data.sessionKey);
                   wx.setStorageSync('sessionKey', res.data.sessionKey);
                   _this.isClass(sessionKey);
                   _this.isClass(sessionKey);
-                  _this.getClassName(sessionKey);
+                  // _this.getClassName(sessionKey);
                   _this.getMycourse(sessionKey);
                   _this.getMycourse(sessionKey);
                   _this.getMynotice(sessionKey);
                   _this.getMynotice(sessionKey);
                 }
                 }
@@ -339,7 +336,7 @@ Page({
         } else {
         } else {
           _this.isClass(sessionKey);
           _this.isClass(sessionKey);
           _this.getMycourse(sessionKey);
           _this.getMycourse(sessionKey);
-          _this.getClassName(sessionKey);
+          // _this.getClassName(sessionKey);
           _this.getMynotice(sessionKey);
           _this.getMynotice(sessionKey);
         }
         }
       },
       },
@@ -360,7 +357,7 @@ Page({
                 var sessionKey = res.data.sessionKey;
                 var sessionKey = res.data.sessionKey;
                 _this.isClass(sessionKey);
                 _this.isClass(sessionKey);
                 _this.getMycourse(sessionKey);
                 _this.getMycourse(sessionKey);
-                _this.getClassName(sessionKey);
+                // _this.getClassName(sessionKey);
                 _this.getMynotice(sessionKey);
                 _this.getMynotice(sessionKey);
               }
               }
             })
             })

+ 59 - 35
pages/myMission/myMission.js

@@ -9,7 +9,7 @@ Page({
     showzs: false,
     showzs: false,
     kcArr: [],
     kcArr: [],
     ewmurl: '',
     ewmurl: '',
-    sfmArr:[],
+    sfmArr: [],
     istask1: false,
     istask1: false,
     istask2: false,
     istask2: false,
     istask3: false,
     istask3: false,
@@ -62,8 +62,10 @@ Page({
     })
     })
   },
   },
   lq() {
   lq() {
-    wx.showToast({
-      title: '领取成功'
+    wx.showModal({
+      showCancel: false,
+      content: "此功能暂时还未开放哦",
+      success(res) {}
     })
     })
     // this.setData({
     // this.setData({
     //   showzs: true
     //   showzs: true
@@ -92,30 +94,32 @@ Page({
         sessionKey: sessionKey
         sessionKey: sessionKey
       },
       },
       success: function (res) {
       success: function (res) {
-        console.log(res,"11111111111111")
-        _this.setData({
-          kcArr: res.data.list,
-          istask3:res.data.allDone
-        });
-        let result = [];
-        for (var i = 0; i < res.data.list.length; i++) {
-          result.push({
-            courseTime: res.data.list[i].courseTime
-          });
-        }
-        const timesArr = result.map((item) => {
-          return item.courseTime;
-        });
-        let sfmArr = [];
-        for (let i = 0; i < timesArr.length; i++) {
-          let value = timesArr[i];
-          const resultValue = _this.handler(value);
-          sfmArr.push({
-            courseTime: resultValue
-          })
+        if (res.data.code == 0) {
           _this.setData({
           _this.setData({
-            sfmArr: sfmArr
-          })
+            kcArr: res.data.list,
+            istask3: res.data.allDone
+          });
+          let result = [];
+          if (res.data.list)
+            for (var i = 0; i < res.data.list.length; i++) {
+              result.push({
+                courseTime: res.data.list[i].courseTime
+              });
+            }
+          const timesArr = result.map((item) => {
+            return item.courseTime;
+          });
+          let sfmArr = [];
+          for (let i = 0; i < timesArr.length; i++) {
+            let value = timesArr[i];
+            const resultValue = _this.handler(value);
+            sfmArr.push({
+              courseTime: resultValue
+            })
+            _this.setData({
+              sfmArr: sfmArr
+            })
+          }
         }
         }
       }
       }
     })
     })
@@ -161,28 +165,48 @@ Page({
     })
     })
   },
   },
   isClass(sessionKey) {
   isClass(sessionKey) {
+    var _this = this;
     wx.request({
     wx.request({
-      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selMyClas',
       method: "post",
       method: "post",
       data: {
       data: {
         sessionKey: sessionKey
         sessionKey: sessionKey
       },
       },
       success: function (res) {
       success: function (res) {
-        console.log(res.data, "我是返回的班级列表")
-        let filterArr = res.data.data.claList.filter(o => o.isActive == 5)
-        console.log(filterArr, "我是筛选出来的数组")
-        if (filterArr.length == 0) {
+        console.log(res, "我是返回的班级列表")
+        if (res.data.code == 0) {
+          if (res.data.data !== null || res.data.data !== "") {
+            _this.setData({
+              className: res.data.data.clasName
+            })
+          } else {
+            wx.showModal({
+              content: "您还未加入班级,快去认证吧!",
+              success(res) {
+                if (res.confirm) {
+                  wx.navigateTo({
+                    url: '../Identity/Identity'
+                  })
+                } else {
+                  wx.switchTab({
+                    url: '../myClass/myClass'
+                  })
+                }
+              }
+            })
+            return false;
+          }
+        } else {
           wx.showModal({
           wx.showModal({
-            // showCancel: false,
             content: "您还未加入班级,快去认证吧!",
             content: "您还未加入班级,快去认证吧!",
             success(res) {
             success(res) {
               if (res.confirm) {
               if (res.confirm) {
                 wx.navigateTo({
                 wx.navigateTo({
                   url: '../Identity/Identity'
                   url: '../Identity/Identity'
                 })
                 })
-              }else{
-                wx.navigateTo({
-                  url: '../myMission/myMission'
+              } else {
+                wx.switchTab({
+                  url: '../myClass/myClass'
                 })
                 })
               }
               }
             }
             }

+ 1 - 0
pages/personInfo/personInfo.js

@@ -9,6 +9,7 @@ Page({
     })
     })
   },
   },
   goMytraining() {
   goMytraining() {
+
     wx.navigateTo({
     wx.navigateTo({
       url: '/pages/myTraining/myTraining',
       url: '/pages/myTraining/myTraining',
     })
     })

+ 0 - 3
pages/zbDetails/zbDetails.js

@@ -31,9 +31,6 @@ Page({
   hands() {
   hands() {
     this.sendSocketMessage("put up hands")
     this.sendSocketMessage("put up hands")
   },
   },
-  // console.log(this.data.myWrite)
-  // this.sendSocketMessage(this.data.myWrite)
-  // this.sendSocketMessage(this.data.myWrite)
   submit: function () {
   submit: function () {
     let _this = this;
     let _this = this;
     let input_val = _this.data.inputValue;
     let input_val = _this.data.inputValue;

+ 2 - 2
utils/util.js

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