12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- const app = require('../../utils/util.js');
- Page({
- data: {
- dataArr: []
- },
- getjj(sessionKey) {
- var _this = this;
- wx.request({
- url: app.globalData.publicUrl2 + '/education/student/wx/selClas',
- method: "post",
- data: {
- sessionKey: sessionKey,
- isActive: "0"
- },
- success: function (res) {
- console.log(res.data.data.length, "我是即将开班的列表")
- _this.setData({
- dataArr: res.data.data
- })
- }
- })
- },
- onLoad: 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);
- _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: function (res) {
- wx.setStorageSync('sessionKey', res.data.sessionKey);
- var sessionKey = res.data.sessionKey
- this.getjj(sessionKey);
- }
- })
- }
- })
- }
- })
- }
- })
|