Commit 8f5b0dd8d4273801035e32ab3fd9a98a80f1b1e4

Authored by luoye

Merge branch 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child

* 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child:
  消息通知无数据界面

Showing 2 changed files

littleApp_child/pages/system_notifacations/system_notifacations.js View file @ 8f5b0dd
... ... @@ -13,137 +13,149 @@
13 13  
14 14 Page({
15 15  
16   - data: {
17   -
18   - list: [
19   - // { isHighRisk: false,zar:12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
20   - // , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
21   - // , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
22   - // , { isHighRisk: false, zar: 12,title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
23   - // , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
24   - // , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
25   - ],
26   - titles: [],
27   - category: '',
28   - current_index: 0,
29   - hasMore:'',
30   -
31   -
32   - },
33   - onLoad: function (e) {
34   - // 数据初始化
35   - page = 1
36   - hasMore = true
37   - isRefresh = false
38   - networkUtil.showLoading()
39   - this.getTitles();
40   - },
41   - onUnload: function() {
42   -
43   - },
44   -
45   - // 加载更多
46   - loadMore:function(e){
47   - if(!hasMore || isRefresh == true){
48   - return
49   - }
50   - page ++
51   - networkUtil.showLoading()
52   - this.requestData()
53   -
54   - },
55   - refesh: function () {
56   - page = 1;
57   - hasMore = true
58   - this.setData({
59   - list: [],
  16 + data: {
60 17  
61   - })
62   - networkUtil.showLoading()
63   - // 网络请求,重新请求一遍数据
64   - this.requestData();
65   -
66   -
67   - },
68   - myScroll:function(e){
69   - // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
70   - this.loadMore()
71   - // }
72   - },
73   - titleClick:function(e){
74   -
75   - var self = this
76   - var current_index = e.currentTarget.dataset.index
77   - var categoryid = e.currentTarget.dataset.categoryid
78   - this.setData({
79   - category: categoryid,
80   - current_index: current_index,
81   - list: [],
82   - })
83   - page = 1;
84   - hasMore = true
85   - networkUtil.showLoading()
86   - this.requestData()
  18 + list: [
  19 + // { isHighRisk: false,zar:12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
  20 + // , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
  21 + // , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
  22 + // , { isHighRisk: false, zar: 12,title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
  23 + // , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
  24 + // , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
  25 + ],
  26 + titles: [],
  27 + category: '',
  28 + current_index: 0,
  29 + hasMore: '',
  30 + noData: true
87 31  
88   -
89   - },
90   - getTitles(){
91   - var self = this
92   - var param = {}
93   - networkUtil._get(api.messageTab, param, function (res) {
94   - console.log(res)
95   -
96   - var arr = []
97   -
98   - arr = arr.concat(res.data.list)
99   - var category=arr[0].id
100   - self.setData({
101   - titles: arr,
102   - category: category
103   -
104   - })
105   - self.requestData();
106   - }, function (res) {
107   - isRefresh = false
108   - })
109   - },
110   -
111   - /*---------自定义函数--------*/
112   - requestData(){
113   - var self = this
114   - isRefresh = true
115   - // networkUtil.showLoading()
116   - var param = { page: page, limit: pageLimit, typeid: self.data.category}
117   - console.log(param)
118   -
119   - networkUtil._get(api.messageList,param,function(res){
120   - // console.log("messageList:"+res)
121   - isRefresh = false
122   - var arr = []
123   - if(page > 0) {// 加载更多模式
124   - arr = self.data.list
125   - }
126   - if (res.data.list.length < pageLimit) {
127   - hasMore = false
128   - } else {
129   - hasMore = true
130   - }
131   - arr = arr.concat(res.data.list)
132   - // arr[1].type=2
133   - self.setData({
134   - list:arr,
135   - hasMore : hasMore,
136   - })
137   - wx.hideToast()
138   - // wx.pageScrollTo({
139   - // scrollTop: 0,
140   - // })
141   - },function(res){
142   - isRefresh = false
143   - wx.hideToast()
144   - })
145   - },
146   -
147   -
  32 +
  33 + },
  34 + onLoad: function (e) {
  35 + // 数据初始化
  36 + page = 1
  37 + hasMore = true
  38 + isRefresh = false
  39 + networkUtil.showLoading()
  40 + this.getTitles();
  41 + },
  42 + onUnload: function () {
  43 +
  44 + },
  45 +
  46 + // 加载更多
  47 + loadMore: function (e) {
  48 + if (!hasMore || isRefresh == true) {
  49 + return
  50 + }
  51 + page++
  52 + networkUtil.showLoading()
  53 + this.requestData()
  54 +
  55 + },
  56 + refesh: function () {
  57 + page = 1;
  58 + hasMore = true
  59 + this.setData({
  60 + list: [],
  61 +
  62 + })
  63 + networkUtil.showLoading()
  64 + // 网络请求,重新请求一遍数据
  65 + this.requestData();
  66 +
  67 +
  68 + },
  69 + myScroll: function (e) {
  70 + // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
  71 + this.loadMore()
  72 + // }
  73 + },
  74 + titleClick: function (e) {
  75 +
  76 + var self = this
  77 + var current_index = e.currentTarget.dataset.index
  78 + var categoryid = e.currentTarget.dataset.categoryid
  79 + this.setData({
  80 + category: categoryid,
  81 + current_index: current_index,
  82 + list: [],
  83 + })
  84 + page = 1;
  85 + hasMore = true
  86 + networkUtil.showLoading()
  87 + this.requestData()
  88 +
  89 +
  90 + },
  91 + getTitles() {
  92 + var self = this
  93 + var param = {}
  94 + networkUtil._get(api.messageTab, param, function (res) {
  95 + console.log(res)
  96 +
  97 + var arr = []
  98 +
  99 + arr = arr.concat(res.data.list)
  100 + var category = arr[0].id
  101 + self.setData({
  102 + titles: arr,
  103 + category: category
  104 +
  105 + })
  106 + self.requestData();
  107 + }, function (res) {
  108 + isRefresh = false
  109 + })
  110 + },
  111 +
  112 + /*---------自定义函数--------*/
  113 + requestData() {
  114 + var self = this
  115 + isRefresh = true
  116 + // networkUtil.showLoading()
  117 + var param = { page: page, limit: pageLimit, typeid: self.data.category }
  118 + console.log(param)
  119 +
  120 + networkUtil._get(api.messageList, param, function (res) {
  121 + // console.log("messageList:"+res)
  122 + isRefresh = false
  123 + var arr = []
  124 + if (page > 0) {// 加载更多模式
  125 + arr = self.data.list
  126 + }
  127 + if (res.data.list.length < pageLimit) {
  128 + hasMore = false
  129 + } else {
  130 + hasMore = true
  131 + }
  132 + arr = arr.concat(res.data.list)
  133 + // arr[1].type=2
  134 + if (arr.length > 0) {
  135 + self.setData({
  136 + noData: false,
  137 +
  138 + })
  139 + } else {
  140 + self.setData({
  141 + noData: true,
  142 +
  143 + })
  144 + }
  145 + self.setData({
  146 + list: arr,
  147 + hasMore: hasMore,
  148 + })
  149 + wx.hideToast()
  150 + // wx.pageScrollTo({
  151 + // scrollTop: 0,
  152 + // })
  153 + }, function (res) {
  154 + isRefresh = false
  155 + wx.hideToast()
  156 + })
  157 + },
  158 +
  159 +
148 160 })
littleApp_child/pages/system_notifacations/system_notifacations.wxml View file @ 8f5b0dd
... ... @@ -5,7 +5,7 @@
5 5 </label>
6 6 </scroll-view>
7 7 </view>
8   -<view style="height:100%;background:#eee">
  8 +<view style="height:100%;background:#eee" wx:if="{{noData != true}}">
9 9  
10 10 <view class="main">
11 11  
... ... @@ -53,5 +53,8 @@
53 53 </view>
54 54 </view>
55 55  
56   -<image class="icon_refresh" src="../../source/group2.png" bindtap="refesh"></image>
  56 +<view class="backgroundView" wx:if="{{noData == true}}">
  57 + <image class="empty_icon" mode="aspectFit" src="../../source/empty.png"></image>
  58 + <view class="empty_text">暂时没有消息通知哦!</view>
  59 +</view>