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.jpg' }], userInfo: '', ysf: { title: '注册页', config: '' } }, // 轮播 handleChange: function (e) { this.setData({ currentIndex: e.detail.current }) }, // 关闭信件 closeLetter() { 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.showLoading(); wx.request({ url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives', method: "get", success: (res) => { if (res.data.code == 0) { this.setData({ arr: res.data.actives }) } }, complete() { wx.hideLoading(); } }) }, goInfo() { wx.redirectTo({ url: '/pages/personInfo/personInfo', }) }, 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() { if (wx.getStorageSync('letterStatus') == true) { this.setData({ letterStatus: true }) } else { this.setData({ letterStatus: false }) } }, // 获取个人信息用于客服所需参数 getInfos() { wx.request({ url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info', method: "get", success: (res) => { if (res.data.code == 0) { let config = 'ysf.config'; let sex1 = ''; if (res.data.info.sex == 0) { sex1 = '女' } else { sex1 = '男' } this.setData({ myInfo: res.data.info, [config]: JSON.stringify({ "uid": res.data.id, // 用户唯一标识 "level": 1, // vip等级 "data": JSON.stringify([{ "index": 0, "key": "name", "label": "姓名", "value": res.data.info.name }, { "index": 1, "key": "createTime", "label": "创建时间", "value": res.data.info.createTime }, { "index": 2, "key": "sex", "label": "性别", "value": sex1 }, { "index": 3, "key": "tel", "label": "电话", "value": res.data.info.tel } ]) }) }) } } }) }, onLoad(options) { tool.openidStatus().then(result => { this.setData({ openid: result[0], sessionkey: result[1], }) this.getActivies(); this.getInfos() }) if (options.id) { this.getIntroduce(options.id); } }, onShow() { // 获取信件 this.getletterStauts(); this.getInfos() this.getActivies(); wx.getSetting({ success: res => { console.log(res) if (res.authSetting['scope.userInfo']) { wx.getUserInfo({ success: res => { console.log(res) this.setData({ userInfo:JSON.parse(res.rawData) }) console.log(this.data.userInfo,'000000000000') } }) } } }) // tool.isLogin().then(res => { // this.setData({ // userInfo:JSON.parse(res.rawData) // }) // console.log(this.data.userInfo,'000000000000') // }).catch(err => { // console.log(err) // }) } })