ssfg 5 lat temu
rodzic
commit
b8e641ab88

+ 1 - 6
app.js

@@ -1,8 +1,3 @@
 App({
-  globalData: {
-    publicUrl: 'http://sqdx.windd.cn',
-    publicUrl2: 'http://sqdx.windd.cn',
-    publicUrl3: 'http://sqdx.windd.cn',
-    publicSocketUrl: 'ws://sqdx.windd.cn'
-  }
+  globalData: {}
 })

+ 104 - 130
pages/Identity/Identity.js

@@ -1,96 +1,86 @@
 const app = require('../../utils/util.js');
+import WxValidate from '../../utils/WxValidate';
 Page({
   data: {
     userName: "",
     phone: "",
     card: ""
   },
+  showModal(error) {
+    wx.showModal({
+      content: error.msg,
+      showCancel: false,
+    })
+  },
+  tj(sessionKey, params) {
+    wx.request({
+      url: app.globalData.publicUrl2 + '/wx/student/uthentication',
+      method: "post",
+      data: {
+        studentName: params.userName,
+        studentCard: params.card,
+        phone: params.phone,
+        sessionKey: sessionKey
+      },
+      success: function (res) {
+        if (res.data.code == 0) {
+          wx.showModal({
+            showCancel: false,
+            content: res.data.msg,
+            success(res) {
+              if (res.confirm) {
+                wx.switchTab({
+                  url: '../index/index'
+                })
+              }
+            }
+          })
+        } else {
+          wx.showModal({
+            showCancel: false,
+            content: res.data.msg,
+            success(res) {
+              if (res.confirm) {}
+            }
+          })
+        }
+      }
+    })
+  },
   formSubmit: function (e) {
-    let {
-      userName,
-      phone,
-      card
-    } = e.detail.value;
-    if (userName == "") {
-      wx.showToast({
-        title: '姓名为空,请重新输入',
-        icon: 'none',
-        duration: 1500
-      })
-      return false
-    } else if (phone == "") {
-      wx.showToast({
-        title: '手机号为空,请重新输入',
-        icon: 'none',
-        duration: 1500
-      })
-      return false
-    } else if (card == "") {
-      wx.showToast({
-        title: '身份证号为空,请重新输入',
-        icon: 'none',
-        duration: 1500
-      })
+    const params = e.detail.value
+    let _this = this;
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0]
+      this.showModal(error)
       return false
     }
-    console.log(e.detail.value)
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
-        wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/uthentication',
-          method: "post",
-          data: {
-            studentName: e.detail.value.userName,
-            studentCard: e.detail.value.card,
-            phone: e.detail.value.phone,
-            sessionKey: sessionKey
-          },
-          success: function (res) {
-            if (res.data.code == 0) {
-              wx.showModal({
-                showCancel: false,
-                content: res.data.msg,
-                success(res) {
-                  if (res.confirm) {
-                    wx.switchTab({
-                      url: '../index/index'
-                    })
-                  }
-                }
-              })
-            } else {
-              wx.showModal({
-                showCancel: false,
-                content: res.data.msg,
-                success(res) {
-                  if (res.confirm) {
-                    wx.switchTab({
-                      url: '../index/index'
-                    })
-                  }
+        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);
                 }
               })
             }
-            var msg = res.msg;
-            wx.showModal({
-              showCancel: false,
-              content: msg,
-              success(res) {
-                if (res.confirm) {
-                  wx.switchTab({
-                    url: '../index/index'
-                  })
-                } else if (res.cancel) {
-                  wx.switchTab({
-                    url: '../index/index'
-                  })
-                }
-              }
-            })
-          }
-        })
+          })
+        } else {
+          _this.tj(sessionKey, params);
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -107,59 +97,7 @@ Page({
               success: function (res) {
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey;
-                wx.request({
-                  url: app.globalData.publicUrl2 + '/education/student/wx/uthentication',
-                  method: "post",
-                  data: {
-                    studentName: e.detail.value.userName,
-                    studentCard: e.detail.value.card,
-                    phone: e.detail.value.phone,
-                    sessionKey: sessionKey
-                  },
-                  success: function (res) {
-                    if (res.code == 0) {
-                      wx.showModal({
-                        showCancel: false,
-                        content: "认证成功",
-                        success(res) {
-                          if (res.confirm) {
-                            wx.switchTab({
-                              url: '../index/index'
-                            })
-                          }
-                        }
-                      })
-                    } else {
-                      wx.showModal({
-                        showCancel: false,
-                        content: "认证失败",
-                        success(res) {
-                          if (res.confirm) {
-                            wx.switchTab({
-                              url: '../index/index'
-                            })
-                          }
-                        }
-                      })
-                    }
-                    var msg = res.msg;
-                    wx.showModal({
-                      showCancel: false,
-                      content: msg,
-                      success(res) {
-                        if (res.confirm) {
-                          wx.switchTab({
-                            url: '../index/index'
-                          })
-                        } else if (res.cancel) {
-                          wx.switchTab({
-                            url: '../index/index'
-                          })
-                        }
-                      }
-                    })
-                  }
-                })
+                _this.tj(sessionKey, params);
               }
             })
           }
@@ -167,5 +105,41 @@ Page({
       }
     })
   },
-  onLoad: function () {}
+  onLoad: function () {
+    this.initValidate();
+  },
+  initValidate() {
+    // 验证字段的规则
+    const rules = {
+      userName: {
+        required: true
+      },
+      phone: {
+        required: true,
+        tel: true,
+      },
+      card: {
+        required: true,
+        idcard: true,
+      }
+    }
+
+    // 验证字段的提示信息,若不传则调用默认的信息
+    const messages = {
+      userName: {
+        required: '请输入姓名'
+      },
+      phone: {
+        required: '请输入手机号',
+        tel: '请输入正确的手机号',
+      },
+      card: {
+        required: '请输入身份证号码',
+        idcard: '请输入正确的身份证号码',
+      }
+    }
+
+    // 创建实例对象
+    this.WxValidate = new WxValidate(rules, messages)
+  }
 })

+ 23 - 2
pages/agoClass/agoClass.js

@@ -27,7 +27,28 @@ Page({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
-        this.getjj(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("我没有缓存并去登录请求")
@@ -44,7 +65,7 @@ Page({
               success: function (res) {
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey
-                this.getjj(sessionKey);
+                _this.getjj(sessionKey);
               }
             })
           }

+ 22 - 21
pages/dbDetails/dbDetails.js

@@ -36,26 +36,6 @@ Page({
       }
     })
   },
-  // onLoad: function (options) {
-  //   let _this = this
-  //   _this.setData({
-  //     id: options.id
-  //   })
-  //   wx.request({
-  //     method: "get",
-  //     url: app.globalData.publicUrl + '/wx/course/selectRecordByCourseId/S6vZqa6S6Fzyomehw==/' + _this.data.id,
-  //     success: (e) => {
-  //       // console.log(e,"11111111111111111")
-  //       this.setData({
-  //         url: e.data.url,
-  //         show: false,
-  //         title:e.data.course.courseInfo,
-  //         message: e.data.course.courseName,
-  //         playTimes: e.data.course.playTimes
-  //       })
-  //     }
-  //   })
-  // },
   onLoad: function (options) {
     var _this = this;
     _this.setData({
@@ -65,7 +45,28 @@ Page({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
-        _this.getdbArr(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);
+                }
+              })
+            }
+          })
+        } else {
+          _this.getdbArr(sessionKey);
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")

+ 0 - 4
pages/dbVideo/dbVideo.js

@@ -9,10 +9,6 @@ Page({
     playTimes:0,
     id: 0
   },
-  // videoErrorCallback: function (e) {
-  //   console.log('视频错误信息:')
-  //   console.log(e.detail.errMsg)
-  // },
   onReady: function () {},
   onLoad: function (options) {
     let _this = this

+ 22 - 1
pages/demandCourses/demandCourses.js

@@ -31,7 +31,28 @@ Page({
     wx.checkSession({
       success: () => {
         sessionKey = wx.getStorageSync('sessionKey');
-        _this.getArr(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("我没有缓存并去登录请求")

+ 1 - 16
pages/exhibitionList/exhibitionList.js

@@ -4,22 +4,7 @@ const app = require('../../utils/util.js');
 Page({
   data: {
     active: 0,
-    xcpArr: [],
-    // mtbdArr: [{
-    //   "courseImg": "",
-    //   "courseName": "",
-    //   "playTimes": ""
-    // }],
-    // zthdArr: [{
-    //   "courseImg": "",
-    //   "courseName": "",
-    //   "playTimes": ""
-    // }],
-    // tskcArr: [{
-    //   "courseImg": "",
-    //   "courseName": "",
-    //   "playTimes": ""
-    // }]
+    xcpArr: []
   },
   checkboxChange() {
 

+ 47 - 17
pages/index/index.js

@@ -21,21 +21,52 @@ Page({
     }],
     xczsArr: []
   },
-  gomyClass() {
-    wx.switchTab({
-      url: '/pages/myClass/myClass',
-    })
+  gomyClass(e) {
+    console.log(e.currentTarget.dataset.item.isActive, "我是测试跳转的")
+    if (e.currentTarget.dataset.item.isActive == 5) {
+      wx.switchTab({
+        url: '/pages/myClass/myClass',
+      })
+    }
   },
   // 即将开班
-  gostartClass() {
-    wx.navigateTo({
-      url: '/pages/startClass/startClass',
-    })
+  gostartClass(e) {
+    if (e.currentTarget.dataset.item !== 0) {
+      wx.navigateTo({
+        url: '/pages/startClass/startClass',
+      })
+    } else {
+      wx.showModal({
+        showCancel: false,
+        content: "您还没有即将开班哦",
+        success(res) {
+          if (res.confirm) {
+            wx.switchTab({
+              url: '../index/index'
+            })
+          }
+        }
+      })
+    }
   },
-  goagoClass() {
-    wx.navigateTo({
-      url: '/pages/agoClass/agoClass',
-    })
+  goagoClass(e) {
+    if (e.currentTarget.dataset.item !== 0) {
+      wx.navigateTo({
+        url: '/pages/agoClass/agoClass',
+      })
+    } else {
+      wx.showModal({
+        showCancel: false,
+        content: "您还没有往期开班哦",
+        success(res) {
+          if (res.confirm) {
+            wx.switchTab({
+              url: '../index/index'
+            })
+          }
+        }
+      })
+    }
   },
   // 宣传展示查看更多
   xczsMore() {
@@ -75,7 +106,7 @@ Page({
   getBanner(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -91,7 +122,7 @@ Page({
   getjjLength(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selClas',
       method: "post",
       data: {
         sessionKey: sessionKey,
@@ -110,7 +141,7 @@ Page({
   getwqLength(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selClas',
       method: "post",
       data: {
         sessionKey: sessionKey,
@@ -144,9 +175,8 @@ Page({
     })
   },
   onReady: function () {},
-  onLoad: function () {
+  onShow: function () {
     var _this = this;
-    // if (app.globalData.testData && app.globalData.testData != '') {}
     wx.checkSession({
       success: () => {
         console.log("我有缓存")

+ 4 - 4
pages/index/index.wxml

@@ -2,23 +2,23 @@
 	<view class="banner">
 		<swiper class='u-wrp-bnr' indicator-dots="true" interval='5000' duration='1000'>
 			<block wx:for="{{bnrUrl}}" wx:for-index="index" wx:key="idx">
-				<swiper-item>
+				<swiper-item  bindtap="gomyClass" data-item="{{item}}">
 					<image src='{{item.clasImg}}' class='u-img-slide' mode='aspectFill'></image>
 					<view class="text text1">{{item.clasName}}</view>
 					<view class="text text2">主办方:{{item.remark}}</view>
 					<view class="text text3">开班时间:{{item.clasBegin}}</view>
-					<image src='/images/goclass.png' mode='aspectFill' class="text gozbbtn"  bindtap="gomyClass" wx:if='{{item.isActive==5}}'></image>
+					<image src='/images/goclass.png' mode='aspectFill' class="text gozbbtn" wx:if='{{item.isActive==5}}'></image>
 				</swiper-item>
 			</block>
 		</swiper>
 	</view>
 	<view class="sec">
-		<view class="sec_item" bindtap="gostartClass">
+		<view class="sec_item" bindtap="gostartClass" data-item='{{jjdataArr}}'>
 			<image src="/images/jjkb.png" mode='aspectFill' class="secimg"></image>
 			<view class="text4">即将开班</view>
 			<view class="text5">即将开班:{{jjdataArr}}个</view>
 		</view>
-		<view class="sec_item1" bindtap="goagoClass">
+		<view class="sec_item1" bindtap="goagoClass" data-item='{{wqdataArr}}'>
 			<image src="/images/wqpx.png" mode='aspectFill' class="secimg"></image>
 			<view class="text4">往期开班</view>
 			<view class="text5">往期开班:{{wqdataArr}}个</view>

+ 45 - 55
pages/myClass/myClass.js

@@ -39,7 +39,7 @@ Page({
       success: () => {
         sessionKey = wx.getStorageSync('sessionKey');
         wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/verification',
+          url: app.globalData.publicUrl2 + '/wx/student/verification',
           method: "post",
           data: {
             sessionKey: sessionKey
@@ -65,7 +65,7 @@ Page({
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 wx.request({
-                  url: app.globalData.publicUrl2 + '/education/student/wx/verification',
+                  url: app.globalData.publicUrl2 + '/wx/student/verification',
                   method: "post",
                   data: {
                     sessionKey: sessionKey
@@ -122,23 +122,24 @@ Page({
     })
   },
   // 跳转直播点播页面
-  goStudy(e){
-    if(e.currentTarget.dataset.item.isLive==1){
+  goStudy(e) {
+    // console.log(e.currentTarget.dataset.item.id)
+    let id = e.currentTarget.dataset.item.id
+    if (e.currentTarget.dataset.item.isLive == 1) {
       wx.navigateTo({
-        url: '../onlineClass/onlineClass'
+        url: '../zbDetails/zbDetails?id=' + id
       })
-    }else{
+    } else {
       wx.navigateTo({
-        url: '../demandCourses/demandCourses'
+        url: '../dbDetails/dbDetails?id=' + id
       })
     }
-   
   },
   // 我的班级名字
   getClassName(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -159,7 +160,7 @@ Page({
   isClass(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -195,7 +196,7 @@ Page({
   isAgree(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey',
+      url: app.globalData.publicUrl2 + '/wx/student/selStudentSessionKey',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -220,7 +221,7 @@ Page({
   getMynotice(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl3 + '/education/eduNoticeSee/list',
+      url: app.globalData.publicUrl3 + '/wx/eduNoticeSee/list',
       method: "post",
       data: {
         sessionKey: sessionKey,
@@ -232,7 +233,7 @@ Page({
         console.log(res, "333333333")
         if (res.data)
           _this.setData({
-            notice: res.data.rows[0].noticeContent
+            notice: res.data.list[0].noticeContent
           });
       }
     })
@@ -254,54 +255,41 @@ Page({
       }
     })
   },
-  onLoad: function () {
+  onShow() {
     var _this = this;
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey, "我有缓存")
-        // _this.isClass(sessionKey);
-        _this.isAgree(sessionKey);
-        _this.getClassName(sessionKey);
-        _this.getMynotice(sessionKey);
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        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.isAgree(sessionKey);
-                _this.getClassName(sessionKey);
-               
-                _this.getMynotice(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
-  },
-  onShow(){
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        console.log(sessionKey, "我有缓存")
-        _this.isClass(sessionKey);
-        _this.getMycourse(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("我没有缓存并去登录请求")
@@ -320,6 +308,8 @@ Page({
                 var sessionKey = res.data.sessionKey;
                 _this.isClass(sessionKey);
                 _this.getMycourse(sessionKey);
+                _this.getClassName(sessionKey);
+                _this.getMynotice(sessionKey);
               }
             })
           }

+ 1 - 1
pages/myClass/myClass.wxml

@@ -40,7 +40,7 @@
 				</view>
 			</view>
 		</view>
-		<block wx:if="{{spxxArr.length>3}}">
+		<block wx:if="{{kcArr.length>3}}">
 			<view wx:if="{{showMore}}" class='openall' bindtap='listToggle'>
 				收起
 				<van-icon name="arrow-up" />

+ 53 - 60
pages/myInteractions/myInteractions.js

@@ -37,20 +37,52 @@ Page({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
-        wx.request({
-          url: app.globalData.publicUrl3 + '/education/board/list',
-          method: "post",
-          data: {
-            sessionKey: sessionKey
-          },
-          success: function (res) {
-            console.log(res.data.rows, "我是查到的列表")
-            _this.setData({
-              listArr: res.data.rows
-            })
-
-          }
-        })
+        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.data.list, "我是查到的列表")
+                      _this.setData({
+                        listArr: res.data.list
+                      })
+                    }
+                  })
+                }
+              })
+            }
+          })
+        } else {
+          wx.request({
+            url: app.globalData.publicUrl3 + '/wx/board/list',
+            method: "post",
+            data: {
+              sessionKey: sessionKey
+            },
+            success: function (res) {
+              console.log(res.data.list, "我是查到的列表")
+              _this.setData({
+                listArr: res.data.list
+              })
+            }
+          })
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -68,13 +100,16 @@ Page({
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey;
                 wx.request({
-                  url: app.globalData.publicUrl3 + '/education/board/list',
+                  url: app.globalData.publicUrl3 + '/wx/board/list',
                   method: "post",
                   data: {
                     sessionKey: sessionKey
                   },
                   success: function (res) {
-                    console.log(res, "我是查到的列表")
+                    console.log(res.data.list, "我是查到的列表")
+                    _this.setData({
+                      listArr: res.data.list
+                    })
                   }
                 })
               }
@@ -108,7 +143,7 @@ Page({
           return false;
         } else {
           wx.request({
-            url: app.globalData.publicUrl3 + '/education/board/add',
+            url: app.globalData.publicUrl3 + '/wx/board/add',
             method: "post",
             data: {
               content: input_val,
@@ -136,7 +171,7 @@ Page({
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey;
                 wx.request({
-                  url: app.globalData.publicUrl3 + '/education/board/add',
+                  url: app.globalData.publicUrl3 + '/wx/board/add',
                   method: "post",
                   data: {
                     content: input_val,
@@ -154,48 +189,6 @@ Page({
     })
     // console.log(e.detail.value.textarea)
   },
-  // 提交我的问题
-  // submit() {
-  //   var _this = this;
-  //   console.log(_this.data.mytip)
-  //   wx.checkSession({
-  //     success: () => {
-  //       console.log("我有缓存")
-  //       var sessionKey = wx.getStorageSync('sessionKey');
-  //       wx.request({
-  //         url: app.globalData.publicUrl3 + '/education/board/add',
-  //         method: "post",
-  //         data: {
-  //           content: _this.data.mytip
-  //         },
-  //         success: function (res) {
-  //           console.log(res)
-  //         }
-  //       })
-  //     },
-  //     fail() {
-  //       console.log("我没有缓存并去登录请求")
-  //       wx.login({
-  //         success(res) {
-  //           console.log(res);
-  //           var code = res.code
-  //           wx.request({
-  //             url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-  //             method: "get",
-  //             data: {
-  //               code
-  //             },
-  //             success: function (res) {
-  //               wx.setStorageSync('sessionKey', res.data.sessionKey);
-  //               var sessionKey = res.data.sessionKey
-
-  //             }
-  //           })
-  //         }
-  //       })
-  //     }
-  //   })
-  // },
   onLoad: function (options) {
 
   },

+ 5 - 4
pages/myInteractionsDetais/myInteractionsDetais.js

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

+ 82 - 41
pages/myMission/myMission.js

@@ -1,4 +1,3 @@
-// pages/learningReport/learningReport.js
 const app = require('../../utils/util.js');
 Page({
 
@@ -75,7 +74,7 @@ Page({
   isClass(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selAllClas',
       method: "post",
       data: {
         sessionKey: sessionKey
@@ -101,45 +100,62 @@ Page({
             }
           })
           return false;
-        } else {
-          _this.isAgree(sessionKey);
         }
       }
     })
   },
-  onLoad: function () {
-    var _this = this;
-    wx.checkSession({
-      success: () => {
-        console.log("我有缓存")
-        var sessionKey = wx.getStorageSync('sessionKey');
-        _this.getMycourse(sessionKey);
-        // _this.isClass(sessionKey);
-      },
-      fail() {
-        console.log("我没有缓存并去登录请求")
-        wx.login({
-          success(res) {
-            console.log(res);
-            var code = res.code
-            wx.request({
-              url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-              method: "get",
-              data: {
-                code
-              },
-              success: function (res) {
-                wx.setStorageSync('sessionKey', res.data.sessionKey);
-                var sessionKey = res.data.sessionKey;
-                _this.getMycourse(sessionKey);
-                // _this.isClass(sessionKey);
-              }
-            })
-          }
-        })
-      }
-    })
-  },
+  // onShow: function () {
+  //   var _this = this;
+  //   wx.checkSession({
+  //     success: () => {
+  //       console.log("我有缓存")
+  //       var sessionKey = wx.getStorageSync('sessionKey');
+  //       if (sessionKey == "") {
+  //         wx.login({
+  //           success(res) {
+  //             console.log(res);
+  //             var code = res.code
+  //             wx.request({
+  //               url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
+  //               method: "get",
+  //               data: {
+  //                 code
+  //               },
+  //               success: function (res) {
+  //                 sessionKey = res.data.sessionKey;
+  //                 wx.setStorageSync('sessionKey', res.data.sessionKey);
+
+  //               }
+  //             })
+  //           }
+  //         })
+  //       } else {
+  //         _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.getMycourse(sessionKey);
+  //             }
+  //           })
+  //         }
+  //       })
+  //     }
+  //   })
+  // },
   showEwm() {
     var sessionKey = "";
     var _this = this;
@@ -149,7 +165,7 @@ Page({
         sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey)
         wx.request({
-          url: app.globalData.publicUrl2 + '/education/student/wx/wxGroup',
+          url: app.globalData.publicUrl2 + '/wx/student/wxGroup',
           method: "post",
           data: {
             sessionKey: sessionKey
@@ -178,7 +194,7 @@ Page({
                 sessionKey = res.data.sessionKey;
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 wx.request({
-                  url: app.globalData.publicUrl2 + '/education/student/wx/wxGroup',
+                  url: app.globalData.publicUrl2 + '/wx/student/wxGroup',
                   method: "post",
                   data: {
                     sessionKey: sessionKey
@@ -202,14 +218,38 @@ Page({
   },
   // showzs(){
   // },
-  onShow(){
+  onShow() {
     var _this = this;
     wx.checkSession({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey, "我有缓存")
-        _this.isClass(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.getMycourse(sessionKey);
+                }
+              })
+            }
+          })
+        } else {
+          _this.isClass(sessionKey);
+          _this.getMycourse(sessionKey);
+        }
       },
       fail() {
         console.log("我没有缓存并去登录请求")
@@ -227,6 +267,7 @@ Page({
                 wx.setStorageSync('sessionKey', res.data.sessionKey);
                 var sessionKey = res.data.sessionKey;
                 _this.isClass(sessionKey);
+                _this.getMycourse(sessionKey);
               }
             })
           }

+ 23 - 45
pages/myTraining/myTraining.js

@@ -13,7 +13,7 @@ Page({
   getArr(sessionKey) {
     var _this = this;
     wx.request({
-      url: app.globalData.publicUrl2 + '/education/student/wx/selWholeClas',
+      url: app.globalData.publicUrl2 + '/wx/student/selWholeClas',
       method: "post",
       data:{
         sessionKey:sessionKey
@@ -31,7 +31,29 @@ Page({
     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("我没有缓存并去登录请求")
@@ -55,48 +77,4 @@ Page({
       }
     })
   }
-  // onLoad: function () {
-  //   var sessionKey = "";
-  //   var _this = this;
-  //   wx.checkSession({
-  //     success: () => {
-  //       console.log("我有缓存")
-  //       sessionKey = wx.getStorageSync('sessionKey');
-  //       console.log(sessionKey)
-  //       wx.request({
-  //         url: app.globalData.publicUrl2 + '/education/student/wx/selWholeClas?sessionKey=' + sessionKey,
-  //         method: "post",
-  //         success: function (res) {
-  //           console.log(res.data.data,"22222")
-  //           _this.setData({
-  //             dataArr: res.data.data
-  //           })
-  //           // if(dataArr){
-
-  //           // }
-  //         }
-  //       })
-  //     },
-  //     fail() {
-  //       console.log("我没有缓存并去登录请求")
-  //       wx.login({
-  //         success(res) {
-  //           console.log(res);
-  //           var code = res.code
-  //           wx.request({
-  //             url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-  //             method: "get",
-  //             data: {
-  //               code
-  //             },
-  //             success: function (res) {
-  //               sessionKey = res.data.sessionKey;
-  //               wx.setStorageSync('sessionKey', res.data.sessionKey);
-  //             }
-  //           })
-  //         }
-  //       })
-  //     }
-  //   })
-  // }
 })

+ 3 - 2
pages/onlineClass/onlineClass.wxml

@@ -8,9 +8,10 @@
 			</view>
 			<image src='{{item.courseImg}}' mode='aspectFill' class="spbj"></image>
 			<view class="text1">{{item.courseName}}</view>
-			<view class="text2">
+			<view class="text2">开始时间:{{item.courseStart}}</view>
+			<!-- <view class="text2">
 				<image src='../../images/onlinenum.png' mode='aspectFill' class="onlinenumicon"></image>{{item.playTimes}}人在线观看
-			</view>
+			</view> -->
 			<view class="text3">{{item.courseInfo}}</view>
 			<button class="{{item.videoId==null?'getinroom':'nogetinroom'}}" bindtap="goIn" data-item="{{item}}" class="getinroom">进入课堂</button>
 		</view>

+ 0 - 20
pages/personInfo/personInfo.js

@@ -23,26 +23,6 @@ Page({
       url: '/pages/myInteractions/myInteractions',
     })
   },
-  // getPhoneNumber: function (e) {
-  //   var that = this;
-  //   console.log(e)
-  //   console.log(e.detail.errMsg == "getPhoneNumber:ok");
-  //   if (e.detail.errMsg == "getPhoneNumber:ok") {
-  //     wx.request({
-  //       url: 'http://localhost/index/users/decodePhone',
-  //       data: {
-  //         encryptedData: e.detail.encryptedData,
-  //         iv: e.detail.iv,
-  //         sessionKey: that.data.session_key,
-  //         uid: "",
-  //       },
-  //       method: "post",
-  //       success: function (res) {
-  //         console.log(res);
-  //       }
-  //     })
-  //   }
-  // },
   onLoad: function () {
  
   }

+ 2 - 2
pages/personInfo/personInfo.wxml

@@ -40,7 +40,7 @@
 					<view class='big-title'>后期跟踪</view>
 				</view>
 			</view>
-			<view class="content">
+			<view class="content" bindtap="toIdentity">
 				<view>
 					<van-image fit="cover" width="76rpx" height="76rpx" src="/images/person5.png" />
 				</view>
@@ -49,7 +49,7 @@
 				</button> -->
 				<!-- <view><button class='big-title' open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">身份认证
 				</button></view> -->
-					<view class='big-title' bindtap="toIdentity">身份认证</view>
+					<view class='big-title' >身份认证</view>
 				</view>
 			</view>
 		</view> 

+ 23 - 1
pages/startClass/startClass.js

@@ -26,7 +26,29 @@ Page({
       success: () => {
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
-        this.getjj(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("我没有缓存并去登录请求")

+ 54 - 8
pages/zbDetails/zbDetails.js

@@ -8,13 +8,26 @@ Page({
     message: '',
     playTimes: 0,
     id: 0,
-    socketOpen: false
+    socketOpen: false,
+    chatContent: [],
+    myWrite: ''
   },
   // videoErrorCallback: function (e) {
   //   console.log('视频错误信息:')
   //   console.log(e.detail.errMsg)
   // },
   onReady: function () {},
+  hands() {
+    this.sendSocketMessage("put up hands")
+  },
+  // console.log(this.data.myWrite)
+  // this.sendSocketMessage(this.data.myWrite)
+  // this.sendSocketMessage(this.data.myWrite)
+  bindFormSubmit: function (e) {
+    var _this = this;
+    var input_val = e.detail.value.textarea;
+    _this.sendSocketMessage(input_val)
+  },
   getZbArr(sessionKey) {
     var _this = this;
     wx.request({
@@ -37,27 +50,37 @@ Page({
   },
   socketConnect(sessionKey) {
     var _this = this;
+    var newSessionkey = encodeURIComponent(sessionKey);
     wx.connectSocket({
-      url: app.globalData.publicSocketUrl+'/live/socket/' + sessionKey + '/' + _this.data.id
+      url: app.globalData.publicSocketUrl + '/live/socket?sessionkey=' + newSessionkey + "&courseId=" + _this.data.id
       // header:{
       //   'content-type': 'application/json'
       // },
       // protocols: ['protocol1']
     })
     wx.onSocketOpen(function () {
-      // console.log("我连上啦")
+      console.log("我连上啦")
       _this.setData({
         socketOpen: true
       })
-      _this.sendSocketMessage("hsdushh");
+      // _this.sendSocketMessage(hsdushh);
     })
     wx.onSocketError(function () {
       console.log("我连接出错了")
     })
     wx.onSocketMessage(function (data) {
-      console.log(data, "我收到消息了")
+      let res = JSON.parse(data.data);
+      _this.setData({
+        chatContent: _this.data.chatContent.concat(res.msg)
+      })
+      // _this.setData({
+      //   chatContent: res.msg
+      // })
+      // if (res.messageType == "system") {
+
+      //   // this.data.chatContent = data.data.msg
+      // }
     })
-    // var socketMsgQueue=[];
   },
   sendSocketMessage(msg) {
     if (this.data.socketOpen) {
@@ -83,8 +106,31 @@ Page({
         console.log("我有缓存")
         var sessionKey = wx.getStorageSync('sessionKey');
         console.log(sessionKey)
-        _this.getZbArr(sessionKey);
-        _this.socketConnect(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.getZbArr(sessionKey);
+                  _this.socketConnect(sessionKey);
+                }
+              })
+            }
+          })
+        } else {
+          _this.getZbArr(sessionKey);
+          _this.socketConnect(sessionKey);
+        }
+
       },
       fail() {
         console.log("我没有缓存并去登录请求")

+ 1 - 1
pages/zbDetails/zbDetails.json

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

+ 11 - 2
pages/zbDetails/zbDetails.wxml

@@ -1,10 +1,19 @@
 <view class="home">
-	<live-player src="{{url}}" mode="live" autoplay bindstatechange="statechange" binderror="error" style="width:100%"/>
+	<live-player src="{{url}}" mode="live" autoplay bindstatechange="statechange" binderror="error" style="width:100%" />
 	<view class="text_box">
 		<view class="title">{{title}}</view>
-		<view class="bfnum">{{playTimes}}次播放</view>
+		<!-- <view class="bfnum">{{playTimes}}次播放</view> -->
 		<!-- <view class="zj">主讲:授课教师</view> -->
 		<view class="zw">{{message}}
 		</view>
 	</view>
+	<button bindtap="hands">举手</button>
+	<!-- <button bindtap="mySend">发送</button>
+	<textarea style="width:400rpx;height:200rpx;border:1px solid red" value="{{myWrite}}" name="textarea" placeholder="XXX" auto-focus maxlength="-1"></textarea> -->
+	<form bindsubmit="bindFormSubmit">
+			<textarea value="{{mytip}}" name="textarea" placeholder="我要说话啦!!!" auto-focus maxlength="-1" style="height:700rpx" />
+			<button form-type="submit" type="button" class="submit_btn"> 提交 </button>
+    </form>
+	<view style="border:1px solid red;color:#000" wx:for="{{chatContent}}" wx:for-index="idx" wx:for-item="item" wx:key="idx">
+		{{item}}</view>
 </view>

+ 1 - 1
project.config.json

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

+ 5 - 35
utils/util.js

@@ -2,42 +2,12 @@ const globalData = {
   publicUrl: 'https://sqdx.windd.cn',
   publicUrl2: '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',
+  // publicUrl: 'http://10.16.10.139:8090', //luyu
+  // publicUrl2: 'http://10.16.4.19:8090', //huyubo
+  // publicUrl3: 'http://10.16.9.28:8090', //zxq
 };
-// const app = getApp();
-// var filters = {
-//   getSessionKey: function () {
-//     var sessionKey = "";
-//     var _this = this;
-//     wx.checkSession({
-//       success: () => {
-//         sessionKey = wx.getStorageSync('sessionKey');
-//         return sessionKey
-//       },
-//       fail() {
-//         console.log("我没有缓存并去登录请求")
-//         wx.login({
-//           success(res) {
-//             console.log(res);
-//             var code = res.code
-//             wx.request({
-//               url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
-//               method: "get",
-//               data: {
-//                 code
-//               },
-//               success: function (res) {
-//                 sessionKey = res.data.sessionKey;
-//                 wx.setStorageSync('sessionKey', res.data.sessionKey);
-//                 return sessionKey;
-//               }
-//             })
-//           }
-//         })
-//       }
-//     })
-//   }
-// }
 module.exports = {
   globalData: globalData
 }