let app = getApp(); const getReq = require('./../../config.js').getReq; Page({ data: { tabs: [], special_datas: {}, summery: [] }, onShow: function() { if (app.globalData.backLogin) { app.globalData.backLogin = false; wx.reLaunch({ url: "/pages/index/index" }); } }, onLoad: function () { this.req_tabs(); }, req_tabs(){ let self = this getReq({ act: 'index', op: 'tabs' }, function (res) { if (res.code == 200) { self.getDatas(res.datas.tabs[0].special_id); self.setData({ tabs: res.datas.tabs }); } }) }, onMyEvent: function (e) { this.setData({ special_datas: {}, summery: [] }); this.getDatas(e.detail.item.special_id) }, getDatas(special_id) { wx.showLoading({ title: '加载中' }); let self = this; getReq({ act: 'special', op: 'index', special_id, page: 10, curpage: 1 }, function (res) { console.log(res); if (res.code == 200) { self.setData({ special_datas: res.datas, summery: res.datas.summary }); } setTimeout(function () { wx.hideLoading() }, 1000) }) } })