123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- const app = require('../../utils/util.js');
- const tool = require('../../utils/tool.js');
- Page({
- data: {
- currentIndex: 0,
- arr: [],
- arr1: [],
- isInfo: false,
- isTargetInfo: false,
- letterStatus: true,
- lbArr: [{
- src: '../../images/lb2.png'
- },
- // {src:'../../images/lb2.png'},
- // {src:'../../images/lb2.png'}
- ]
- },
- // 轮播
- handleChange: function (e) {
- this.setData({
- currentIndex: e.detail.current
- })
- },
- // 关闭信件
- closeLetter() {
- console.log('1')
- this.setData({
- letterStatus: true
- })
- wx.setStorageSync('letterStatus', true)
- },
- goShare() {
- wx.navigateTo({
- url: '/pages/share/share',
- })
- },
- // 跳转活动详情页面
- goActive(e) {
- if (e.currentTarget.dataset.activestatus != -1) {
- let id = e.currentTarget.dataset.id
- let openId = e.currentTarget.dataset.openid
- wx.navigateTo({
- url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
- })
- } else {
- wx.showModal({
- title: '活动已经结束啦',
- showCancel: false
- });
- }
- },
- goActiveDefault() {
- wx.navigateTo({
- url: '/pages/activeDefaultDetails/activeDefaultDetails',
- })
- },
- // 获取活动列表
- getActivies() {
- wx.request({
- url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
- method: "get",
- success: (res) => {
- console.log(res)
- if (res.data.code == 0) {
- console.log(res.data.actives)
- // let deleteArr = []
- // let primaryArr = []
- // for (let i = 0; i < res.data.actives.length; i++) {
- // if (res.data.actives[i].activeStatus == -1) {
- // deleteArr.push(res.data.actives[i])
- // // res.data.actives.splice(i, 1);
- // }else{
- // primaryArr.push(res.data.actives[i])
- // }
- // }
- // console.log(primaryArr)
- // console.log(deleteArr)
- 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(id) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/introduce',
- method: "get",
- data: {
- introduce: id
- },
- success: (res) => {
- console.log(res, '获取推荐人')
- }
- })
- },
- getletterStauts() {
- console.log(wx.getStorageSync('letterStatus'))
- if (wx.getStorageSync('letterStatus') == true) {
- console.log('我缓存里有值是1')
- this.setData({
- letterStatus: true
- })
- // this.closeLetter();
- } else {
- console.log('我没有缓存、')
- this.setData({
- letterStatus: false
- })
- }
- console.log(this.data.letterStatus)
- },
- onLoad(options) {
- this.getletterStauts();
- wx.showLoading();
- tool.openidStatus().then(result => {
- this.setData({
- openid: result[0],
- sessionkey: result[1],
- })
- this.getActivies();
- if (options.id) {
- this.getIntroduce(options.id);
- }
- })
- },
- onShow() {
- this.getActivies();
- this.getletterStauts();
- }
- })
|