Commit 5aedd9a6bdf3a34bd0cf6d7b6e3ad74bc147df79
1 parent
bfb2303f52
Exists in
master
and in
2 other branches
高危
Showing 11 changed files with 453 additions and 10 deletions
- littleApp_child/app.json
- littleApp_child/pages/CheckReport/CheckReport.js
- littleApp_child/pages/Setting/Setting.wxml
- littleApp_child/pages/home/home.wxml
- littleApp_child/pages/risk_guide/risk_guide.js
- littleApp_child/pages/risk_guide/risk_guide.json
- littleApp_child/pages/risk_guide/risk_guide.wxml
- littleApp_child/pages/risk_guide/risk_guide.wxss
- littleApp_child/source/risk_guide.png
- littleApp_child/utils/AnalysisBluetooth.js
- littleApp_child/utils/network_util.js
littleApp_child/app.json
View file @
5aedd9a
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | "pages/hospitalList/hospitalList", |
| 21 | 21 | "pages/childcare_knowledge_detail/childcare_knowledge_detail", |
| 22 | 22 | "pages/system_notifacations/system_notifacations", |
| 23 | - | |
| 23 | + "pages/risk_guide/risk_guide", | |
| 24 | 24 | "pages/childcare_knowledge/childcare_knowledge", |
| 25 | 25 | "pages/CompleteTouristInfo/CompleteTouristInfo", |
| 26 | 26 | "pages/vipService/vipService", |
littleApp_child/pages/CheckReport/CheckReport.js
View file @
5aedd9a
littleApp_child/pages/Setting/Setting.wxml
View file @
5aedd9a
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <!--用户名--> |
| 3 | 3 | <view class="top_baseInfo"> |
| 4 | 4 | <!--头像--> |
| 5 | - <image class="top_baseInfo_avatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover" bindtap="selectPhoto"></image> | |
| 5 | + <image class="top_baseInfo_avatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover" bindtap=""></image> | |
| 6 | 6 | <view class="top_baseInfo_userName"> |
| 7 | 7 | <view class="name">{{userData.username}}</view> |
| 8 | 8 | <view class="phone">{{userData.phone}}</view> |
littleApp_child/pages/home/home.wxml
View file @
5aedd9a
| ... | ... | @@ -60,14 +60,14 @@ |
| 60 | 60 | <image src="../../source/yuerzhishi.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
| 61 | 61 | <view class="foundation_item_small_text">育儿知识</view> |
| 62 | 62 | </navigator> |
| 63 | + <navigator class="foundation_item_small" url="../risk_guide/risk_guide"> | |
| 64 | + <image src="../../source/risk_guide.png" style="{{item_small}};margin-top:5px;" class="foundation_item_small_image"></image> | |
| 65 | + <view class="foundation_item_small_text">精准指导</view> | |
| 66 | + </navigator> | |
| 63 | 67 | <navigator class="foundation_item_small" url="../system_notifacations/system_notifacations"> |
| 64 | 68 | <image src="../../source/xiaoxitongzhi.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
| 65 | 69 | <view class="foundation_item_small_text">消息通知</view> |
| 66 | 70 | </navigator> |
| 67 | - <!-- <navigator class="foundation_item_small" url="../Setting/Setting"> | |
| 68 | - <image src="../../source/except.png" style="{{item_small}};margin-top:5px;" class="foundation_item_small_image"></image> | |
| 69 | - <view class="foundation_item_small_text">设置</view> | |
| 70 | - </navigator> --> | |
| 71 | 71 | </view> |
| 72 | 72 | |
| 73 | 73 | <!--文章列表--> |
littleApp_child/pages/risk_guide/risk_guide.js
View file @
5aedd9a
| 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 | +var app = getApp() | |
| 13 | + | |
| 14 | +var pageLimit=15 | |
| 15 | +var animation1 = wx.createAnimation({ | |
| 16 | + duration:1000 | |
| 17 | +}) | |
| 18 | +Page({ | |
| 19 | + data: { | |
| 20 | + list: [], | |
| 21 | + images: {}, | |
| 22 | + titles: [],//"日常护理", "营养美食", "疾病护理", "亲子互动", "言传身教" | |
| 23 | + category:'', | |
| 24 | + current_index:0, | |
| 25 | + animationData:{}, | |
| 26 | + swiperHeight:0 | |
| 27 | + }, | |
| 28 | + onLoad: function (e) { | |
| 29 | + // 数据初始化 | |
| 30 | + var self = this | |
| 31 | + page = 1 | |
| 32 | + hasMore = true | |
| 33 | + isRefresh = false | |
| 34 | + this.setData({ | |
| 35 | + titles: app.globalData.artList, | |
| 36 | + category: app.globalData.artList[self.data.current_index].id, | |
| 37 | + images: app.globalData.artList[self.data.current_index].iconimage, | |
| 38 | + swiperHeight: wx.getSystemInfoSync().windowWidth * 0.42 | |
| 39 | + }) | |
| 40 | + this.requestData() | |
| 41 | + | |
| 42 | + | |
| 43 | + }, | |
| 44 | + onUnload: function() { | |
| 45 | + | |
| 46 | + }, | |
| 47 | + /*---------事件处理函数--------*/ | |
| 48 | + bindViewTap: function() { | |
| 49 | + wx.navigateTo({ | |
| 50 | + url: '../home/home' | |
| 51 | + }) | |
| 52 | + }, | |
| 53 | + // 加载更多 | |
| 54 | + loadMore:function(){ | |
| 55 | + | |
| 56 | + console.log("hasMore:", hasMore) | |
| 57 | + if(!hasMore || isRefresh == true){ | |
| 58 | + return | |
| 59 | + } | |
| 60 | + page ++ | |
| 61 | + networkUtil.showLoading() | |
| 62 | + this.requestData() | |
| 63 | + | |
| 64 | + }, | |
| 65 | + // 下拉刷新回调接口 | |
| 66 | + refesh: function() { | |
| 67 | + page = 1; | |
| 68 | + hasMore = true | |
| 69 | + var self=this | |
| 70 | + this.setData({ | |
| 71 | + list: [], | |
| 72 | + | |
| 73 | + }) | |
| 74 | + animation1 = wx.createAnimation({ | |
| 75 | + duration: 1000 | |
| 76 | + }) | |
| 77 | + animation1.rotate(720).step() | |
| 78 | + | |
| 79 | + this.setData({ | |
| 80 | + animationData: animation1.export() | |
| 81 | + }) | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + networkUtil.showLoading() | |
| 86 | + // 网络请求,重新请求一遍数据 | |
| 87 | + this.requestData(); | |
| 88 | + }, | |
| 89 | + myScroll: function (e) { | |
| 90 | + console.log("e:", e) | |
| 91 | + // if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){ | |
| 92 | + // this.loadMore() | |
| 93 | + // } | |
| 94 | + this.loadMore() | |
| 95 | + }, | |
| 96 | + titleClick:function(e){ | |
| 97 | + // console.log(e) | |
| 98 | + var self=this | |
| 99 | + var current_index = e.currentTarget.dataset.index | |
| 100 | + var categoryid = e.currentTarget.dataset.categoryid | |
| 101 | + this.setData({ | |
| 102 | + category: categoryid, | |
| 103 | + current_index: current_index, | |
| 104 | + images: app.globalData.artList[current_index].iconimage | |
| 105 | + }) | |
| 106 | + page = 1; | |
| 107 | + hasMore = true | |
| 108 | + this.requestData() | |
| 109 | + }, | |
| 110 | + toSearch(){ | |
| 111 | + wx.navigateTo({ | |
| 112 | + url: '../SearchPage/SearchPage', | |
| 113 | + }) | |
| 114 | + }, | |
| 115 | + toDetail:function(e){ | |
| 116 | + var self = this | |
| 117 | + var id = e.currentTarget.dataset.id | |
| 118 | + wx.navigateTo({ | |
| 119 | + url: '../childcare_knowledge_detail/childcare_knowledge_detail?id=' + id + ' & category=' + self.data.category, | |
| 120 | + }) | |
| 121 | + }, | |
| 122 | + | |
| 123 | + /*---------自定义函数--------*/ | |
| 124 | + requestData(){ | |
| 125 | + var self = this | |
| 126 | + isRefresh = true | |
| 127 | + networkUtil.showLoading() | |
| 128 | + var param = { page: page, limit: pageLimit, type: 2, categoryId: self.data.category} | |
| 129 | + // console.log(param) | |
| 130 | + networkUtil._get(api.articleList,param,function(res){ | |
| 131 | + console.log(res) | |
| 132 | + isRefresh = false | |
| 133 | + var arr = [] | |
| 134 | + if(page > 1) {// 加载更多模式 | |
| 135 | + arr = self.data.list | |
| 136 | + } | |
| 137 | + if (res.data.data.length < pageLimit){ | |
| 138 | + hasMore = false | |
| 139 | + }else{ | |
| 140 | + hasMore = true | |
| 141 | + } | |
| 142 | + arr = arr.concat(res.data.data) | |
| 143 | + self.setData({ | |
| 144 | + list:arr, | |
| 145 | + hasMore: hasMore | |
| 146 | + }) | |
| 147 | + // var that = this; | |
| 148 | + setTimeout(function () { | |
| 149 | + animation1.rotate(0).step({ duration: 0, transformOrigin: "50%,50%", timingFunction: 'linear' }) | |
| 150 | + self.setData({ | |
| 151 | + animationData: animation1.export() | |
| 152 | + }) | |
| 153 | + }, 300) | |
| 154 | + | |
| 155 | + },function(res){ | |
| 156 | + isRefresh = false | |
| 157 | + setTimeout(function () { | |
| 158 | + animation1.rotate(0).step({ duration: 0, transformOrigin: "50%,50%", timingFunction: 'linear' }) | |
| 159 | + self.setData({ | |
| 160 | + animationData: animation1.export() | |
| 161 | + }) | |
| 162 | + }, 300) | |
| 163 | + }) | |
| 164 | + | |
| 165 | + | |
| 166 | + }, | |
| 167 | + // 文章点赞 | |
| 168 | + articleLike: function (e){ | |
| 169 | + console.log(e) | |
| 170 | + var self = this | |
| 171 | + var id = e.currentTarget.dataset.id | |
| 172 | + var index = e.currentTarget.dataset.index | |
| 173 | + // 已经点赞 | |
| 174 | + if (self.data.list[index].isLike == 1) { | |
| 175 | + networkUtil.showErrorToast('您已经点过赞啦') | |
| 176 | + return; | |
| 177 | + } | |
| 178 | + networkUtil._post(api.articleLike, { id: id }, function (res) { | |
| 179 | + console.log(res) | |
| 180 | + | |
| 181 | + self.data.list[index].likeCount++ | |
| 182 | + self.data.list[index].isLike = 1 | |
| 183 | + self.setData({ | |
| 184 | + list: self.data.list | |
| 185 | + }) | |
| 186 | + | |
| 187 | + }, function (res) { | |
| 188 | + console.log(res) | |
| 189 | + }) | |
| 190 | + } | |
| 191 | +}) |
littleApp_child/pages/risk_guide/risk_guide.json
View file @
5aedd9a
littleApp_child/pages/risk_guide/risk_guide.wxml
View file @
5aedd9a
| 1 | +<!--articleLists.wxml 文章列表--> | |
| 2 | +<view style="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}}"> | |
| 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> | |
| 9 | + | |
| 10 | + </label> | |
| 11 | + </scroll-view> | |
| 12 | + </view> | |
| 13 | + <view class="main"> | |
| 14 | + | |
| 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"> | |
| 17 | + <block wx:for="{{images}}"> | |
| 18 | + <swiper-item> | |
| 19 | + <image src="{{item}}"></image> | |
| 20 | + </swiper-item> | |
| 21 | + </block> | |
| 22 | + </swiper> --> | |
| 23 | + <image class="swiper" style="height:{{swiperHeight}}px" mode="aspectFill" src="{{images.real}}"></image> | |
| 24 | + <view> | |
| 25 | + <view bindtap="toDetail" data-id="{{item.id}}" wx:for="{{list}}" wx:key="{{index}}"> | |
| 26 | + <view class="content_item"> | |
| 27 | + <view style="margin-left:15px;margin-right:90px;"> | |
| 28 | + <view class="content_title">{{item.title}}</view> | |
| 29 | + <view class="content_content">{{item.introduction}}</view> | |
| 30 | + <view class="zarparent_box"> | |
| 31 | + | |
| 32 | + <view class="zar_box" catchtap="articleLike" data-id="{{item.id}}" data-index="{{index}}"> | |
| 33 | + <image class="zar_img" src="../../source/{{item.isLike == 1 ? 'zanguo.png' : 'like.png'}}"></image> | |
| 34 | + <view class="content_zar">{{item.likeCount}}</view> | |
| 35 | + </view> | |
| 36 | + <!-- <view class="zar_box"> | |
| 37 | + <image class="zar_img" src="../../source/{{item.isLike == 1 ? 'save_not.png' : 'like.png'}}"></image> | |
| 38 | + <view class="content_zar">{{item.likeCount}}</view> | |
| 39 | + </view> --> | |
| 40 | + <view class="tags_view"> | |
| 41 | + <view class="tags1">新生儿</view> | |
| 42 | + <view class="tags1">健康宝宝</view> | |
| 43 | + <view class="tags_week">健康宝宝</view> | |
| 44 | + </view> | |
| 45 | + </view> | |
| 46 | + | |
| 47 | + </view> | |
| 48 | + <image class="content_image" mode="aspectFill" src="{{item.image.medium}}"></image> | |
| 49 | + </view> | |
| 50 | + <view class="home__list-item__bottom"></view> | |
| 51 | + </view> | |
| 52 | + <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view> | |
| 53 | + </view> | |
| 54 | + </scroll-view> | |
| 55 | + | |
| 56 | + </view> | |
| 57 | + </view> | |
| 58 | + <image animation="{{animationData}}" class="icon_refresh" src="../../source/group2.png" bindtap="refesh"></image> | |
| 59 | + | |
| 60 | +</view> |
littleApp_child/pages/risk_guide/risk_guide.wxss
View file @
5aedd9a
| 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 | + width: 100%; | |
| 65 | +} | |
| 66 | + | |
| 67 | +.swiper image { | |
| 68 | + max-height: 100%; | |
| 69 | + max-width: 100%; | |
| 70 | +} | |
| 71 | + | |
| 72 | +.content_item { | |
| 73 | + width: 100%; | |
| 74 | + height: 120px; | |
| 75 | + right: 75px; | |
| 76 | +} | |
| 77 | + | |
| 78 | +.content_title { | |
| 79 | + font-family: PingFangSC-Regular; | |
| 80 | + font-size: 14px; | |
| 81 | + padding-top: 10px; | |
| 82 | + color: #222; | |
| 83 | + display: -webkit-box; | |
| 84 | + -webkit-box-orient: vertical; | |
| 85 | + -webkit-line-clamp: 1; | |
| 86 | + overflow: hidden; | |
| 87 | +} | |
| 88 | + | |
| 89 | +.content_content { | |
| 90 | + height: 36px; | |
| 91 | + font-family: PingFangSC-Regular; | |
| 92 | + font-size: 12px; | |
| 93 | + color: #888; | |
| 94 | + line-height: 18px; | |
| 95 | + margin-top: 10px; | |
| 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 | +.content_image { | |
| 105 | + width: 70px; | |
| 106 | + transform: translateY(-100px); | |
| 107 | + float: right; | |
| 108 | + margin-right: 15px; | |
| 109 | + height: 70px; | |
| 110 | +} | |
| 111 | + | |
| 112 | +.zarparent_box { | |
| 113 | + display: flex; | |
| 114 | + margin-top: 15px; | |
| 115 | +} | |
| 116 | + | |
| 117 | +.zar_box { | |
| 118 | + display: flex; | |
| 119 | + margin-left: -5px; | |
| 120 | + width: 50px; | |
| 121 | +} | |
| 122 | + | |
| 123 | +.zar_img { | |
| 124 | + width: 25px; | |
| 125 | + height: 25px; | |
| 126 | +} | |
| 127 | + | |
| 128 | +.save_img { | |
| 129 | + width: 25px; | |
| 130 | + height: 25px; | |
| 131 | +} | |
| 132 | +.content_zar { | |
| 133 | + font-family: PingFangSC-Regular; | |
| 134 | + font-size: 10px; | |
| 135 | + margin-left: 3px; | |
| 136 | + margin-top: 5px; | |
| 137 | + color: #AFAFAF; | |
| 138 | +} | |
| 139 | +.tags_view{ | |
| 140 | + display:flex; | |
| 141 | + float: right; | |
| 142 | + position: absolute; | |
| 143 | + right: 20px; | |
| 144 | +} | |
| 145 | +.tags1 { | |
| 146 | + background: #f2fdf7; | |
| 147 | + border-radius: 2px; | |
| 148 | + font-size: 12px; | |
| 149 | + margin-left: 10px; | |
| 150 | + color: #58a478; | |
| 151 | + margin-top: 5px; | |
| 152 | + padding: 3px; | |
| 153 | +} | |
| 154 | + | |
| 155 | +.tags_week { | |
| 156 | + background: #EEF7FF; | |
| 157 | + border-radius: 2px; | |
| 158 | + font-size: 12px; | |
| 159 | + margin-left: 10px; | |
| 160 | + color: #4E90EB; | |
| 161 | + margin-top: 5px; | |
| 162 | + padding: 3px; | |
| 163 | +} | |
| 164 | + | |
| 165 | +/*item 分割线*/ | |
| 166 | + | |
| 167 | +.home__list-item__bottom { | |
| 168 | + height: 1px; | |
| 169 | + background: #e2e2e2; | |
| 170 | + margin-top: 5px; | |
| 171 | + left: 15px; | |
| 172 | + right: 15px; | |
| 173 | +} | |
| 174 | + | |
| 175 | +.list_scroll { | |
| 176 | + height: 100vh; | |
| 177 | + /* background: rebeccapurple */ | |
| 178 | +} | |
| 179 | + | |
| 180 | +.icon_refresh { | |
| 181 | +position: fixed; | |
| 182 | + width: 50px; | |
| 183 | + height: 50px; | |
| 184 | + right: 20px; | |
| 185 | + bottom: 30px; | |
| 186 | +} |
littleApp_child/source/risk_guide.png
View file @
5aedd9a
4.05 KB
littleApp_child/utils/AnalysisBluetooth.js
View file @
5aedd9a
littleApp_child/utils/network_util.js
View file @
5aedd9a
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // 0测试环境 1正式环境 2演示环境 3衡水 |
| 5 | 5 | var Builing_Release_AppStore = 0 |
| 6 | 6 | // 获取服务器地址 |
| 7 | -function kServerBaseUrl() { | |
| 7 | +function kServerBaseUrl() { | |
| 8 | 8 | switch (Builing_Release_AppStore) { |
| 9 | 9 | case 0: |
| 10 | 10 | return 'https://dev-app-member-api.healthbaby.com.cn/'; |
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | return 'https://weixin-bj.healthbaby.com.cn/'; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | - | |
| 19 | + | |
| 20 | 20 | /* |
| 21 | 21 | * port: 接口名称 类型字符串 |
| 22 | 22 | * params: 参数 类型json |