forked from nsjcy/frontEnd/nsjcy

liuwh
2020-05-09 62a240df3ff2f1bcddea834ccb15fccefc51ae26
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// pages/zhwj/zhwj.js
var app = getApp();
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    wjgk: './../../images/wjgk.jpg',
    qiyefuwu: app.globalData.imgUrl + '/images/qiyefuwu.png',
    dongtai1_1: app.globalData.imgUrl + '/image/dongtai1-1.jpg',
    dongtai2_1: app.globalData.imgUrl + '/image/dongtai2-1.jpg',
    dongtai3_1: app.globalData.imgUrl + '/image/dongtai3-1.jpg',
    iconList: [{
      icon: 'cardboardfill',
      color: 'red',
      badge: 120,
      name: 'VR'
    }, {
      icon: 'recordfill',
      color: 'orange',
      badge: 1,
      name: '录像'
    }, {
      icon: 'picfill',
      color: 'yellow',
      badge: 0,
      name: '图像'
    }, {
      icon: 'noticefill',
      color: 'olive',
      badge: 22,
      name: '通知'
    }, {
      icon: 'upstagefill',
      color: 'cyan',
      badge: 0,
      name: '排行榜'
    }, {
      icon: 'clothesfill',
      color: 'blue',
      badge: 0,
      name: '皮肤'
    }, {
      icon: 'discoverfill',
      color: 'purple',
      badge: 0,
      name: '发现'
    }, {
      icon: 'questionfill',
      color: 'mauve',
      badge: 0,
      name: '帮助'
    }, {
      icon: 'commandfill',
      color: 'purple',
      badge: 0,
      name: '问答'
    }, {
      icon: 'brandfill',
      color: 'mauve',
      badge: 0,
      name: '版权'
    }],
    dataSet: []
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    wx.showLoading();
    wx.request({
      url: app.globalData.url + '/api/article/publicMsgQuery',
      data: {
        page: 1,
        size: 1000,
        flag: '主动预防',
      },
      success: function(res) {
        wx.hideLoading();
        console.log('res', res);
        if (res.data.code == 0) {
          let content = res.data.data.result.content.map(({
            createTime,
            ...i
          }) => ({
            ...i,
            createTime: app.formatDate(createTime),
          }));
          console.log(content)
          that.setData({
            dataSet: content
          })
        } else {
          wx.showToast({
            title: res.data.msg,
          })
        }
      }
    })
  },
 
  folder: function(event) {
    var title = event.currentTarget.dataset['title'];
    wx.navigateTo({
      url: '../law2Publicitylist/law2Publicitylist?title=' + title,
    })
  },
 
  // 跳转
  linkFunction: function(event) {
    var str = event.currentTarget.dataset['str'];
    var id = event.currentTarget.dataset['id'];
    wx.navigateTo({
      url: '../' + str + '/' + str + '?id=' + id
    })
  },
})