ssfg пре 5 година
родитељ
комит
6b116840b2
6 измењених фајлова са 129 додато и 35 уклоњено
  1. 30 6
      pages/index/index.js
  2. 58 4
      pages/myClass/myClass.js
  3. 33 21
      pages/myMission/myMission.js
  4. 0 1
      pages/testAnswer/testAnswer.js
  5. 6 1
      utils/tools.js
  6. 2 2
      utils/util.js

+ 30 - 6
pages/index/index.js

@@ -7,7 +7,7 @@ Page({
     isNeedlogin: false,
     // 课程轮播
     bnrUrl: [{
-      clasImg:"../../images/zbfm.png"
+      clasImg: "../../images/zbfm.png"
     }],
     gridArr: [{
       url: "/images/icon1.png",
@@ -25,8 +25,8 @@ Page({
       url: "/images/icon4.png",
       name: "测试答卷",
       isread: true
-    }],
-    xczsArr: []
+    }]
+    // xczsArr: []
   },
   gomyClass(e) {
     console.log(e.currentTarget.dataset.item.isActive, "我是测试跳转的")
@@ -180,6 +180,27 @@ Page({
       }
     })
   },
+  getfour1() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/listCategory',
+      method: "post",
+      success: (res) => {
+        // console.log(JSON.stringify(this.data.xczsArr))
+        // console.log(JSON.stringify(res.data.list))
+        if (this.data.xczsArr.sort().toString() == res.data.list.sort().toString()) {
+          console.log("我和上次一样")
+        } else {
+          console.log("我和上次不一样")
+          this.setData({
+            xczsArr: res.data.list
+          })
+        }
+      },
+      fail(res) {
+        console.log(res, "调取请求公开课失败")
+      }
+    })
+  },
   getRedPoint1(sessionKey) {
     let completeStatus1 = `gridArr[${0}].isread`;
     let completeStatus2 = `gridArr[${1}].isread`;
@@ -231,13 +252,16 @@ Page({
   },
   onReady: function () {},
   async onShow() {
-    // console.log("我调用了onShow")
     const sessionKey = await tools.checkSessionAndLogin();
     this.getBanner(sessionKey);
     this.getjjLength(sessionKey);
     this.getwqLength(sessionKey);
+    this.getRedPoint1(sessionKey);
+    this.getRedPoint4(sessionKey);
+    this.getfour1();
+  },
+  async onLoad() {
+    // console.log("我调用了onShow")
     this.getfour();
-    this.getRedPoint1(sessionKey)
-    this.getRedPoint4(sessionKey)
   },
 })

+ 58 - 4
pages/myClass/myClass.js

@@ -314,6 +314,56 @@ Page({
       }
     })
   },
+  getMycourse1(sessionKey) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
+      method: "post",
+      data: {
+        sessionKey: sessionKey
+      },
+      success: (res) => {
+        if (this.data.kcArr.sort().toString() == res.data.list.sort().toString()) {
+          console.log("我和上次一样")
+        } else {
+          console.log("我和上次不一样")
+          this.setData({
+            kcArr: res.data.list,
+            istask2: res.data.allDone
+          });
+          console.log(this.data.kcArr, "9999999999999999")
+          for (let i = 0; i < res.data.list.length; i++) {
+            if (res.data.list[i].isStudyDone == 0) {
+              this.setData({
+                IngCourseArr: res.data.list[i]
+              })
+            }
+          }
+          let result = [];
+          if (res.data.list)
+            for (let 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
+            })
+          }
+        }
+
+      }
+    })
+  },
   // 时间换算
   handler(value) {
     //换算为秒 进制1000
@@ -845,13 +895,17 @@ Page({
   },
   async onShow() {
     const sessionKey = await tools.checkSessionAndLogin();
-    this.setData({
-      sessionKey: sessionKey
-    })
     this.isClass(sessionKey);
-    this.getMycourse(sessionKey);
+    this.getMycourse1(sessionKey);
     this.getMynotice(sessionKey);
     this.checkTaskList1(sessionKey)
 
+  },
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.setData({
+      sessionKey: sessionKey
+    })
+    this.getMycourse(sessionKey);
   }
 })

+ 33 - 21
pages/myMission/myMission.js

@@ -340,16 +340,28 @@ Page({
   },
   // 去学习
   goStudy(e) {
-    if (this.data.istask2 == false) {
+    if (!this.data.istask1) {
       wx.showModal({
         showCancel: false,
         content: "请按照任务顺序执行哦!"
       })
       return false
     }
+    if (!this.data.istask) {
+      wx.showModal({
+        showCancel: false,
+        content: "请先去扫描二维码加入班级群吧",
+        success(res) {
+          if (res.confirm) {
+            wx.switchTab({
+              url: '../myMission/myMission'
+            })
+          }
+        }
+      })
+      return false
+    }
     let id = e.currentTarget.dataset.item.id //此课程的id
-    console.log(id)
-    console.log(this.data.IngCourseArr, "我是筛选的列表")
     if (this.data.IngCourseArr.length == 0) {
       if (e.currentTarget.dataset.item.isLive == 1) {
         if (e.currentTarget.dataset.item.isActive == 1) {
@@ -369,29 +381,29 @@ Page({
         })
       }
     } else {
-      if (id == this.data.IngCourseArr.id) {
-        if (e.currentTarget.dataset.item.isLive == 1) {
-          if (e.currentTarget.dataset.item.isActive == 1) {
-            wx.navigateTo({
-              url: '../zbDetails/zbDetails?id=' + id
-            })
-          } else {
-            wx.showModal({
-              showCancel: false,
-              content: "直播还未开始哦"
-            })
-            return false;
-          }
+      if (e.currentTarget.dataset.item.isLive == 1) {
+        if (e.currentTarget.dataset.item.isActive == 1) {
+          wx.navigateTo({
+            url: '../zbDetails/zbDetails?id=' + id
+          })
         } else {
+          wx.showModal({
+            showCancel: false,
+            content: "直播还未开始哦"
+          })
+          return false;
+        }
+      } else {
+        if (id == this.data.IngCourseArr.id) {
           wx.navigateTo({
             url: '../dbDetails/dbDetails?id=' + id
           })
+        } else {
+          wx.showModal({
+            showCancel: false,
+            content: "您的" + this.data.IngCourseArr.courseName + "课还未学完,快去学习吧"
+          })
         }
-      } else {
-        wx.showModal({
-          showCancel: false,
-          content: "您的 ‘" + this.data.IngCourseArr.courseName + "’ 课还未学完,快去学习吧"
-        })
       }
     }
   },

+ 0 - 1
pages/testAnswer/testAnswer.js

@@ -175,7 +175,6 @@ Page({
                 },
                 success: (res1) => {
                   console.log(res1,"打印看看都学完了么");
-                  
                     // 都学完了
                     if(res1.data.allDone){
                       this.setData({

+ 6 - 1
utils/tools.js

@@ -99,8 +99,13 @@ const checkSessionAndLogin = () => {
     }
   );
 };
-
+// const scalarArrayEquals = function (array1, array2) {
+//   return array1.length == array2.length && array1.every(function (v, i) {
+//     return v === array2[i]
+//   });
+// }
 module.exports = {
   request,
   checkSessionAndLogin
+  // scalarArrayEquals
 }

+ 2 - 2
utils/util.js

@@ -1,7 +1,7 @@
 const globalData = {
   // 正式服务器
   publicUrl: 'https://sqdx.jiaxintech.com',
-  publicSocketUrl: 'wss://sqdx.jiaxintech.com'
+  publicSocketUrl: 'wss://sqdx.jiaxintech.com',
   // 测试服务器
   // publicUrl: 'https://sqdx.windd.cn',
   // publicSocketUrl: 'wss://sqdx.windd.cn'
@@ -12,7 +12,7 @@ const globalData = {
   // publicUrl: 'http://10.16.10.139', 
   // publicSocketUrl: 'ws://10.16.10.139'
   //zxq
-  //publicUrl: 'http://10.16.4.26:8090', 
+  // publicUrl: 'http://10.16.4.26:8090', 
 };
 module.exports = {
   globalData: globalData,