Commit 4708152e7bfcf626946191f8c01c212b5dca504a

Authored by xianghenggang
1 parent 96cc983c78

no message

Showing 6 changed files with 301 additions and 4 deletions

littleApp_child/app.json View file @ 4708152
1 1 {
2 2 "pages": [
3   - "pages/childcare_knowledge/childcare_knowledge",
  3 +
4 4 "pages/home/home",
5 5 "pages/login/login",
6 6 "pages/inspectionReport/inspectionReport",
... ... @@ -12,7 +12,9 @@
12 12 "pages/hospitalDetail/hospitalDetail",
13 13 "pages/chatroom/chatroom",
14 14 "pages/chat/chat",
15   - "pages/childcare_knowledge_detail/childcare_knowledge_detail"
  15 + "pages/childcare_knowledge_detail/childcare_knowledge_detail",
  16 + "pages/system_notifacations/system_notifacations",
  17 + "pages/childcare_knowledge/childcare_knowledge"
16 18 ],
17 19 "window": {
18 20 "backgroundTextStyle": "light",
littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml View file @ 4708152
... ... @@ -10,7 +10,7 @@
10 10 </view>
11 11 <view class="main">
12 12  
13   - <view>
  13 + <scroll-view bindscrolltolower="loadMore">
14 14 <swiper hidden="{{images.length > 0 ? false : true}}" class="swiper" indicator-dots="false" indicator-active-color="#ffffff">
15 15 <block wx:for="{{images}}">
16 16 <swiper-item>
... ... @@ -36,7 +36,7 @@
36 36 </navigator>
37 37 <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
38 38 </view>
39   - </view>
  39 + </scroll-view>
40 40  
41 41 </view>
littleApp_child/pages/system_notifacations/system_notifacations.js View file @ 4708152
  1 +//articleLists.js 文章列表
  2 +// 网络请求工具类
  3 +var networkUtil = require('../../utils/network_util.js')
  4 +var api = require('../../utils/apiFile.js')
  5 +// 事件监听
  6 +var event = require('../../utils/event.js')
  7 +var page
  8 +// 是否有更多
  9 +var hasMore
  10 +var isRefresh
  11 +
  12 +
  13 +Page({
  14 + data: {
  15 + list: [
  16 + {zar:12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
  17 + , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
  18 + , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
  19 + , { zar: 12,title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
  20 + , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
  21 + , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
  22 + ],
  23 + images: [
  24 + // 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
  25 + // 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
  26 + 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
  27 + ],
  28 + titles: ["日常护理", "营养美食", "疾病护理", "亲子互动", "言传qq"],
  29 + id:0,
  30 + category:'',
  31 + current_index:0,
  32 + },
  33 + onLoad: function (e) {
  34 + this.data.id = e.id
  35 + this.data.category = e.category
  36 + // 数据初始化
  37 + page = 1
  38 + hasMore = true
  39 + isRefresh = false
  40 +
  41 + // this.requestData()
  42 +
  43 +
  44 + },
  45 + onUnload: function() {
  46 +
  47 + },
  48 + /*---------事件处理函数--------*/
  49 + bindViewTap: function() {
  50 + wx.navigateTo({
  51 + url: '../home/home'
  52 + })
  53 + },
  54 + // 加载更多
  55 + loadMore:function(e){
  56 + if(!hasMore || isRefresh == true){
  57 + return
  58 + }
  59 + page ++
  60 +
  61 + this.requestData()
  62 +
  63 + },
  64 + // 下拉刷新回调接口
  65 + onPullDownRefresh: function() {
  66 + page = 1;
  67 + hasMore = true
  68 + // 网络请求,重新请求一遍数据
  69 + this.requestData();
  70 + },
  71 + myScroll:function(e){
  72 + if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){
  73 + this.loadMore()
  74 + }
  75 + },
  76 + titleClick:function(e){
  77 + console.log(e)
  78 + var index = e.currentTarget.dataset.index
  79 + this.setData({
  80 + current_index:index
  81 + })
  82 + },
  83 + /*---------自定义函数--------*/
  84 + requestData(id){
  85 + var self = this
  86 + isRefresh = true
  87 + networkUtil.showLoading()
  88 + var param = {page:page,limit:15,type:getApp().globalData.userInfo.status,categoryId:self.data.id}
  89 + networkUtil._get(api.articleList,param,function(res){
  90 +
  91 + isRefresh = false
  92 + var arr = []
  93 + if(page > 0) {// 加载更多模式
  94 + arr = self.data.list
  95 + }
  96 + if(res.data.data.length < 15){
  97 + hasMore = false
  98 + }
  99 + arr = arr.concat(res.data.data)
  100 + var temp = self.data.category
  101 + self.setData({
  102 + list:arr,
  103 + hasMore : hasMore,
  104 + category : temp
  105 + })
  106 + },function(res){
  107 + isRefresh = false
  108 + })
  109 + },
  110 +
  111 +
  112 +})
littleApp_child/pages/system_notifacations/system_notifacations.json View file @ 4708152
  1 +{
  2 + "navigationBarBackgroundColor": "#48C17B ",
  3 + "navigationBarTitleText": "育儿知识",
  4 + "navigationBarTextStyle": "white",
  5 + "backgroundColor": "#d8dbd4"
  6 +}
littleApp_child/pages/system_notifacations/system_notifacations.wxml View file @ 4708152
  1 +<!--articleLists.wxml 文章列表-->
  2 +<view class="title_top_view">
  3 + <image class="search_img" src="../../source/ic_search.png"></image>
  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 #f4879b;' : 'border-bottom:0px solid #f4879b;'}}" class="title_text" bindtap="titleClick" data-index="{{index}}">{{item}}</label>
  7 +
  8 + </label>
  9 + </scroll-view>
  10 +</view>
  11 +<view class="main">
  12 +
  13 + <scroll-view bindscrolltolower="loadMore">
  14 + <swiper hidden="{{images.length > 0 ? false : true}}" class="swiper" indicator-dots="false" indicator-active-color="#ffffff">
  15 + <block wx:for="{{images}}">
  16 + <swiper-item>
  17 + <image src="{{item}}"></image>
  18 + </swiper-item>
  19 + </block>
  20 + </swiper>
  21 + <view>
  22 + <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail" hover-class="weui-cell_active" wx:for="{{list}}" wx:key="{{index}}">
  23 + <view class="content_item">
  24 + <view style="margin-left:15px;margin-right:75px;">
  25 + <view class="content_title">{{item.title}}</view>
  26 + <view class="content_content">{{item.content}}</view>
  27 + <view class="zar_box">
  28 + <image class="zar_img" src="../../source/zar.png"></image>
  29 + <view class="content_zar">{{item.zar}}</view>
  30 + </view>
  31 +
  32 + </view>
  33 + <image class="content_image" src="{{item.image}}"></image>
  34 + </view>
  35 + <view class="home__list-item__bottom"></view>
  36 + </navigator>
  37 + <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
  38 + </view>
  39 + </scroll-view>
  40 +
  41 +</view>
littleApp_child/pages/system_notifacations/system_notifacations.wxss View file @ 4708152
  1 +.main {
  2 + background: #fff;
  3 + width: 100%;
  4 + margin-top: 40px;
  5 +}
  6 +
  7 +.title_top_view {
  8 + width: 100%;
  9 + display: flex;
  10 + background: white;
  11 + position: fixed;
  12 + height: 40px;
  13 + padding-left: 10px;
  14 + top: 0px;
  15 + z-index: 1;
  16 +}
  17 +
  18 +.title_scroll {
  19 + width: 90%;
  20 + margin-left: 10px;
  21 + /*可以滚动 */
  22 + white-space: nowrap;
  23 + display: inline-block;
  24 +}
  25 +
  26 +/*隐藏Scrollview滚动条 */
  27 +
  28 +::-webkit-scrollbar {
  29 + width: 0;
  30 + height: 0;
  31 + color: transparent;
  32 +}
  33 +
  34 +.scroll_title_label {
  35 + height: 40px;
  36 + margin-right: 30px;
  37 + text-align: left;
  38 + line-height: 40px;
  39 + border: 1px;
  40 + font-size: 13px;
  41 + color: #494949;
  42 + border-bottom: 2px;
  43 + border-color: #FF5E5E ;
  44 +}
  45 +
  46 +.title_text {
  47 + font-size: 13px;
  48 + padding-top: 10px;
  49 + padding-bottom: 7px;
  50 +}
  51 +
  52 +.search_img {
  53 + width: 22px;
  54 + height: 22px;
  55 + margin-top: 9px;
  56 +}
  57 +
  58 +.home__list-item {
  59 + position: relative;
  60 + background: white;
  61 +}
  62 +
  63 +.swiper {
  64 + height: 200px;
  65 + width: 100%;
  66 +}
  67 +
  68 +.swiper image {
  69 + height: 100%;
  70 + width: 100%;
  71 +}
  72 +
  73 +.content_item {
  74 + width: 100%;
  75 + height: 75px;
  76 + right: 75px;
  77 +}
  78 +
  79 +.content_title {
  80 + font-family: PingFangSC-Regular;
  81 + font-size: 14px;
  82 + margin-top: 10px;
  83 + color: #222;
  84 + display: -webkit-box;
  85 + -webkit-box-orient: vertical;
  86 + -webkit-line-clamp: 2;
  87 + overflow: hidden;
  88 +}
  89 +
  90 +.content_content {
  91 + height: 36px;
  92 + font-family: PingFangSC-Regular;
  93 + font-size: 12px;
  94 + color: #888;
  95 + line-height: 18px;
  96 + display: -webkit-box;
  97 + overflow: hidden;
  98 + text-overflow: ellipsis;
  99 + word-break: break-all;
  100 + -webkit-box-orient: vertical;
  101 + -webkit-line-clamp: 2;
  102 +}
  103 +
  104 +
  105 +
  106 +.content_image {
  107 + width: 50px;
  108 + transform: translateY(-65px);
  109 + float: right;
  110 + margin-right: 15px;
  111 + height: 50px;
  112 +}
  113 +.zar_box{
  114 + display: flex;
  115 +}
  116 +.zar_img{
  117 + width: 22px;
  118 + height: 22px;
  119 +}
  120 +.content_zar {
  121 + font-family: PingFangSC-Regular;
  122 + font-size: 10px;
  123 + margin-left: 3px;
  124 + margin-top: 3px;
  125 + color: #c6c6c6;
  126 +}
  127 +/*item 分割线*/
  128 +
  129 +.home__list-item__bottom {
  130 + height: 2px;
  131 + background: #d8dbd4;
  132 + margin-bottom: 5px;
  133 + margin-top: 5px;
  134 + left: 15px;
  135 + right: 15px;
  136 +}