var util = require("../../utils/util.js") const app = getApp() Page({ data: { userInfo: { avatarUrl: 'https://yuesuo.yueguanjia.com/MiniProgram/images/head.png', name: '' }, listData: [], listTab: [{ n: '全部', i: 'all' }, { n: 'LV1', i: 1 }, { n: 'LV2', i: 2 }, { n: 'LV3', i: 3 }, { n: 'LV4', i: 4 }, { n: 'LV5', i: 5 } ], activeTab: 'all', loaddisplay: true, hasLogin: false, }, onLoad: function(options) { this.setData({ navH: app.globalData.navHeight }); this.getPostDataNologin(); }, onShow: function() { const _this = this; wx.checkSession({ success(res) { app.setUserInfo().then(() => { _this.getPostData() }); } }) }, // 获取页面数据 getPostData() { util.postData('/college/queryRedeemIndex', { openid: app.globalData.openid }) .then(res => { console.log(res) if (res.code == '1000000') { app.checkSession(); } else { this.setData({ userInfo: res.userInfo, listData: res.presentInfo }) } }) }, // 没登陆获取页面数据 getPostDataNologin() { const _this = this; util.postData('/college/queryRedeemIndexNoLogin') .then(res => { console.log(res) _this.setData({ listData: res.presentInfo }) }) }, tologin() { app.checkSession() }, // 选择不同的级别 selectTab(event) { // console.log(event) this.setData({ activeTab: event.currentTarget.dataset.id }) }, // 兑换记录 gotoRecord() { app.checkSession().then(res => { wx.navigateTo({ url: '/pages/scholarship/record/record' }) }) }, // 去兑换 exchange(event) { console.log(event) let dataSet = event.currentTarget.dataset wx.navigateTo({ url: '/pages/scholarship/info/info?id=' + dataSet.id }) }, onShareAppMessage: function() {} })