Commit eb0f68ad286f30fd1cb015a1a2613001562c1fd8

Authored by luoye
1 parent f4d1ae33c8

列表

Showing 16 changed files with 276 additions and 285 deletions

littleApp_child/app.wxss View file @ eb0f68a
... ... @@ -47,8 +47,11 @@
47 47 .loadMoreView {
48 48 height: 20px;
49 49 text-align: center;
50   - font-size: 13px;
51   - background-color: white;
  50 + font-size: 12px;
  51 + width: 100%;
  52 + background: rgba(0, 0, 0, 0);
  53 + /* background: rebeccapurple; */
  54 + color: rgb(22, 22, 22)
52 55 }
53 56  
54 57 .blankView {
littleApp_child/pages/SearchPage/SearchPage.js View file @ eb0f68a
1 1 //index.js
2 2 //获取应用实例
3 3 var app = getApp()
  4 +var networkUtil = require('../../utils/network_util.js')
  5 +var api = require('../../utils/apiFile.js')
  6 +var page
  7 +// 是否有更多
  8 +var hasMore
  9 +var isRefresh
  10 +
  11 +
  12 +
4 13 Page({
5 14 data: {
6   - list: [
7   - { zar: 12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
8   - , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
9   - , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
10   - , { zar: 12, title: "title1", content: "content1", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }
11   - , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }
12   - , { zar: 12, title: "title2", content: "content2", image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }
13   - ],
  15 + // 搜索结果
  16 + list: [],
14 17 selectHide: false,
15 18 inputValue: '',
  19 + // 搜索词汇
16 20 getSearch: [],
17 21 modalHidden: true,
18   - searching:true
  22 + searching:false,
  23 + test:''
19 24 },
20 25  
21 26 onLoad: function () {
22 27  
23 28  
... ... @@ -24,12 +29,11 @@
24 29 onShow: function () {
25 30 var getSearch = wx.getStorageSync('searchData');
26 31 this.setData({
27   - getSearch: getSearch,
  32 + getSearch: getSearch.reverse(),
28 33 inputValue: ''
29 34 })
30   - console.log('search is onshow', getSearch)
31 35 },
32   - /*-------------------- 交互----------*/
  36 + /*-------------------- ----------*/
33 37 // 设置缓存
34 38 setSearchStorage: function () {
35 39 let data;
36 40  
37 41  
... ... @@ -40,15 +44,37 @@
40 44 searchData.push(this.data.inputValue)
41 45 wx.setStorageSync('searchData', searchData)
42 46 this.setData({
43   - getSearch: searchData,
  47 + getSearch: searchData.reverse(),
44 48 })
45 49 } else {
46 50 console.log('空白')
47 51 }
48 52 },
49 53 // 加载数据
50   - loadData(){
  54 + loadData(text){
  55 + var self = this
  56 + isRefresh = true
  57 + var param = { k: text, limit: 30, page:1}
  58 + networkUtil._get(api.search, param, function (res) {
  59 + console.log('数据-----', res)
  60 + isRefresh = false
  61 + var arr = []
  62 + if (page > 0) {// 加载更多模式
  63 + arr = self.data.list
  64 + }
  65 + if (res.data.list.length < 15) {
  66 + hasMore = false
  67 + }
  68 + arr = arr.concat(res.data.list)
  69 + var temp = self.data.category
  70 + self.setData({
  71 + list: arr,
  72 + hasMore: hasMore,
  73 + category: temp
  74 + })
  75 + }, function (res) {
51 76  
  77 + })
52 78 },
53 79 /*-------------------- 交互----------*/
54 80 // 返回
55 81  
56 82  
57 83  
58 84  
59 85  
60 86  
... ... @@ -59,32 +85,41 @@
59 85 // 清除输入框
60 86 clearInput: function () {
61 87 this.setData({
62   - inputValue: ''
  88 + inputValue: '',
  89 + list: [],
  90 + searching: false
63 91 })
64 92 },
65 93 // 输入完成
66 94 inputEnd:function(e){
  95 + networkUtil.showLoading()
67 96 this.setData({
68 97 inputValue: e.detail.value,
69   - searching: true
  98 + searching: true,
  99 + list:[]
70 100 })
71 101 this.setSearchStorage()
  102 + this.loadData(e.detail.value)
72 103 },
73 104 // 清除所有历史
74 105 clearAll: function () {
75 106 wx.setStorageSync('searchData', [])
76 107 this.setData({
77 108 getSearch: [],
  109 +
78 110 })
79 111 },
80 112 // 选择该项历史
81 113 selectThis: function (e) {
82   -
  114 + this.setData({
  115 + inputValue: e.currentTarget.dataset.text,
  116 + searching: true
  117 + })
  118 + this.loadData(e.currentTarget.dataset.text)
83 119 },
84 120 // 删除该项历史
85 121 deletThis: function (e) {
86   - console.log(e)
87   -
  122 +
88 123 var data = this.data.getSearch
89 124 data.splice(e.currentTarget.dataset.index,1)
90 125 this.setData({
... ... @@ -95,7 +130,6 @@
95 130 this.setData({
96 131 inputValue: e.detail.value
97 132 })
98   - console.log('bindInput' + this.data.inputValue)
99 133 }
100 134 })
littleApp_child/pages/SearchPage/SearchPage.wxml View file @ eb0f68a
... ... @@ -11,7 +11,7 @@
11 11 <view class="history_list" wx:if="{{getSearch.length > 0 && !searching}}">
12 12 <view class="history_list_content">
13 13 <block wx:for="{{getSearch}}">
14   - <navigator class="history_list_cell util_bottom_line" bindtap="selectThis">
  14 + <navigator class="history_list_cell util_bottom_line" data-text="{{item}}" bindtap="selectThis">
15 15 <image src="../../source/search_history.png" class="history_list_cell_clock"></image>
16 16 <view class="history_list_cell_text">{{item}}</view>
17 17 <image src="../../source/dele_search_history.png" class="history_list_cell_dele" bindtap="deletThis" data-index="{{index}}"></image>
18 18  
19 19  
20 20  
21 21  
... ... @@ -20,19 +20,20 @@
20 20 </view>
21 21 <view class="history_list_clearAll" bindtap="clearAll">清除历史记录</view>
22 22 </view>
  23 + <!-- <scroll-view scroll-y="true" style="height: 100%;" bindscroll="myScroll"> -->
  24 +
23 25 <view class="search_detail" wx:if="{{searching}}">
24   - <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail" hover-class="weui-cell_active" wx:for="{{list}}" wx:key="{{index}}">
  26 + <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail?titlle={{'id=' + item.id}}" hover-class="weui-cell_active" wx:for="{{list}}" wx:key="{{index}}">
25 27 <view class="content_item">
26 28 <view style="margin-left:15px;margin-right:75px;">
27 29 <view class="content_title">{{item.title}}</view>
28 30 <view class="content_content">{{item.content}}</view>
29 31 <view class="zar_box">
30 32 <image class="zar_img" src="../../source/zar.png"></image>
31   - <view class="content_zar">{{item.zar}}</view>
  33 + <view class="content_zar">{{item.likeCount ? item.likeCount : 0}}</view>
32 34 </view>
33   -
34 35 </view>
35   - <image class="content_image" src="{{item.image}}"></image>
  36 + <image class="content_image" src="{{item.image.medium}}"></image>
36 37 </view>
37 38 <view class="home__list-item__bottom"></view>
38 39 </navigator>
littleApp_child/pages/SearchPage/SearchPage.wxss View file @ eb0f68a
... ... @@ -99,4 +99,15 @@
99 99 .search_detail {
100 100 margin-top: 40px;
101 101 }
  102 +
  103 +
  104 +.content_title {
  105 +
  106 + display: inline-block;
  107 + overflow: hidden;
  108 + text-overflow: ellipsis;
  109 + display: -webkit-box;
  110 + -webkit-box-orient: vertical;
  111 + -webkit-line-clamp: 1;
  112 +}
littleApp_child/pages/articleDetail/articleDetail.js View file @ eb0f68a
... ... @@ -18,81 +18,8 @@
18 18  
19 19 /*---------生命周期--------*/
20 20 onLoad: function (options) {
21   - // 记录上层传递的信息
22   - category = options.category
23   - articleId = options.id
24   - categoryIndex = options.categoryIndex
25   - articleIdIndex = options.artIndex
26   - wx.setNavigationBarTitle({
27   - title: options.category,
28   - success: function(res) {
29   - }
30   - })
31   - networkUtil.showLoading()
32   - if(category == '健康评级') {
33   - this.requestRiskData(options.id)
34   - } else {
35   - this.requestData(options.id)
36   - }
37   - },
38   - /*---------自定义函数--------*/
39   - requestData(articleId){
40   - var self = this
41   - var imgH = wx.getSystemInfoSync().windowHeight * 0.33
42   - networkUtil._get(api.article + '/' + articleId,{},function(res){
43   - console.log(res)
44   - res.data.content = util.convertHtmlToText(res.data.content)
45   - res.data.imgH = imgH
46   - self.setData({
47   - articleDetail : res.data,
48   - category : category
49   - })
50   - },function(res){
51   -
52   - })
53   - },
54   - // 点赞
55   - articleLike(){
56   - var self = this
57   - // 已经点赞
58   - if(self.data.articleDetail.isLike == 1){
59   - networkUtil.showErrorToast('您已经点过赞啦')
60   - return;
61   - }
62   - networkUtil._post(api.articleLike,{id:articleId},function(res){
63   - console.log(res)
64   - var art = self.data.articleDetail
65   - art.likeCount ++
66   - art.isLike = 1
67   - self.setData({
68   - articleDetail : art
69   - })
70   - if(categoryIndex){
71   - // 更新首页数据
72   - event.emit('likeChanged', {categoryIndex:categoryIndex,articleIdIndex:articleIdIndex});
73   - } else {
74   - event.emit('listLikeChanged', {categoryIndex:categoryIndex,articleIdIndex:articleIdIndex});
75   - }
76   - },function(res){
77   - console.log(res)
78   - })
79   - },
80   - // 高危详情页面
81   - requestRiskData(articleId){
82   - var self = this
83 21  
84   - networkUtil._get(api.riskDetails,{id:articleId},function(res){
85   - console.log(res)
86   - res.data.content = util.convertHtmlToText(res.data.desc)
87   - res.data.imgH = '0px'
88   - self.setData({
89   - articleDetail : res.data,
90   - category : category,
91   - pageType : '2'
92   - })
93   - },function(res){
94   -
95   - })
96 22 },
  23 + /*---------自定义函数--------*/
97 24 })
littleApp_child/pages/articleDetail/articleDetail.wxml View file @ eb0f68a
1   -<!--articleDetail.wxml 文章详情-->
2 1  
3   -<view class="articleDetail" wx:if="{{articleDetail}}">
4   -<!--<view></view>-->
5   - <image class="article-image" mode="aspectFill" src="{{articleDetail.image.real}}" style="height:{{articleDetail.imgH}}px" wx:if="{{articleDetail.image.real}}"></image>
6   - <view class="article-title">{{articleDetail.title ? articleDetail.title : ''}}</view>
7   - <view class="article-type" style="margin-bottom: {{articleDetail.introduction ? 30 : 0}}px;">{{category ? category:''}}</view>
8   - <view class="article-tip" wx:if="{{articleDetail.introduction}}">{{articleDetail.introduction ? articleDetail.introduction : ''}}</view>
9   - <view class="article-line" wx:if="{{articleDetail.introduction}}"></view>
10   - <text class="article-content">{{(articleDetail.content && articleDetail.content != 'null') ? articleDetail.content : ''}}</text>
11   -
12   - <navigator class="article-like" wx:if="{{pageType == 1}}" bindtap="articleLike">
13   - <view class="article-likeview" wx:if="{{pageType == 1}}">
14   - <image class="article-likeview" src="../../source/imageSource/{{articleDetail.isLike == 2 ? 'page9_icon_big_like_h@3x.png' : 'page9_icon_big_like_n@3x.png'}}"></image>
15   - <view class="article-likenum">{{articleDetail.likeCount == null ? 0 : articleDetail.likeCount}}</view>
  2 +<!--顶部红色有头像等信息的栏目-->
  3 +<view class="TopBar">
  4 + <!--头像-->
  5 + <image class="avatar" bindtap="tapAvatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover"></image>
  6 + <!--用户名-->
  7 + <text class="userName">{{userData.username}}</text>
  8 + <!--下方黑色横条-->
  9 + <view class="infoBar">
  10 + <view class="infoView">
  11 + <text class="titleText">体检医院</text>
  12 + <text class="timeText">{{userData.checkhospital}}</text>
  13 + </view>
  14 + <view class="infoView">
  15 + <text class="titleText">月龄</text>
  16 + <text class="timeText">{{userData.monthage ? userData.monthage : '-'}}</text>
  17 + <view class="lineView"></view>
  18 + </view>
  19 + <view class="infoView">
  20 + <text class="titleText">健康状况</text>
  21 + <text class="timeText">{{userData.hstatus}}</text>
  22 + </view>
16 23 </view>
17   - </navigator>
18   -
  24 + <!--下方黑色横条-->
19 25 </view>
littleApp_child/pages/articleDetail/articleDetail.wxss View file @ eb0f68a
1   -/**articleDetail.wxss 文章详情**/
  1 +/*顶部模块*/
  2 +.TopBar {
  3 + width:100%;
  4 + height:202px;
  5 +}
2 6  
3   -.articleDetail{
4   - display: flex;
5   - flex-direction: column;
6   - background: white
  7 +.promptText {
  8 + background: #f4879b;
  9 + font: bold;
  10 + text-align: center;
  11 + font-size: 10px;
  12 + color: white;
7 13 }
8 14  
9   -.article-image{
10   - width: 100%;
  15 +.TopBgImage {
  16 + width:100%;
  17 + height:202px;
  18 + position: absolute;
  19 + background: #48C17B;
11 20 }
12   -.article-title{
13   - font: medium bold;
14   - font-size: 24px;
15   - margin: 60rpx 60rpx 30rpx 60rpx;
16   - color: black
  21 +
  22 +.avatar {
  23 + width:70px;
  24 + height:70px;
  25 + border-radius: 50%;
  26 + position: absolute;
  27 + top: 15px;
  28 + left: 50%;
  29 + transform: translateX(-50%);
  30 + border: 3px solid white;
  31 + box-shadow: 0 2px 4px 0 rgba(186,70,70,0.50);
17 32 }
18   -.article-type{
19   - font: medium;
20   - font-size: 16px;
21   - color: #ee7289;
22   - margin-right: 30px;
23   - margin-left: 30px;
24   -}
25   -.article-tip{
26   - margin: 0rpx 90rpx 60rpx 90rpx;
27   - color: #979797;
28   - line-height: 25px;
29   - font-size: 15px;
30   - text-align: center;
31   -}
32   -.article-line{
33   - width: 300rpx;
34   - height: 2rpx;
35   - background: #d8dbd4;
36   - margin-left: 50%;
  33 +
  34 +.userName {
  35 + font-size: 14px;
  36 + font-weight: bold;
  37 + display: block;
  38 + top: 100px;
  39 + position: absolute;
  40 + /*居中*/
  41 + left: 50%;
37 42 transform: translateX(-50%);
38 43 }
39   -.article-content{
40   - margin: 0rpx 40rpx 0rpx 40rpx;
41   - font: lighter;
42   - font-size: 18px;
43   - line-height: 27px;
44   - /*letter-spacing: 3rpx;*/
45   - text-indent: 2em;
46   - white-space: normal;
  44 +
  45 +.documentView {
  46 + position: absolute;
  47 + top: 0px;
  48 + left: 0px;
  49 + right: 0px;
  50 + bottom: 0px;
47 51 }
48   -.article-like{
49   - width: 150rpx;
50   - height: 150rpx;
51   - border-radius: 100rpx;
52   - margin-left: 50%;
53   - transform: translateX(-50%);
  52 +
  53 +/*上方信息条部分*/
  54 +.infoBar {
  55 + width: 100%;
  56 + height: 60px;
  57 + top: 142px;
  58 + position: absolute;
  59 +}
  60 +
  61 +.infoView {
  62 + text-align: center;
  63 + width: 33.3%;
  64 + height: 100%;
  65 + display:inline-block;
  66 + box-sizing: border-box;
54 67 position: relative;
55   - margin-bottom: 150rpx;
56   - margin-top: 100rpx;
  68 + background-color: rgba(255, 255, 255, 0.1);
57 69 }
58   -.article-likeview{
59   - width: 150rpx;
60   - height: 150rpx;
61   -}
62   -.article-likenum{
63   - margin-left: 50%;
64   - transform: translateX(-50%);
  70 +
  71 +.lineView {
  72 + width: 100%;
  73 + border-right: solid rgba(255, 255, 255, 0.7) 0.5px;
  74 + border-left: solid rgba(255, 255, 255, 0.7) 0.5px;
  75 + height: 40px;
65 76 position: absolute;
66   - bottom: 30rpx;
67   - font: medium;
68   - line-height: 28rpx;
69   - font-size: 28rpx;
70   - color: white
  77 + top: 10px;
  78 +}
  79 +
  80 +.titleText {
  81 + margin-top: 12px;
  82 + display:block;
  83 + font-size: 11px;
  84 +color: #D8FCE7;
  85 +}
  86 +
  87 +.timeText {
  88 + font-family: PingFangSC-Medium;
  89 + font-size: 12px;
  90 + color: #FFFFFF;
  91 + display:block;
  92 + margin-top: 2px;
71 93 }
littleApp_child/pages/articleLists/articleLists.js View file @ eb0f68a
... ... @@ -8,9 +8,8 @@
8 8 // 是否有更多
9 9 var hasMore
10 10 var isRefresh
11   -// 高危指导页面
12   -var isRisk
13 11  
  12 +
14 13 Page({
15 14 data: {
16 15 list:[],
17 16  
18 17  
19 18  
... ... @@ -18,26 +17,22 @@
18 17 category:''
19 18 },
20 19 onLoad: function (e) {
21   - this.data.id = e.id
  20 + this.data.id = e.categoryId
22 21 this.data.category = e.category
  22 + console.log(e.categoryId)
23 23 // 数据初始化
24 24 page = 1
25 25 hasMore = true
26 26 isRefresh = false
27   - isRisk = false
28 27  
29 28 wx.setNavigationBarTitle({
30 29 title: e.category,
31 30 success: function(res) {
32 31 }
33 32 })
34   - if(e.category == '高危精准指导'){
35   - isRisk = true
36   - this.requestRisk()
37   - } else {
38   - isRisk = false
39   - this.requestData()
40   - }
  33 + // this.setData({})
  34 +
  35 + this.requestData()
41 36 // 监听事件
42 37 event.on('listLikeChanged', this, function(data) {
43 38 var artList = this.data.list
... ... @@ -63,11 +58,7 @@
63 58 return
64 59 }
65 60 page ++
66   - if(isRisk == true){
67   - this.requestRisk()
68   - } else {
69   - this.requestData()
70   - }
  61 + this.requestData()
71 62 },
72 63 // 下拉刷新回调接口
73 64 onPullDownRefresh: function() {
74 65  
75 66  
... ... @@ -86,18 +77,18 @@
86 77 var self = this
87 78 isRefresh = true
88 79 networkUtil.showLoading()
89   - var param = {page:page,limit:15,type:getApp().globalData.userInfo.status,categoryId:self.data.id}
90   - networkUtil._get(api.articleList,param,function(res){
91   -
  80 + var param = { page: page, limit: 15, type: 2, days: getApp().globalData.days,categoryId:self.data.id}
  81 + networkUtil._get(api.articles,param,function(res){
  82 + console.log(res)
92 83 isRefresh = false
93 84 var arr = []
94 85 if(page > 0) {// 加载更多模式
95 86 arr = self.data.list
96 87 }
97   - if(res.data.data.length < 15){
  88 + if(res.data.list.length < 15){
98 89 hasMore = false
99 90 }
100   - arr = arr.concat(res.data.data)
  91 + arr = arr.concat(res.data.list)
101 92 var temp = self.data.category
102 93 self.setData({
103 94 list:arr,
littleApp_child/pages/articleLists/articleLists.wxml View file @ eb0f68a
... ... @@ -16,14 +16,14 @@
16 16 </view>
17 17 <view class="home__list-item__bottom"></view>
18 18 </navigator> -->
19   - <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail" wx:for="{{list}}" wx:key="{{index}}">
  19 + <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail?titlle={{'id=' + item.id + '&category=' + category}}" wx:for="{{list}}" wx:key="{{index}}">
20 20 <view class="content_item">
21 21 <view style="margin-left:15px;margin-right:75px;">
22   - <view class="content_title">{{item.title}}111</view>
23   - <view class="content_content">{{item.introduction}}111</view>
  22 + <view class="content_title">{{item.title}}</view>
  23 + <view class="content_content">{{item.introduction}}</view>
24 24 <view class="zar_box">
25 25 <image class="zar_img" src="../../source/zar.png"></image>
26   - <view class="content_zar">{{item.likeCount}}11</view>
  26 + <view class="content_zar">{{item.likeCount ? item.likeCount : 0}}</view>
27 27 </view>
28 28 </view>
29 29 <image class="content_image" src="{{item.image.medium}}"></image>
littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.js View file @ eb0f68a
... ... @@ -4,37 +4,36 @@
4 4 var api = require('../../utils/apiFile.js')
5 5 // 事件监听
6 6 var event = require('../../utils/event.js')
7   -var page
8   -// 是否有更多
9   -var hasMore
10   -var isRefresh
  7 +var util = require('../../utils/util.js')
11 8  
12 9  
13 10 Page({
14 11 data: {
15 12  
16   - knowledge: { time: "2017-8-7", likeCount: 12, title: "title1", content: "content1content1content1content1content1content1content1content1content1content1content1ds到场定损", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" },
  13 + knowledge: { time: "", likeCount: 0, title: "", content: "", image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" },
17 14 images: [
18 15 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
19   - 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
20   - 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
21 16 ],
22 17 titles: ["日常护理", "营养美食", "疾病护理", "亲子互动", "言传qq"],
23 18 id: 0,
24 19 category: '',
25 20 current_index: 0,
  21 + title:''
26 22 },
27   - onLoad: function (e) {
28   - this.data.id = e.id
29   - this.data.category = e.category
30   - // 数据初始化
31   - page = 1
32   - hasMore = true
33   - isRefresh = false
34   -
35   - // this.requestData()
36   -
37   -
  23 + onLoad: function (options) {
  24 + // this.data.id = e.id
  25 + // this.data.category = e.category
  26 + // 记录上层传递的信息
  27 + // category = options.category
  28 + // articleId = options.id
  29 + // categoryIndex = options.categoryIndex
  30 + // articleIdIndex = options.artIndex
  31 + wx.setNavigationBarTitle({
  32 + title: options.category,
  33 + success: function (res) {
  34 + }
  35 + })
  36 + this.requestData(options.id)
38 37 },
39 38 onUnload: function () {
40 39  
41 40  
42 41  
... ... @@ -77,28 +76,16 @@
77 76 /*---------自定义函数--------*/
78 77 requestData(id) {
79 78 var self = this
80   - isRefresh = true
81 79 networkUtil.showLoading()
82   - var param = { page: page, limit: 15, type: getApp().globalData.userInfo.status, categoryId: self.data.id }
83   - networkUtil._get(api.articleList, param, function (res) {
84   -
85   - isRefresh = false
86   - var arr = []
87   - if (page > 0) {// 加载更多模式
88   - arr = self.data.list
89   - }
90   - if (res.data.data.length < 15) {
91   - hasMore = false
92   - }
93   - arr = arr.concat(res.data.data)
94   - var temp = self.data.category
95   - self.setData({
96   - list: arr,
97   - hasMore: hasMore,
98   - category: temp
99   - })
  80 + // var param = { page: page, limit: 15, type: 2, categoryId: self.data.id }
  81 + networkUtil._get(api.articles + '/' + id, {}, function (res) {
  82 + console.log('数据-----',res)
  83 + res.data.content = util.convertHtmlToText(res.data.content)
  84 + self.setData({
  85 + knowledge: res.data
  86 + })
100 87 }, function (res) {
101   - isRefresh = false
  88 +
102 89 })
103 90 },
104 91  
littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.wxml View file @ eb0f68a
... ... @@ -4,15 +4,15 @@
4 4 <view class="zar_box" style="margin-left:8px;">
5 5 <view class="zar_box">
6 6 <image class="zar_img" src="../../source/zar.png"></image>
7   - <view class="content_zar">{{knowledge.likeCount}}</view>
  7 + <view class="content_zar">{{knowledge.likeCount ? knowledge.likeCount : 0}}</view>
8 8 </view>
9 9 <view class="content_time">{{knowledge.time}}</view>
10 10 </view>
11 11  
12 12 <swiper hidden="{{images.length > 0 ? false : true}}" class="swiper" indicator-dots="true" indicator-active-color="#ffffff">
13   - <block wx:for="{{images}}">
  13 + <block wx:for="{{[knowledge.image]}}">
14 14 <swiper-item>
15   - <image src="{{item}}"></image>
  15 + <image src="{{item.medium}}"></image>
16 16 </swiper-item>
17 17 </block>
18 18 </swiper>
littleApp_child/pages/home/home.js View file @ eb0f68a
... ... @@ -143,7 +143,7 @@
143 143  
144 144 var self = this
145 145 var param = { 'token': app.globalData.token }
146   - networkUtil._get(api.userInfo + app.globalData.userId, {}, function (res) {
  146 + networkUtil._get(api.userInfo + app.globalData.userId[0], {}, function (res) {
147 147 console.log('获取用户信息',res)
148 148 app.globalData.days = res.data.data.days
149 149 self.getArticleInfo(res.data.data.days)
150 150  
... ... @@ -260,11 +260,11 @@
260 260 },
261 261 loginSuccess(data) {
262 262 wx.setStorageSync('userToken', data.token)
263   - wx.setStorageSync('userId', data.id)
  263 + wx.setStorageSync('userId', data.patientIds)
264 264 wx.setStorageSync('hxName', data.hxName)
265 265 wx.setStorageSync('hxPassWord', data.hxPassWord)
266 266 getApp().globalData.token = data.token
267   - getApp().globalData.userId = data.id
  267 + getApp().globalData.userId = data.patientIds
268 268 this.homePage()
269 269 }
270 270  
littleApp_child/pages/home/home.wxml View file @ eb0f68a
... ... @@ -9,7 +9,7 @@
9 9 <!--顶部红色有头像等信息的栏目-->
10 10 <view class="TopBar">
11 11 <!--头像-->
12   - <image class="avatar" bindtap="tapAvatar" src="{{avatar ? avatar : '../../source/test.png'}}" background-size="cover"></image>
  12 + <image class="avatar" bindtap="tapAvatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover"></image>
13 13 <!--用户名-->
14 14 <text class="userName">{{userData.username}}</text>
15 15 <!--下方黑色横条-->
... ... @@ -20,7 +20,7 @@
20 20 </view>
21 21 <view class="infoView">
22 22 <text class="titleText">月龄</text>
23   - <text class="timeText">{{userData.monthage}}</text>
  23 + <text class="timeText">{{userData.monthage ? userData.monthage : '-'}}</text>
24 24 <view class="lineView"></view>
25 25 </view>
26 26 <view class="infoView">
27 27  
... ... @@ -53,32 +53,34 @@
53 53 </view>
54 54  
55 55 <!--文章列表-->
56   - <view class="article_list">
57   - <block wx:for="{{list}}" wx:for-index="sectionIndex" wx:for-item="sectionItem">
58   - <view class="article_bg">
59   - <navigator url="../articleLists/articleLists" class="navigator_class">
60   - <image class="article_title_image"></image>
61   - <view class="article_title">{{sectionItem.title}}</view>
62   - <image class="article_title_indicator" mode="aspectFit" src="../../source/gengduo.png"></image>
63   - </navigator>
64   - <block wx:for="{{sectionItem.article}}">
65   - <navigator class="article_content" url="../childcare_knowledge_detail/childcare_knowledge_detail">
66   - <view style="height:6px;width:100%;"></view>
67   - <view class="article_content_title">{{item.title}}</view>
68   - <label class="article_content_text">{{item.introduction}}</label>
69   - <image class="article_content_image" src="{{item.image.medium}}"></image>
70   - <view class="article_content_bottomBar">
71   - <!-- <view class="article_content_bottomBar_labels">
72   - </view> -->
73   - <view class="article_content_bottomBar_likes">
74   - <image class="article_content_bottomBar_likes_icon" src="../../source/like.png"></image>
75   - <label class="article_content_bottomBar_likes_text">{{item.likeCount ? item.likeCount : 0}}</label>
76   - </view>
77   - </view>
  56 + <view class="article_list_bg">
  57 + <view class="article_list">
  58 + <block wx:for="{{list}}" wx:for-index="sectionIndex" wx:for-item="sectionItem">
  59 + <view class="article_bg">
  60 + <navigator url="../articleLists/articleLists?categoryId={{sectionItem.id + '&category=' + sectionItem.title}}" class="navigator_class util_bottom_line">
  61 + <image class="article_title_image"></image>
  62 + <view class="article_title">{{sectionItem.title}}</view>
  63 + <image class="article_title_indicator" mode="aspectFit" src="../../source/gengduo.png"></image>
78 64 </navigator>
79   - </block>
80   - </view>
81   - </block>
  65 + <block wx:for="{{sectionItem.article}}">
  66 + <navigator class="article_content" url="../childcare_knowledge_detail/childcare_knowledge_detail?id={{item.id + '&category=' + sectionItem.title}}">
  67 + <view style="height:6px;width:100%;"></view>
  68 + <view class="article_content_title">{{item.title}}</view>
  69 + <label class="article_content_text">{{item.introduction}}</label>
  70 + <image class="article_content_image" src="{{item.image.medium}}"></image>
  71 + <view class="article_content_bottomBar util_bottom_line">
  72 + <!-- <view class="article_content_bottomBar_labels">
  73 + </view> -->
  74 + <view class="article_content_bottomBar_likes">
  75 + <image class="article_content_bottomBar_likes_icon" src="../../source/like.png"></image>
  76 + <label class="article_content_bottomBar_likes_text">{{item.likeCount ? item.likeCount : 0}}</label>
  77 + </view>
  78 + </view>
  79 + </navigator>
  80 + </block>
  81 + </view>
  82 + </block>
  83 + </view>
82 84 </view>
83 85 </view>
84 86  
... ... @@ -125,8 +127,8 @@
125 127 <view class="backgroundView" style="background: white" wx:if="{{pageType == 1}}">
126 128 <form catchsubmit="formSubmit">
127 129  
128   - <view class="record-input-constainer">
129   - <view class="record-input_bg" style="border-color:{{inputFocus.nameInput ? '#f4879b' : '#e8eae5'}}">
  130 + <view class="record-input-constainer whiteColor">
  131 + <view class="record-input_bg whiteColor" style="border-color:{{inputFocus.nameInput ? '#f4879b' : '#e8eae5'}}">
130 132 <label class="record-input_title">姓名</label>
131 133 <input class="input" id="name" name="name" maxlength="12" placeholder="请输入建档姓名" value="小向阳" placeholder-class="input-placeholder" bindfocus="getFocus" bindblur="blurNameInput"/>
132 134 </view>
littleApp_child/pages/home/home.wxss View file @ eb0f68a
1 1 @import "css/AboutPage.wxss";
2 2 @import "css/login.wxss";
3 3 /*通用*/
4   -text {
5   - font-size: 11px;
6   - color: #ffffff;
7   -}
8 4  
9 5 /*顶部模块*/
10 6 .TopBar {
... ... @@ -48,6 +44,7 @@
48 44 /*居中*/
49 45 left: 50%;
50 46 transform: translateX(-50%);
  47 + color: white;
51 48 }
52 49  
53 50 .documentView {
54 51  
... ... @@ -150,9 +147,13 @@
150 147 }
151 148  
152 149 /*---------文章列表---------*/
  150 +.article_list_bg {
  151 + width: 100%;
  152 + background: #F4F4F4;
  153 +}
  154 +
153 155 .article_list {
154   -
155   - /* background: red; */
  156 + background: #F4F4F4;
156 157 margin-left: 5px;
157 158 margin-right: 5px;
158 159 margin-top: 11px;
... ... @@ -183,9 +184,9 @@
183 184 .article_title_indicator {
184 185 width: 12px;
185 186 height: 14px;
186   - float: right;
187   - margin-right: 10px;
188   - margin-top: 10px;
  187 + position: absolute;
  188 + right: 15px;
  189 + transform: translateY(8px);
189 190 }
190 191 /* 文章ne内容背景 */
191 192 .article_content {
littleApp_child/utils/apiFile.js View file @ eb0f68a
... ... @@ -11,6 +11,8 @@
11 11 // 首页文章列表
12 12 homeArtList:'baby/categories',
13 13 //育儿知识分类列表
14   - articles:'v1/articles'
  14 + articles:'v1/articles',
  15 + //搜索
  16 + search:'/v1/search'
15 17 }
littleApp_child/utils/util_UI.wxss View file @ eb0f68a
... ... @@ -54,4 +54,8 @@
54 54 .util_bottom_line {
55 55 border-bottom: 1px solid #e2e2e2;
56 56 }
  57 +
  58 +.whiteColor {
  59 + background: white;
  60 +}