Commit 672be4d57e331e408b322fa25f76d7bf8bb91825
Exists in
master
and in
2 other branches
Merge branch 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child
Showing 3 changed files
littleApp_child/pages/home/home.js
View file @
672be4d
| ... | ... | @@ -26,9 +26,12 @@ |
| 26 | 26 | // 首页类型 1登录 2用户首页 3欢迎页 |
| 27 | 27 | pageType: 0, |
| 28 | 28 | time: '0s', |
| 29 | + list:[], | |
| 30 | + userInfo:'' | |
| 29 | 31 | }, |
| 30 | 32 | /*---------生命周期--------*/ |
| 31 | 33 | onLoad: function () { |
| 34 | + this.calculatePageSize() | |
| 32 | 35 | var isFirst = wx.getStorageSync('isFirst') |
| 33 | 36 | // 网络监听 |
| 34 | 37 | this.networkStatusChange() |
| 35 | 38 | |
| 36 | 39 | |
| ... | ... | @@ -37,10 +40,11 @@ |
| 37 | 40 | this.welcomePage() |
| 38 | 41 | } else { |
| 39 | 42 | if (app.globalData.token == null || app.globalData.token == '') { |
| 40 | - this.loginPage() | |
| 43 | + this.toLogin() | |
| 44 | + console.log('登录页面--') | |
| 41 | 45 | } else { |
| 46 | + console.log('shouye页面--') | |
| 42 | 47 | networkUtil.showLoading() |
| 43 | - | |
| 44 | 48 | this.homePage() |
| 45 | 49 | // 监听事件 |
| 46 | 50 | event.on('likeChanged', this, function (data) { |
| ... | ... | @@ -118,7 +122,7 @@ |
| 118 | 122 | var smallWidth = ((windowWidth - 10) / 2 - 10) |
| 119 | 123 | this.setData({ |
| 120 | 124 | item_big_height: 'height:' + windowWidth / 4 + 'px', |
| 121 | - item_small: 'width:' + smallWidth / 2 + 'px;height:' + smallWidth / 2 + 'px', | |
| 125 | + item_small: 'width:' + windowWidth / 4 * 0.45 + 'px;height:' + windowWidth / 4 * 0.45 + 'px', | |
| 122 | 126 | }) |
| 123 | 127 | }, |
| 124 | 128 | // 监听网络状态 |
| ... | ... | @@ -141,6 +145,10 @@ |
| 141 | 145 | var param = { 'token': app.globalData.token } |
| 142 | 146 | networkUtil._get(api.userInfo + app.globalData.userId, {}, function (res) { |
| 143 | 147 | console.log('获取用户信息',res) |
| 148 | + self.getArticleInfo(res.data.data.days) | |
| 149 | + self.setData({ | |
| 150 | + userData: res.data.data | |
| 151 | + }) | |
| 144 | 152 | }, function (res) { |
| 145 | 153 | networkUtil.showErrorToast(res.errormsg) |
| 146 | 154 | }) |
| ... | ... | @@ -149,6 +157,10 @@ |
| 149 | 157 | var self = this |
| 150 | 158 | // 文章列表 |
| 151 | 159 | networkUtil._get(api.homeArtList, { page: 0, limit: 100, days: days }, function (res) { |
| 160 | + console.log('获取文章信息', res.data.list) | |
| 161 | + self.setData({ | |
| 162 | + list: res.data.list | |
| 163 | + }) | |
| 152 | 164 | }, function (res) { |
| 153 | 165 | wx.stopPullDownRefresh() |
| 154 | 166 | }) |
| ... | ... | @@ -190,8 +202,6 @@ |
| 190 | 202 | // }) |
| 191 | 203 | // return |
| 192 | 204 | // } |
| 193 | - | |
| 194 | - | |
| 195 | 205 | }, |
| 196 | 206 | // 计时器 |
| 197 | 207 | keepTime: function () { |
littleApp_child/pages/home/home.wxml
View file @
672be4d
| ... | ... | @@ -11,21 +11,21 @@ |
| 11 | 11 | <!--头像--> |
| 12 | 12 | <image class="avatar" bindtap="tapAvatar" src="{{avatar ? avatar : '../../source/test.png'}}" background-size="cover"></image> |
| 13 | 13 | <!--用户名--> |
| 14 | - <text class="userName">{{username}}</text> | |
| 14 | + <text class="userName">{{userData.username}}</text> | |
| 15 | 15 | <!--下方黑色横条--> |
| 16 | 16 | <view class="infoBar"> |
| 17 | 17 | <view class="infoView"> |
| 18 | 18 | <text class="titleText">体检医院</text> |
| 19 | - <text class="timeText">{{week}}青黄岛</text> | |
| 19 | + <text class="timeText">{{userData.checkhospital}}</text> | |
| 20 | 20 | </view> |
| 21 | 21 | <view class="infoView"> |
| 22 | 22 | <text class="titleText">月龄</text> |
| 23 | - <text class="timeText">{{nextCheckTime}}1岁半</text> | |
| 23 | + <text class="timeText">{{userData.monthage}}</text> | |
| 24 | 24 | <view class="lineView"></view> |
| 25 | 25 | </view> |
| 26 | 26 | <view class="infoView"> |
| 27 | 27 | <text class="titleText">健康状况</text> |
| 28 | - <text class="timeText">{{intervalDays}}未知</text> | |
| 28 | + <text class="timeText">{{userData.hstatus}}</text> | |
| 29 | 29 | </view> |
| 30 | 30 | </view> |
| 31 | 31 | <!--下方黑色横条--> |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| ... | ... | @@ -35,46 +35,50 @@ |
| 35 | 35 | <!--功能模块--> |
| 36 | 36 | <view class="foundation_BG" style="{{item_big_height}}"> |
| 37 | 37 | <navigator class="foundation_item_small" url="../inspectionReport/inspectionReport"> |
| 38 | - <image src="../../source/jianchajilu.png" class="foundation_item_small_image"></image> | |
| 38 | + <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
| 39 | 39 | <view class="foundation_item_small_text">儿保检查记录</view> |
| 40 | 40 | </navigator> |
| 41 | 41 | <navigator class="foundation_item_small" url="../childcare_knowledge/childcare_knowledge"> |
| 42 | - <image src="../../source/except.png" class="foundation_item_small_image"></image> | |
| 42 | + <image src="../../source/except.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
| 43 | 43 | <view class="foundation_item_small_text">育儿百科</view> |
| 44 | 44 | </navigator> |
| 45 | 45 | <navigator class="foundation_item_small" url="../childcare_knowledge/childcare_knowledge"> |
| 46 | - <image src="../../source/yuerzhishi.png" class="foundation_item_small_image"></image> | |
| 46 | + <image src="../../source/yuerzhishi.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
| 47 | 47 | <view class="foundation_item_small_text">育儿知识</view> |
| 48 | 48 | </navigator> |
| 49 | 49 | <navigator class="foundation_item_small" url="../system_notifacations/system_notifacations"> |
| 50 | - <image src="../../source/xiaoxitongzhi.png" class="foundation_item_small_image"></image> | |
| 50 | + <image src="../../source/xiaoxitongzhi.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
| 51 | 51 | <view class="foundation_item_small_text">消息通知</view> |
| 52 | 52 | </navigator> |
| 53 | 53 | </view> |
| 54 | 54 | |
| 55 | 55 | <!--文章列表--> |
| 56 | 56 | <view class="article_list"> |
| 57 | + <block wx:for="{{list}}" wx:for-index="sectionIndex" wx:for-item="sectionItem"> | |
| 57 | 58 | <view class="article_bg"> |
| 58 | 59 | <navigator url="../childcare_knowledge/childcare_knowledge" class="navigator_class"> |
| 59 | 60 | <image class="article_title_image"></image> |
| 60 | - <view class="article_title">日常护理</view> | |
| 61 | - <image class="article_title_indicator" src="../../source/gengduo.png"></image> | |
| 61 | + <view class="article_title">{{sectionItem.title}}</view> | |
| 62 | + <image class="article_title_indicator" mode="aspectFit" src="../../source/gengduo.png"></image> | |
| 62 | 63 | </navigator> |
| 63 | - <navigator class="article_content" url="../childcare_knowledge_detail/childcare_knowledge_detail"> | |
| 64 | - <view style="height:6px;width:100%;"></view> | |
| 65 | - <view class="article_content_title">如何提防新生儿败血症</view> | |
| 66 | - <label class="article_content_text">败血症(septicemia)的意</label> | |
| 67 | - <image class="article_content_image" src="../../source/test.png"></image> | |
| 68 | - <view class="article_content_bottomBar"> | |
| 69 | - <!-- <view class="article_content_bottomBar_labels"> | |
| 70 | - </view> --> | |
| 71 | - <view class="article_content_bottomBar_likes"> | |
| 72 | - <image class="article_content_bottomBar_likes_icon" src="../../source/like.png"></image> | |
| 73 | - <label class="article_content_bottomBar_likes_text">111</label> | |
| 74 | - </view> | |
| 75 | - </view> | |
| 76 | - </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}}</label> | |
| 76 | + </view> | |
| 77 | + </view> | |
| 78 | + </navigator> | |
| 79 | + </block> | |
| 77 | 80 | </view> |
| 81 | + </block> | |
| 78 | 82 | </view> |
| 79 | 83 | </view> |
| 80 | 84 | |
| 81 | 85 | |
| ... | ... | @@ -124,11 +128,11 @@ |
| 124 | 128 | <view class="record-input-constainer"> |
| 125 | 129 | <view class="record-input_bg" style="border-color:{{inputFocus.nameInput ? '#f4879b' : '#e8eae5'}}"> |
| 126 | 130 | <label class="record-input_title">姓名</label> |
| 127 | - <input class="input" id="name" name="name" maxlength="12" placeholder="请输入建档姓名" value="" placeholder-class="input-placeholder" bindfocus="getFocus" bindblur="blurNameInput"/> | |
| 131 | + <input class="input" id="name" name="name" maxlength="12" placeholder="请输入建档姓名" value="小向阳" placeholder-class="input-placeholder" bindfocus="getFocus" bindblur="blurNameInput"/> | |
| 128 | 132 | </view> |
| 129 | 133 | <view class="record-input_bg" style="margin-top:15px;border-color:{{inputFocus.phoneInput ? '#f4879b' : '#e8eae5'}}"> |
| 130 | 134 | <label class="record-input_title">手机号</label> |
| 131 | - <input class="input" id="phone" name="phone" type="number" placeholder="请输入建档手机号" maxlength="11" placeholder-class="input-placeholder" bindfocus="getFocus" value="" bindblur="blurInput" /> | |
| 135 | + <input class="input" id="phone" name="phone" type="number" placeholder="请输入建档手机号" maxlength="11" placeholder-class="input-placeholder" bindfocus="getFocus" value="18202810912" bindblur="blurInput" /> | |
| 132 | 136 | </view> |
| 133 | 137 | |
| 134 | 138 | <view class="code_view"> |
littleApp_child/pages/home/home.wxss
View file @
672be4d
| ... | ... | @@ -137,8 +137,8 @@ |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | .foundation_item_small_image { |
| 140 | - height: 45%; | |
| 141 | - width: 45%; | |
| 140 | + /* height: 45%; | |
| 141 | + width: 45%; */ | |
| 142 | 142 | margin-top: 3px; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| ... | ... | @@ -151,14 +151,16 @@ |
| 151 | 151 | |
| 152 | 152 | /*---------文章列表---------*/ |
| 153 | 153 | .article_list { |
| 154 | - border-radius: 4px; | |
| 155 | - background: white; | |
| 154 | + | |
| 155 | + /* background: red; */ | |
| 156 | 156 | margin-left: 5px; |
| 157 | 157 | margin-right: 5px; |
| 158 | 158 | margin-top: 11px; |
| 159 | 159 | } |
| 160 | 160 | .article_bg { |
| 161 | 161 | margin-bottom: 10px; |
| 162 | + border-radius: 4px; | |
| 163 | + background: white | |
| 162 | 164 | } |
| 163 | 165 | /* 栏目标题前面图 */ |
| 164 | 166 | .article_title_image { |
| 165 | 167 | |
| ... | ... | @@ -179,11 +181,11 @@ |
| 179 | 181 | } |
| 180 | 182 | /* 箭头 */ |
| 181 | 183 | .article_title_indicator { |
| 182 | - width: 5.5px; | |
| 183 | - height: 10.2px; | |
| 184 | + width: 12px; | |
| 185 | + height: 14px; | |
| 184 | 186 | float: right; |
| 185 | 187 | margin-right: 10px; |
| 186 | - margin-top: 12px; | |
| 188 | + margin-top: 10px; | |
| 187 | 189 | } |
| 188 | 190 | /* 文章ne内容背景 */ |
| 189 | 191 | .article_content { |