|
@@ -1,77 +1,12 @@
|
|
|
-//index.js
|
|
|
-//获取应用实例
|
|
|
-const app = getApp()
|
|
|
+const app = require('../../utils/util.js');
|
|
|
Page({
|
|
|
data: {
|
|
|
showMore: false, //更多
|
|
|
show: false,
|
|
|
- notice: "通知通知我是通知通知通知我是通知通知通知我是通知通知通知我是通知",
|
|
|
+ SessionKey: "",
|
|
|
+ notice: "",
|
|
|
+ className: '',
|
|
|
kcArr: [],
|
|
|
- // "spxxArr": [{
|
|
|
- // "isfinish": "/images/unfinish.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/zb.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png"
|
|
|
- // }, {
|
|
|
- // "isfinish": "/images/finish.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/db.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png"
|
|
|
- // }, {
|
|
|
- // "isfinish": "/images/unstart.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/db.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // "isfinish": "/images/unstart.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/db.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // "isfinish": "/images/unstart.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/db.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // "isfinish": "/images/unstart.png",
|
|
|
- // "spfm": "/images/spfm.jpg",
|
|
|
- // "iszburl": "/images/db.png",
|
|
|
- // "name": "一期素质教育培训",
|
|
|
- // "startdate": "6月9日",
|
|
|
- // "starttime": "19:30",
|
|
|
- // "isstartstudy": "/images/startstudy.png",
|
|
|
- // "isdtxs": "/images/dtxs.png",
|
|
|
- // "ispjkc": "/images/pjkc.png"
|
|
|
- // }
|
|
|
- // ],
|
|
|
"myactiveArr": [{
|
|
|
"name": "现场体验:长山花园社区",
|
|
|
"cysj": "2020/06/20 07:09",
|
|
@@ -88,9 +23,6 @@ Page({
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- // showPopup() {
|
|
|
-
|
|
|
- // },
|
|
|
// 更多
|
|
|
listToggle: function () {
|
|
|
this.setData({
|
|
@@ -98,20 +30,20 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
hidePopup() {
|
|
|
- this.setData({
|
|
|
+ var _this = this;
|
|
|
+ _this.setData({
|
|
|
show: false
|
|
|
});
|
|
|
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/verification?sessionKey=' + sessionKey,
|
|
|
+ url: app.globalData.publicUrl2 + '/education/student/wx/verification',
|
|
|
method: "post",
|
|
|
- // data:
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey
|
|
|
+ },
|
|
|
success: function (res) {
|
|
|
console.log(res, "我成功了")
|
|
|
}
|
|
@@ -132,6 +64,16 @@ Page({
|
|
|
success: function (res) {
|
|
|
sessionKey = res.data.sessionKey;
|
|
|
wx.setStorageSync('sessionKey', res.data.sessionKey);
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl2 + '/education/student/wx/verification',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res, "我成功了")
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -179,43 +121,150 @@ Page({
|
|
|
url: '../feedBack/feedBack'
|
|
|
})
|
|
|
},
|
|
|
- onReady: function () {},
|
|
|
- onLoad: function () {
|
|
|
- var sessionKey = "";
|
|
|
+ // 跳转直播点播页面
|
|
|
+ goStudy(e){
|
|
|
+ if(e.currentTarget.dataset.item.isLive==1){
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../onlineClass/onlineClass'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../demandCourses/demandCourses'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 我的班级名字
|
|
|
+ getClassName(sessionKey) {
|
|
|
var _this = this;
|
|
|
- wx.checkSession({
|
|
|
- success: () => {
|
|
|
- console.log("我有缓存")
|
|
|
- sessionKey = wx.getStorageSync('sessionKey');
|
|
|
- console.log(sessionKey)
|
|
|
- var enSessionKey = encodeURIComponent(sessionKey)
|
|
|
- console.log(enSessionKey,"woshi zhuanyi")
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey?sessionKey=' + enSessionKey,
|
|
|
- method: "post",
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl2 + '/education/student/wx/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) {
|
|
|
+ var _this = this;
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl2 + '/education/student/wx/selAllClas',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey
|
|
|
+ },
|
|
|
+ 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) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '您还未加入班级',
|
|
|
+ content: '跳转至身份认证',
|
|
|
success: function (res) {
|
|
|
- console.log(res, "333")
|
|
|
- if (res.data.data.isAgree == 0) {
|
|
|
- _this.setData({
|
|
|
- show: true
|
|
|
- });
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '../Identity/Identity'
|
|
|
+ })
|
|
|
} else {
|
|
|
- _this.setData({
|
|
|
- show: false
|
|
|
- });
|
|
|
+ wx.switchTab({
|
|
|
+ url: '../index/index'
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
- }),
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/course/selectBySessionKey/' + sessionKey,
|
|
|
- method: "get",
|
|
|
- success: function (res) {
|
|
|
- console.log(res)
|
|
|
- _this.setData({
|
|
|
- kcArr: res.data.list
|
|
|
- })
|
|
|
- }
|
|
|
})
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ _this.isAgree(sessionKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 协议是否已同意
|
|
|
+ isAgree(sessionKey) {
|
|
|
+ var _this = this;
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res.data, "wwwwww")
|
|
|
+ if (res.data.data) {
|
|
|
+ if (res.data.data.isAgree == 0) {
|
|
|
+ _this.setData({
|
|
|
+ show: true
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ _this.setData({
|
|
|
+ show: false
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 我的通知
|
|
|
+ getMynotice(sessionKey) {
|
|
|
+ var _this = this;
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl3 + '/education/eduNoticeSee/list',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey,
|
|
|
+ isSee: 1,
|
|
|
+ isPublish: 0,
|
|
|
+ isNotice: 0
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res, "333333333")
|
|
|
+ if (res.data)
|
|
|
+ _this.setData({
|
|
|
+ notice: res.data.rows[0].noticeContent
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // // 我的课程
|
|
|
+ getMycourse(sessionKey) {
|
|
|
+ var _this = this;
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/course/selectBySessionKey',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ _this.setData({
|
|
|
+ kcArr: res.data.list
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onLoad: function () {
|
|
|
+ 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("我没有缓存并去登录请求")
|
|
@@ -230,8 +279,13 @@ Page({
|
|
|
code
|
|
|
},
|
|
|
success: function (res) {
|
|
|
- sessionKey = res.data.sessionKey;
|
|
|
wx.setStorageSync('sessionKey', res.data.sessionKey);
|
|
|
+ var sessionKey = res.data.sessionKey;
|
|
|
+ // _this.isClass(sessionKey);
|
|
|
+ _this.isAgree(sessionKey);
|
|
|
+ _this.getClassName(sessionKey);
|
|
|
+
|
|
|
+ _this.getMynotice(sessionKey);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -239,9 +293,38 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // onShow: function () {
|
|
|
- // this.setData({
|
|
|
- // show: true
|
|
|
- // });
|
|
|
- // }
|
|
|
+ onShow(){
|
|
|
+ var _this = this;
|
|
|
+ wx.checkSession({
|
|
|
+ success: () => {
|
|
|
+ console.log("我有缓存")
|
|
|
+ var sessionKey = wx.getStorageSync('sessionKey');
|
|
|
+ console.log(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.isClass(sessionKey);
|
|
|
+ _this.getMycourse(sessionKey);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|