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
| //index.js
| //获取应用实例
| const app = getApp()
|
| Page({
| data: {
| user: app.globalData.imgUrl + '/image/user.svg',
| dataSet: [],
| title: '',
| content: '------加载中------',
| size: 10,
| hasMoreData: true,
| },
| onLoad: function(option) {
| this.setData({
| title: option.title
| }, this.showList(option.title))
| },
|
| showList: function (title) {
| var that = this;
| wx.request({
| url: app.globalData.url + '/api/article/publicMsgQuery?page=1&size=' + that.data.size + '&flag=' +title,
| success: function(res) {
| console.log(res)
| if (res.data.code == 0) {
| that.setData({
| dataType: res.data.data.units
| })
| if (res.data.data.result.totalElements < that.data.size) {
| that.setData({
| dataSet: res.data.data.result.content,
| hasMoreData: false,
| content: '------我是有底线的------'
| })
| } else {
| that.setData({
| dataSet: res.data.data.result.content,
| hasMoreData: true,
| content: '------加载更多------',
| size: that.data.size + 10
| })
| }
| } else {
| wx.showModal({
| title: '提示',
| content: "请求失败!"
| })
| }
|
| }
| })
| },
|
| link: function(event) {
| // 跳转详情页面
| var id = event.currentTarget.dataset['id'];
| var flag = '办事指南详情';
| wx.navigateTo({
| url: '../publicMsgDetails/publicMsgDetails?id=' + id + '&flag=' + flag,
| })
| }
|
| })
|
|