Commit a824a75e85c4cc71e851eefe2e83cc47f4f88efb

Authored by xianghenggang
1 parent f4d1ae33c8

no message

Showing 8 changed files with 264 additions and 114 deletions

littleApp_child/pages/childcare_knowledge/childcare_knowledge.js View file @ a824a75
... ... @@ -11,6 +11,8 @@
11 11 // 获取应用实例
12 12 var app = getApp()
13 13  
  14 +var pageLimit=4
  15 +
14 16 Page({
15 17 data: {
16 18 list: [
17 19  
18 20  
19 21  
20 22  
21 23  
22 24  
... ... @@ -57,26 +59,37 @@
57 59 })
58 60 },
59 61 // 加载更多
60   - loadMore:function(e){
  62 + loadMore:function(){
  63 +
  64 + console.log("hasMore:", hasMore)
61 65 if(!hasMore || isRefresh == true){
62 66 return
63 67 }
64 68 page ++
  69 + networkUtil.showLoading()
  70 + this.requestData()
65 71  
66   - this.requestData()
67   -
68 72 },
69 73 // 下拉刷新回调接口
70   - onPullDownRefresh: function() {
  74 + refesh: function() {
71 75 page = 1;
72 76 hasMore = true
  77 + var self=this
  78 + this.setData({
  79 + list: [],
  80 +
  81 + })
  82 +
  83 + networkUtil.showLoading()
73 84 // 网络请求,重新请求一遍数据
74 85 this.requestData();
75 86 },
76   - myScroll:function(e){
77   - if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
  87 + myScroll: function (e) {
  88 + console.log("e:", e)
  89 + // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
  90 + // this.loadMore()
  91 + // }
78 92 this.loadMore()
79   - }
80 93 },
81 94 titleClick:function(e){
82 95 // console.log(e)
... ... @@ -88,6 +101,8 @@
88 101 current_index: current_index,
89 102 images: app.globalData.artList[current_index].iconimage
90 103 })
  104 + page = 1;
  105 + hasMore = true
91 106 this.requestData()
92 107 },
93 108 toSearch(){
94 109  
95 110  
96 111  
97 112  
... ... @@ -100,22 +115,24 @@
100 115 var self = this
101 116 isRefresh = true
102 117 networkUtil.showLoading()
103   - var param = { page: page, limit: 15, type: 2, days: app.globalData.days, categoryId: self.data.category}
  118 + var param = { page: page, limit: pageLimit, type: 2, days: app.globalData.days, categoryId: self.data.category}
104 119 // console.log(param)
105 120 networkUtil._get(api.articles,param,function(res){
106 121 console.log(res)
107 122 isRefresh = false
108 123 var arr = []
109   - if(page > 0) {// 加载更多模式
  124 + if(page > 1) {// 加载更多模式
110 125 arr = self.data.list
111 126 }
112   - if (res.data.list.length < 15){
  127 + if (res.data.list.length < pageLimit){
113 128 hasMore = false
  129 + }else{
  130 + hasMore = true
114 131 }
115 132 arr = arr.concat(res.data.list)
116 133 self.setData({
117 134 list:arr,
118   - hasMore : hasMore,
  135 + hasMore: hasMore
119 136 })
120 137 },function(res){
121 138 isRefresh = false
littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml View file @ a824a75
1 1 <!--articleLists.wxml 文章列表-->
2   -<view class="title_top_view">
3   - <image class="search_img" src="../../source/ic_search.png" bindtap="toSearch"></image>
4   - <scroll-view class="title_scroll" scroll-x="true" scroll-y="false">
5   - <label class="scroll_title_label " wx:for="{{titles}}">
  2 +<view style="height:100%;background:#fff">
  3 + <view class="">
  4 + <view class="title_top_view">
  5 + <image class="search_img" src="../../source/ic_search.png" bindtap="toSearch"></image>
  6 + <scroll-view class="title_scroll" scroll-x="true" scroll-y="false">
  7 + <label class="scroll_title_label " wx:for="{{titles}}">
6 8 <label style="{{current_index == index? 'border-bottom: 2px solid #48C17B;' : 'border-bottom:0px solid #f4879b;'}}" class="title_text" bindtap="titleClick" data-categoryid="{{item.id}}" data-index="{{index}}">{{item.title}}</label>
7 9  
8   - </label>
9   - </scroll-view>
10   -</view>
11   -<view class="main">
  10 + </label>
  11 + </scroll-view>
  12 + </view>
  13 + <view class="main">
12 14  
13   - <scroll-view bindscrolltolower="loadMore">
14   - <!-- <swiper hidden="{{images.length > 0 ? false : true}}" class="swiper" indicator-dots="false" indicator-active-color="#ffffff">
  15 + <scroll-view class="list_scroll" scroll-y="true" bindscrolltolower="myScroll">
  16 + <!-- <swiper hidden="{{images.length > 0 ? false : true}}" class="swiper" indicator-dots="false" indicator-active-color="#ffffff">
15 17 <block wx:for="{{images}}">
16 18 <swiper-item>
17 19 <image src="{{item}}"></image>
18 20 </swiper-item>
19 21 </block>
20 22 </swiper> -->
21   - <image class="swiper" src="{{images.medium}}"></image>
22   - <view>
23   - <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail" wx:for="{{list}}" wx:key="{{index}}">
24   - <view class="content_item">
25   - <view style="margin-left:15px;margin-right:75px;">
26   - <view class="content_title">{{item.title}}</view>
27   - <view class="content_content">{{item.introduction}}</view>
28   - <view class="zar_box">
29   - <image class="zar_img" src="../../source/zar.png"></image>
30   - <view class="content_zar">{{item.likeCount}}</view>
31   - </view>
  23 + <image class="swiper" src="{{images.medium}}"></image>
  24 + <view>
  25 + <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail" wx:for="{{list}}" wx:key="{{index}}">
  26 + <view class="content_item">
  27 + <view style="margin-left:15px;margin-right:75px;">
  28 + <view class="content_title">{{item.title}}</view>
  29 + <view class="content_content">{{item.introduction}}</view>
  30 + <view class="zar_box">
  31 + <image class="zar_img" src="../../source/zar.png"></image>
  32 + <view class="content_zar">{{item.likeCount}}</view>
  33 + </view>
32 34  
33   - </view>
34   - <image class="content_image" src="{{item.image.medium}}"></image>
  35 + </view>
  36 + <image class="content_image" src="{{item.image.medium}}"></image>
  37 + </view>
  38 + <view class="home__list-item__bottom"></view>
  39 + </navigator>
  40 + <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
35 41 </view>
36   - <view class="home__list-item__bottom"></view>
37   - </navigator>
38   - <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
  42 + </scroll-view>
  43 +
39 44 </view>
40   - </scroll-view>
  45 + </view>
  46 + <image class="icon_refresh" src="../../source/group2.png" bindtap="refesh"></image>
41 47  
42 48 </view>
littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxss View file @ a824a75
... ... @@ -17,7 +17,7 @@
17 17  
18 18 .title_scroll {
19 19 width: 90%;
20   - margin-left: 10px;
  20 + margin-left: 10px;
21 21 /*可以滚动 */
22 22 white-space: nowrap;
23 23 display: inline-block;
... ... @@ -40,7 +40,7 @@
40 40 font-size: 13px;
41 41 color: #494949;
42 42 border-bottom: 2px;
43   - border-color: #FF5E5E ;
  43 + border-color: #ff5e5e;
44 44 }
45 45  
46 46 .title_text {
... ... @@ -50,9 +50,9 @@
50 50 }
51 51  
52 52 .search_img {
53   - width: 22px;
54   - height: 22px;
55   - margin-top: 9px;
  53 + width: 22px;
  54 + height: 22px;
  55 + margin-top: 9px;
56 56 }
57 57  
58 58 .home__list-item {
... ... @@ -101,8 +101,6 @@
101 101 -webkit-line-clamp: 2;
102 102 }
103 103  
104   -
105   -
106 104 .content_image {
107 105 width: 50px;
108 106 transform: translateY(-65px);
109 107  
110 108  
... ... @@ -110,13 +108,16 @@
110 108 margin-right: 15px;
111 109 height: 50px;
112 110 }
113   -.zar_box{
  111 +
  112 +.zar_box {
114 113 display: flex;
115 114 }
116   -.zar_img{
  115 +
  116 +.zar_img {
117 117 width: 22px;
118 118 height: 22px;
119 119 }
  120 +
120 121 .content_zar {
121 122 font-family: PingFangSC-Regular;
122 123 font-size: 10px;
123 124  
124 125  
... ... @@ -124,13 +125,27 @@
124 125 margin-top: 3px;
125 126 color: #c6c6c6;
126 127 }
  128 +
127 129 /*item 分割线*/
128 130  
129 131 .home__list-item__bottom {
130   - height: 2px;
131   - background: #d8dbd4;
  132 + height: 1px;
  133 + background: #e2e2e2;
132 134 margin-top: 5px;
133 135 left: 15px;
134 136 right: 15px;
  137 +}
  138 +
  139 +.list_scroll {
  140 + height: 100vh;
  141 + /* background: rebeccapurple */
  142 +}
  143 +
  144 +.icon_refresh {
  145 + position: absolute;
  146 + width: 50px;
  147 + height: 50px;
  148 + right: 20px;
  149 + bottom: 30px;
135 150 }
littleApp_child/pages/system_notifacations/system_notifacations.js View file @ a824a75
... ... @@ -9,32 +9,33 @@
9 9 var hasMore
10 10 var isRefresh
11 11  
  12 +var pageLimit = 4
12 13  
13 14 Page({
14 15  
15 16 data: {
16 17  
17 18 list: [
18   - { isHighRisk: false,zar:12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
19   - , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
20   - , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
21   - , { isHighRisk: false, zar: 12,title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
22   - , { isHighRisk: true, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
23   - , { isHighRisk: false, zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
  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" }
24 25 ],
  26 + titles: [],
  27 + category: '',
  28 + current_index: 0,
  29 + hasMore:''
25 30  
26 31 },
27 32 onLoad: function (e) {
28   - this.data.id = e.id
29   - this.data.category = e.category
30 33 // 数据初始化
31 34 page = 1
32 35 hasMore = true
33 36 isRefresh = false
34   -
35   - // this.requestData()
36   -
37   -
  37 + networkUtil.showLoading()
  38 + this.getTitles();
38 39 },
39 40 onUnload: function() {
40 41  
41 42  
42 43  
43 44  
44 45  
45 46  
46 47  
47 48  
48 49  
49 50  
50 51  
... ... @@ -46,45 +47,83 @@
46 47 return
47 48 }
48 49 page ++
  50 + this.requestData()
49 51  
50   - this.requestData()
51   -
52 52 },
53   - // 下拉刷新回调接口
54   - onPullDownRefresh: function() {
  53 + refesh: function() {
55 54 page = 1;
56 55 hasMore = true
  56 + this.setData({
  57 + list: [],
  58 +
  59 + })
  60 + networkUtil.showLoading()
57 61 // 网络请求,重新请求一遍数据
58 62 this.requestData();
59 63 },
60 64 myScroll:function(e){
61   - if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
  65 + // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
62 66 this.loadMore()
63   - }
  67 + // }
64 68 },
  69 + titleClick:function(e){
  70 + var self = this
  71 + var current_index = e.currentTarget.dataset.index
  72 + var categoryid = e.currentTarget.dataset.categoryid
  73 + this.setData({
  74 + category: categoryid,
  75 + current_index: current_index,
  76 + list: [],
  77 + })
  78 + page = 1;
  79 + hasMore = true
  80 + this.requestData()
  81 + },
  82 + getTitles(){
  83 + var self = this
  84 + var param = {}
  85 + networkUtil._get(api.messageTab, param, function (res) {
  86 + console.log(res)
  87 +
  88 + var arr = []
  89 +
  90 + arr = arr.concat(res.data.list)
  91 + var category=arr[0].id
  92 + self.setData({
  93 + titles: arr,
  94 + category: category
  95 +
  96 + })
  97 + self.requestData();
  98 + }, function (res) {
  99 + isRefresh = false
  100 + })
  101 + },
65 102  
66 103 /*---------自定义函数--------*/
67 104 requestData(){
68 105 var self = this
69 106 isRefresh = true
70 107 networkUtil.showLoading()
71   - var param = {page:page,limit:15,}
72   - networkUtil._get(api.articleList,param,function(res){
73   -
  108 + var param = { page: page, limit: pageLimit, typeid: self.data.category}
  109 + console.log(param)
  110 + networkUtil._get(api.messageList,param,function(res){
  111 + // console.log("messageList:"+res)
74 112 isRefresh = false
75 113 var arr = []
76 114 if(page > 0) {// 加载更多模式
77 115 arr = self.data.list
78 116 }
79   - if(res.data.data.length < 15){
80   - hasMore = false
  117 + if (res.data.list.length < pageLimit) {
  118 + hasMore = false
  119 + } else {
  120 + hasMore = true
81 121 }
82   - arr = arr.concat(res.data.data)
83   - var temp = self.data.category
  122 + arr = arr.concat(res.data.list)
  123 + // arr[1].type=2
84 124 self.setData({
85 125 list:arr,
86 126 hasMore : hasMore,
87   - category : temp
88 127 })
89 128 },function(res){
90 129 isRefresh = false
littleApp_child/pages/system_notifacations/system_notifacations.wxml View file @ a824a75
1   -<view class="main">
  1 +<view style="height:100%;background:#fff">
  2 + <view class="main">
  3 + <view class="title_top_view">
  4 + <scroll-view class="title_scroll" scroll-x="true" scroll-y="false">
  5 + <label class="scroll_title_label " wx:for="{{titles}}">
  6 + <label style="{{current_index == index? 'border-bottom: 2px solid #48C17B;' : 'border-bottom:0px solid #f4879b;'}}" class="title_text" bindtap="titleClick" data-categoryid="{{item.id}}" data-index="{{index}}">{{item.title}}</label>
2 7  
3   - <scroll-view style="" bindscrolltolower="loadMore">
  8 + </label>
  9 + </scroll-view>
  10 + </view>
  11 + <scroll-view class="list_scroll" scroll-y="true" bindscrolltolower="myScroll">
4 12  
5   - <view>
6   - <block hover-class="weui-cell_active" wx:for="{{list}}">
7   - <view hidden="{{item.isHighRisk}}" class="high_risk_main">
8   - <view class="high_risk_title">高危紧急通知</view>
9   - <view class="high_rish_content1">
10   - <label class="high_rish_content_before">危急值:</label>
11   - <label class="high_rish_content_after">危急值</label>
  13 + <view>
  14 + <block hover-class="weui-cell_active" wx:for="{{list}}">
  15 + <view hidden="{{item.type==1?false:true}}" class="high_risk_main">
  16 + <view class="high_risk_title">{{item.title}}</view>
  17 +
  18 + <view class="other_three_content">{{item.content}}</view>
  19 + <!-- <view class="high_rish_content1" >
  20 + <label class="high_rish_content_before">危急值:</label>
  21 + <label class="high_rish_content_after">危急值</label>
  22 + </view>
  23 + <view class="high_rish_content1">
  24 + <label class="high_rish_content_before">危急项:</label>
  25 + <label class="high_rish_content_after">危急项</label>
  26 + </view>
  27 + <view class="high_rish_content1">
  28 + <label class="high_rish_content_before">紧急提醒:</label>
  29 + <label class="high_rish_content_after">qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm</label>
  30 + </view> -->
  31 + <view class="line"></view>
  32 + <view class="high_rish_content1">
  33 + <label class="high_rish_date">{{item.time}}</label>
  34 + <label class="high_rish_hospital_name">{{item.hospitalName}}</label>
  35 + </view>
12 36 </view>
13   - <view class="high_rish_content1">
14   - <label class="high_rish_content_before">危急项:</label>
15   - <label class="high_rish_content_after">危急项</label>
  37 + <view hidden="{{item.type==1?true:false}}" class="other_three_main">
  38 + <view class="green_line"></view>
  39 + <view class="other_three_title">{{item.title}}</view>
  40 + <view class="other_three_content">{{item.content}}</view>
  41 + <view class="line"></view>
  42 + <view class="high_rish_content1">
  43 + <label class="other_three_date">{{item.time}}</label>
  44 + <label class="other_three_hospital_name">{{item.hospitalName}}</label>
  45 + </view>
16 46 </view>
17   - <view class="high_rish_content1">
18   - <label class="high_rish_content_before">紧急提醒:</label>
19   - <label class="high_rish_content_after">qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm</label>
20   - </view>
21   - <view class="line"></view>
22   - <view class="high_rish_content1">
23   - <label class="high_rish_date">2017-7</label>
24   - <label class="high_rish_hospital_name">紧急提醒</label>
25   - </view>
26   - </view>
27   - <view hidden="{{!item.isHighRisk}}" class="other_three_main">
28   - <view class="green_line"></view>
29   - <view class="other_three_title">高危紧急通知</view>
30   - <view class="other_three_content">公司的复苏的还记得公司的复苏的还记得公司的复苏的还记得</view>
31   - <view class="line"></view>
32   - <view class="high_rish_content1">
33   - <label class="other_three_date">2017-7</label>
34   - <label class="other_three_hospital_name">紧急提醒</label>
35   - </view>
36   - </view>
37   - </block>
38   - <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
39   - </view>
40   - </scroll-view>
  47 + </block>
  48 + <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
  49 + </view>
  50 + </scroll-view>
  51 + </view>
  52 +
  53 + <image class="icon_refresh" src="../../source/group2.png" bindtap="refesh"></image>
41 54  
42 55 </view>
littleApp_child/pages/system_notifacations/system_notifacations.wxss View file @ a824a75
1 1 .main {
2   - background: #eee;
  2 + background: #fff;
3 3 width: 100%;
  4 + margin-top: 40px;
4 5 }
  6 +.title_top_view {
  7 + width: 100%;
  8 + display: flex;
  9 + background: white;
  10 + position: fixed;
  11 + height: 40px;
  12 + padding-left: 10px;
  13 + top: 0px;
  14 + z-index: 1;
  15 +}
5 16  
  17 +.title_scroll {
  18 + width: 90%;
  19 + margin-left: 10px;
  20 + /*可以滚动 */
  21 + white-space: nowrap;
  22 + display: inline-block;
  23 +}
  24 +
  25 +/*隐藏Scrollview滚动条 */
  26 +
  27 +::-webkit-scrollbar {
  28 + width: 0;
  29 + height: 0;
  30 + color: transparent;
  31 +}
  32 +
  33 +.scroll_title_label {
  34 + height: 40px;
  35 + margin-right: 30px;
  36 + text-align: left;
  37 + line-height: 40px;
  38 + border: 1px;
  39 + font-size: 13px;
  40 + color: #494949;
  41 + border-bottom: 2px;
  42 + border-color: #ff5e5e;
  43 +}
  44 +
  45 +.title_text {
  46 + font-size: 13px;
  47 + padding-top: 10px;
  48 + padding-bottom: 7px;
  49 +}
  50 +.list_scroll {
  51 + height: 100vh;
  52 + /* background: rebeccapurple */
  53 +}
6 54 /*高危 */
7 55  
8 56 .high_risk_main {
... ... @@ -122,5 +170,13 @@
122 170 margin-top: 5px;
123 171 text-align: right;
124 172 margin-bottom: 5px;
  173 +}
  174 +
  175 +.icon_refresh {
  176 + position: absolute;
  177 + width: 50px;
  178 + height: 50px;
  179 + right: 20px;
  180 + bottom: 30px;
125 181 }
littleApp_child/source/group2.png View file @ a824a75

8.68 KB

littleApp_child/utils/apiFile.js View file @ a824a75
... ... @@ -11,6 +11,10 @@
11 11 // 首页文章列表
12 12 homeArtList:'baby/categories',
13 13 //育儿知识分类列表
14   - articles:'v1/articles'
  14 + articles:'v1/articles',
  15 + //消息列表Tab
  16 + messageTab:'/baby/messtab',
  17 + //消息列表
  18 + messageList: '/baby/mess?typeid=',
15 19 }