forked from nsjcy/frontEnd/nsjcy

liuwh
2020-06-09 5a887acf1924950715086633d329db045223b5c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// pages/fzpx/fzpx.js
var app = getApp()
 
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    items: []
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.showList();
  },
 
  link: function (e) {
    var id = e.currentTarget.dataset['id'];
    var str = e.currentTarget.dataset['str'];
    var flag = e.currentTarget.dataset['flag'];
    wx.navigateTo({
      url: '../' + str + '/' + str + '?id=' + id + '&flag=' + flag
    })
  },
 
  showList: function () {
    var that = this;
    wx.showLoading();
    wx.request({
      url: app.globalData.url + '/api/activity/preview',
      data: {
        page: 1,
        size: 1000,
        userId: wx.getStorageSync("user").id,
        type: 'act_3'
      },
      success: function (res) {
        wx.hideLoading();
        console.log('res', res);
        if (res.data.code == 0) {
          let content = res.data.data.content.map(({
            startTime,
            ...i
          }) => ({
            ...i,
            startTime: app.formatDate(startTime),
          }));
          that.setData({
            items: content
          })
        } else {
          wx.showToast({
            title: res.data.msg,
          })
        }
      }
    })
  }
 
 
})