//logs.js // const util = require('../../utils/util.js') const app = getApp() Page({ data: { dataArr:[ // { // "url": "/images/sc_img.png", // "name": "长春市社区工作者线上培训班", // "zbdw": "宽城区委组织部", // "status": "已结束" // },{ // "url": "/images/sc_img.png", // "name": "长春市专职党务工作者线上培训班", // "zbdw": "长春市委组织部", // "status": "已结束" // },{ // "url": "/images/sc_img.png", // "name": "区域党建联盟", // "zbdw": "宽城区委组织部", // "status": "已结束" // },{ // "url": "/images/sc_img.png", // "name": "小区党组织建设", // "zbdw": "宽城区委组织部", // "status": "已结束" // } ] }, gomyClass(){ wx.switchTab({ url: '../myClass/myClass' }) }, 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); } }) } }) } }) } })