system_notifacations.js 2.7 KB
  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
//articleLists.js 文章列表
// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')
// 事件监听
var event = require('../../utils/event.js')
var page
// 是否有更多
var hasMore
var isRefresh


Page({

data: {
list: [
{ isHighRisk: false,zar:12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
, { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
, { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
, { isHighRisk: false, zar: 12,title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
, { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
, { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
],
},
onLoad: function (e) {
this.data.id = e.id
this.data.category = e.category
// 数据初始化
page = 1
hasMore = true
isRefresh = false

// this.requestData()
},
onUnload: function() {
},
// 加载更多
loadMore:function(e){
if(!hasMore || isRefresh == true){
return
}
page ++
this.requestData()
},
// 下拉刷新回调接口
onPullDownRefresh: function() {
page = 1;
hasMore = true
// 网络请求,重新请求一遍数据
this.requestData();
},
myScroll:function(e){
if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
this.loadMore()
}
},
/*---------自定义函数--------*/
requestData(){
var self = this
isRefresh = true
networkUtil.showLoading()
var param = {page:page,limit:15,}
networkUtil._get(api.articleList,param,function(res){
isRefresh = false
var arr = []
if(page > 0) {// 加载更多模式
arr = self.data.list
}
if(res.data.data.length < 15){
hasMore = false
}
arr = arr.concat(res.data.data)
var temp = self.data.category
self.setData({
list:arr,
hasMore : hasMore,
category : temp
})
},function(res){
isRefresh = false
})
},
})