123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- const tools = require('../../utils/tools.js');
- const app = require('../../utils/util.js');
- Page({
- data: {
- dataArr: []
- },
- getjj(sessionKey) {
- // var _this = this;
- wx.request({
- url: app.globalData.publicUrl2 + '/wx/student/selClasToo',
- method: "post",
- data: {
- sessionKey: sessionKey,
- isActive: "2"
- },
- success: (res) => {
- console.log(res.data.data.length, "我是往期开班的列表")
- this.setData({
- dataArr: res.data.data
- })
- }
- })
- },
- async onLoad() {
- // // 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: (res) => {
- // sessionKey = res.data.sessionKey;
- // wx.setStorageSync('sessionKey', res.data.sessionKey);
- // this.getjj(sessionKey);
- // }
- // })
- // }
- // })
- // } else {
- // this.getjj(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: (res) => {
- // wx.setStorageSync('sessionKey', res.data.sessionKey);
- // let sessionKey = res.data.sessionKey
- // this.getjj(sessionKey);
- // }
- // })
- // }
- // })
- // }
- // })
- const sessionKey = await tools.checkSessionAndLogin();
- this.getjj(sessionKey);
- }
- })
|