diff --git a/littleApp_child/pages/system_notifacations/system_notifacations.js b/littleApp_child/pages/system_notifacations/system_notifacations.js index 78b1732..ec35b0d 100644 --- a/littleApp_child/pages/system_notifacations/system_notifacations.js +++ b/littleApp_child/pages/system_notifacations/system_notifacations.js @@ -13,136 +13,148 @@ var pageLimit = 15 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" } - ], - titles: [], - category: '', - current_index: 0, - hasMore:'', - - - }, - onLoad: function (e) { - // 数据初始化 - page = 1 - hasMore = true - isRefresh = false - networkUtil.showLoading() - this.getTitles(); - }, - onUnload: function() { - - }, - - // 加载更多 - loadMore:function(e){ - if(!hasMore || isRefresh == true){ - return - } - page ++ - networkUtil.showLoading() - this.requestData() - - }, - refesh: function () { - page = 1; - hasMore = true - this.setData({ - list: [], - - }) - networkUtil.showLoading() - // 网络请求,重新请求一遍数据 - this.requestData(); - - - }, - myScroll:function(e){ - // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){ - this.loadMore() - // } - }, - titleClick:function(e){ - - var self = this - var current_index = e.currentTarget.dataset.index - var categoryid = e.currentTarget.dataset.categoryid - this.setData({ - category: categoryid, - current_index: current_index, - list: [], - }) - page = 1; - hasMore = true - networkUtil.showLoading() - this.requestData() - - - }, - getTitles(){ - var self = this - var param = {} - networkUtil._get(api.messageTab, param, function (res) { - console.log(res) - - var arr = [] - - arr = arr.concat(res.data.list) - var category=arr[0].id - self.setData({ - titles: arr, - category: category - - }) - self.requestData(); - }, function (res) { - isRefresh = false - }) - }, - - /*---------自定义函数--------*/ - requestData(){ - var self = this - isRefresh = true - // networkUtil.showLoading() - var param = { page: page, limit: pageLimit, typeid: self.data.category} - console.log(param) - - networkUtil._get(api.messageList,param,function(res){ - // console.log("messageList:"+res) - isRefresh = false - var arr = [] - if(page > 0) {// 加载更多模式 - arr = self.data.list - } - if (res.data.list.length < pageLimit) { - hasMore = false - } else { - hasMore = true - } - arr = arr.concat(res.data.list) - // arr[1].type=2 - self.setData({ - list:arr, - hasMore : hasMore, - }) - wx.hideToast() - // wx.pageScrollTo({ - // scrollTop: 0, - // }) - },function(res){ - isRefresh = false - wx.hideToast() - }) - }, - - + 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" } + ], + titles: [], + category: '', + current_index: 0, + hasMore: '', + noData: true + + + }, + onLoad: function (e) { + // 数据初始化 + page = 1 + hasMore = true + isRefresh = false + networkUtil.showLoading() + this.getTitles(); + }, + onUnload: function () { + + }, + + // 加载更多 + loadMore: function (e) { + if (!hasMore || isRefresh == true) { + return + } + page++ + networkUtil.showLoading() + this.requestData() + + }, + refesh: function () { + page = 1; + hasMore = true + this.setData({ + list: [], + + }) + networkUtil.showLoading() + // 网络请求,重新请求一遍数据 + this.requestData(); + + + }, + myScroll: function (e) { + // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){ + this.loadMore() + // } + }, + titleClick: function (e) { + + var self = this + var current_index = e.currentTarget.dataset.index + var categoryid = e.currentTarget.dataset.categoryid + this.setData({ + category: categoryid, + current_index: current_index, + list: [], + }) + page = 1; + hasMore = true + networkUtil.showLoading() + this.requestData() + + + }, + getTitles() { + var self = this + var param = {} + networkUtil._get(api.messageTab, param, function (res) { + console.log(res) + + var arr = [] + + arr = arr.concat(res.data.list) + var category = arr[0].id + self.setData({ + titles: arr, + category: category + + }) + self.requestData(); + }, function (res) { + isRefresh = false + }) + }, + + /*---------自定义函数--------*/ + requestData() { + var self = this + isRefresh = true + // networkUtil.showLoading() + var param = { page: page, limit: pageLimit, typeid: self.data.category } + console.log(param) + + networkUtil._get(api.messageList, param, function (res) { + // console.log("messageList:"+res) + isRefresh = false + var arr = [] + if (page > 0) {// 加载更多模式 + arr = self.data.list + } + if (res.data.list.length < pageLimit) { + hasMore = false + } else { + hasMore = true + } + arr = arr.concat(res.data.list) + // arr[1].type=2 + if (arr.length > 0) { + self.setData({ + noData: false, + + }) + } else { + self.setData({ + noData: true, + + }) + } + self.setData({ + list: arr, + hasMore: hasMore, + }) + wx.hideToast() + // wx.pageScrollTo({ + // scrollTop: 0, + // }) + }, function (res) { + isRefresh = false + wx.hideToast() + }) + }, + + }) diff --git a/littleApp_child/pages/system_notifacations/system_notifacations.wxml b/littleApp_child/pages/system_notifacations/system_notifacations.wxml index 3971432..ff43382 100644 --- a/littleApp_child/pages/system_notifacations/system_notifacations.wxml +++ b/littleApp_child/pages/system_notifacations/system_notifacations.wxml @@ -5,7 +5,7 @@ - + @@ -53,4 +53,7 @@ - \ No newline at end of file + + + 暂时没有消息通知哦! + \ No newline at end of file