12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- const tools = require('../../utils/tools.js');
- const app = require('../../utils/util.js');
- Page({
- data: {
- dataArr: [],
- showNull: false
- },
- goClass(e) {
- let id = e.currentTarget.dataset.item.id
- let name = e.currentTarget.dataset.item.clasName
- let clasEnd = e.currentTarget.dataset.item.clasEnd
- if (e.currentTarget.dataset.item.isActive == 0) {
- wx.showModal({
- showCancel: false,
- content: "还未到开班时间哦"
- })
- }
- if (e.currentTarget.dataset.item.isActive == 1) {
- wx.switchTab({
- url: '../myClass/myClass'
- })
- }
- if (e.currentTarget.dataset.item.isActive == 2) {
- wx.navigateTo({
- url: '../historyClass/historyClass?id=' + id + '&&name=' + name + '&&clasEnd=' + clasEnd
- })
- }
- },
- getArr(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/selWholeClas',
- method: "post",
- data: {
- sessionKey: sessionKey
- },
- success: (res) => {
- if (res.data.code == 0) {
- this.setData({
- dataArr: res.data.data
- })
- if (this.data.dataArr.length == 0) {
- this.setData({
- showNull: true
- })
- }
- } else {
- if (this.data.dataArr.length == 0) {
- this.setData({
- showNull: true
- })
- }
- }
- },
- fail: () => {
- if (this.data.dataArr.length == 0) {
- this.setData({
- showNull: true
- })
- }
- }
- })
- },
- async onLoad() {
- const sessionKey = await tools.checkSessionAndLogin();
- this.getArr(sessionKey);
- }
- })
|