123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- // pages/activity/activityhistory/activityHistory.js
- const util = require('../../../utils/util.js');
- const api = require('../../../config/api.js');
- const user = require('../../../utils/user.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabState: 1,
- myPost: [], //我发起的数据
- myJoin: [], //我参与的数据
- myPostQuery: {
- },
- myJoinQuery: {
- }
- },
- chooseTab: function (e) {
- console.log(e.currentTarget.dataset.state);
- this.setData({
- tabState: e.currentTarget.dataset.state
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let userInfo = wx.getStorageSync('userInfo');
- //console.info(userInfo);
- this.setData({
- userInfo: userInfo,
- });
- this.wofaqide(); //我发起的
- this.wochanyude(); //我参与的
- },
- wofaqide() {
- //我发起的
- let that = this;
- util.request(api.ActivityList, {
- userId: that.data.userInfo.id
- }).then(function (res) {
- console.info(res.data);
- if (res.errno === 0) {
- res.data.forEach(function (item, index) {
- item.shichang = util.dateDifference(item.startTime, item.endTime);
- })
- that.setData({
- myPost: res.data
- })
- }
- })
- },
- wochanyude() {
- let that = this;
- util.request(api.ActivityParticipate, {
- userId: that.data.userInfo.id
- }).then(function (res) {
- console.info(res.data);
- if (res.errno === 0) {
- res.data.forEach(function (item, index) {
- item.shichang = util.dateDifference(item.startTime, item.endTime);
- })
- that.setData({
- myJoin: res.data
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- async requestActivityCreate() {
- let tt = await util.request(api.ActivityCreate, {
- userId: this.data.userInfo.id
- }).then(function (res) {
- console.log(res.data);
- }).catch(function (err) {
- console.log(err);
- });
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- let that = this;
- console.log("进入邀请了");
- that.requestActivityCreate();
- return {
- title: "邀请好友领60元现金券",
- path: '/pages/index/index?rId=' + that.data.userInfo.id,
- // path: '/pages/index/index?rId=1',
- success: function (res) {
- // 转发成功
- console.log("转发成功:" + JSON.stringify(res));
- },
- fail: function (res) {
- // 转发失败
- console.log("转发失败:" + JSON.stringify(res));
- }
- };
- },
- goCouponList() {
- wx.navigateTo({
- url: '/pages/ucenter/couponList/couponList',
- })
- }
- })
|