const app = require('../../utils/util.js'); const tool = require('../../utils/tool.js'); Page({ data: { currentIndex: 0, arr: [], arr1: [], isInfo: false, isTargetInfo: false }, // 轮播 handleChange: function (e) { this.setData({ currentIndex: e.detail.current }) }, // 跳转活动详情页面 goActive(e) { console.log(e) let id = e.currentTarget.dataset.id let openId = e.currentTarget.dataset.openid wx.navigateTo({ url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId, }) }, // 获取活动列表 getActivies() { wx.request({ url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives', method: "get", data: { activeStatus: 0 }, success: (res) => { console.log(res) if (res.data.code == 0) { this.setData({ arr: res.data.actives }) } }, complete(){ wx.hideLoading(); } }) wx.request({ url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives', method: "get", data: { activeStatus: 1 }, success: (res) => { if (res.data.code == 0) { this.setData({ arr1: res.data.actives }) } }, complete(){ wx.hideLoading(); } }) }, goMy() { wx.redirectTo({ url: '/pages/personal/personal', }) }, getIntroduce() { wx.request({ url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/introduce', method: "get", data: { introduce: this.data.introduceId }, success: (res) => { console.log(res, '获取推荐人') } }) }, onLoad(options) { wx.showLoading(); tool.openidStatus().then(result => { this.setData({ openid: result[0], sessionkey: result[1], }) this.getActivies(); if (options.id) { this.setData({ introduceId: options.id }) this.getIntroduce(); } }) }, onShow(){ this.getActivies(); } })