Commit 60cb40f703af2329ed5ddcab0d17f29c6cca1d69
1 parent
f48f278e37
Exists in
master
and in
2 other branches
中医指导文章
Showing 13 changed files with 219 additions and 3 deletions
- littleApp_child/app.json
- littleApp_child/packageA/pages/article/article.js
- littleApp_child/packageA/pages/article/article.json
- littleApp_child/packageA/pages/article/article.wxml
- littleApp_child/packageA/pages/article/article.wxss
- littleApp_child/packageA/pages/articleList/articleList.js
- littleApp_child/packageA/pages/articleList/articleList.json
- littleApp_child/packageA/pages/articleList/articleList.wxml
- littleApp_child/packageA/pages/articleList/articleList.wxss
- littleApp_child/pages/home/home.js
- littleApp_child/pages/home/home.wxml
- littleApp_child/pages/quickArchives/quickArchives.js
- littleApp_child/utils/apiFile.js
littleApp_child/app.json
View file @
60cb40f
littleApp_child/packageA/pages/article/article.js
View file @
60cb40f
1 | +// packageA/pages/article/article.js | |
2 | +import api from "../../../utils/apiFile.js"; | |
3 | +var networkUtil = require('../../../utils/network_util.js') | |
4 | +Page({ | |
5 | + data: { | |
6 | + id: "", | |
7 | + article: {}, | |
8 | + typeList: [ | |
9 | + {id: 1, name: "中医饮食调养指导"}, | |
10 | + {id: 2, name: "中医起居调摄指导"}, | |
11 | + {id: 3, name: "传授摩腹、捏脊方法"}, | |
12 | + {id: 4, name: "传授按揉迎香穴、足三里穴方法"}, | |
13 | + {id: 5, name: "传授按揉四神聪穴方法"}, | |
14 | + {id: 6, name: "其他"} | |
15 | + ] | |
16 | + }, | |
17 | + onLoad: function (options) { | |
18 | + this.data.id = options.id; | |
19 | + console.log(this.data.id) | |
20 | + this.getArticle() | |
21 | + }, | |
22 | + getArticle() { | |
23 | + let _this = this | |
24 | + networkUtil._get(api.getArticle, {}, function(res) { | |
25 | + if(0 == res.data.errorcode){ | |
26 | + for (let i in res.data.data) { | |
27 | + let typeStr = _this.getTypeStr(res.data.data[i].type) | |
28 | + res.data.data[i].typeStr = typeStr | |
29 | + if (_this.data.id === res.data.data[i].id) { | |
30 | + _this.setData({ | |
31 | + article: res.data.data[i] | |
32 | + }) | |
33 | + } | |
34 | + } | |
35 | + } | |
36 | + }, function(res) { | |
37 | + networkUtil.showErrorToast(res.errormsg) | |
38 | + }) | |
39 | + }, | |
40 | + getTypeStr(type) { | |
41 | + for (let i in this.data.typeList) { | |
42 | + if (type === this.data.typeList[i].id) { | |
43 | + return this.data.typeList[i].name | |
44 | + } | |
45 | + } | |
46 | + } | |
47 | +}) |
littleApp_child/packageA/pages/article/article.json
View file @
60cb40f
littleApp_child/packageA/pages/article/article.wxml
View file @
60cb40f
1 | +<!--packageA/pages/article/article.wxml--> | |
2 | +<view class="list-page"> | |
3 | + <view class="art"> | |
4 | + <view class="title">{{article.title}}</view> | |
5 | + <view class="type">{{article.typeStr}}</view> | |
6 | + <rich-text nodes="{{article.contents}}"></rich-text> | |
7 | + <view class="short">{{article.shortText}}</view> | |
8 | + </view> | |
9 | +</view> |
littleApp_child/packageA/pages/article/article.wxss
View file @
60cb40f
1 | +/* packageA/pages/article/article.wxss */ | |
2 | +.list-page{ | |
3 | + width: 100%; | |
4 | + height: 100vh; | |
5 | + overflow-y: auto; | |
6 | + background: white; | |
7 | +} | |
8 | +.art{ | |
9 | + width: 94%; | |
10 | + margin-left: 3%; | |
11 | +} | |
12 | +.title{ | |
13 | + width: 100%; | |
14 | + text-align: center; | |
15 | + font-size: 17px; | |
16 | + line-height: 40px; | |
17 | +} | |
18 | +.type{ | |
19 | + width: 100%; | |
20 | + line-height: 30px; | |
21 | + font-size: 13px; | |
22 | + color: #48C17B; | |
23 | +} | |
24 | +rich-text{ | |
25 | + width: 100%; | |
26 | +} | |
27 | +.short{ | |
28 | + margin-top: 25px; | |
29 | + width: 100%; | |
30 | + color: #999999; | |
31 | + font-size: 13px; | |
32 | +} |
littleApp_child/packageA/pages/articleList/articleList.js
View file @
60cb40f
1 | +// packageA/pages/articleList/articleList.js | |
2 | +import api from "../../../utils/apiFile.js"; | |
3 | +var networkUtil = require('../../../utils/network_util.js') | |
4 | +Page({ | |
5 | + data: { | |
6 | + articleList: [], | |
7 | + typeList: [ | |
8 | + {id: 1, name: "中医饮食调养指导"}, | |
9 | + {id: 2, name: "中医起居调摄指导"}, | |
10 | + {id: 3, name: "传授摩腹、捏脊方法"}, | |
11 | + {id: 4, name: "传授按揉迎香穴、足三里穴方法"}, | |
12 | + {id: 5, name: "传授按揉四神聪穴方法"}, | |
13 | + {id: 6, name: "其他"} | |
14 | + ] | |
15 | + }, | |
16 | + onLoad: function (options) { | |
17 | + this.getArticleList() | |
18 | + }, | |
19 | + getArticleList() { | |
20 | + let _this = this | |
21 | + networkUtil._get(api.getArticle, {}, function(res) { | |
22 | + if(0 == res.data.errorcode){ | |
23 | + for (let i in res.data.data) { | |
24 | + let typeStr = _this.getTypeStr(res.data.data[i].type) | |
25 | + res.data.data[i].typeStr = typeStr | |
26 | + } | |
27 | + _this.setData({ | |
28 | + articleList: res.data.data | |
29 | + }) | |
30 | + } | |
31 | + }, function(res) { | |
32 | + networkUtil.showErrorToast(res.errormsg) | |
33 | + }) | |
34 | + }, | |
35 | + goArticle(e) { | |
36 | + let id = e.currentTarget.dataset.item.id; | |
37 | + wx.navigateTo({url: '/packageA/pages/article/article?id='+id}) | |
38 | + }, | |
39 | + getTypeStr(type) { | |
40 | + for (let i in this.data.typeList) { | |
41 | + if (type === this.data.typeList[i].id) { | |
42 | + return this.data.typeList[i].name | |
43 | + } | |
44 | + } | |
45 | + } | |
46 | +}) |
littleApp_child/packageA/pages/articleList/articleList.json
View file @
60cb40f
littleApp_child/packageA/pages/articleList/articleList.wxml
View file @
60cb40f
1 | +<!--packageA/pages/articleList/articleList.wxml--> | |
2 | +<view class="list-page"> | |
3 | + <view class="no-art" wx:if="{{articleList.length===0}}"> | |
4 | + 暂无中医指导文章! | |
5 | + </view> | |
6 | + <view class="list" wx:if="{{articleList.length > 0}}"> | |
7 | + <view class="art" wx:for="{{articleList}}" wx:key="item.id" bind:tap="goArticle" data-item="{{item}}"> | |
8 | + <view class="title">{{item.title}}</view> | |
9 | + <view class="type">{{item.typeStr}}</view> | |
10 | + <view class="short">{{item.shortText}}</view> | |
11 | + </view> | |
12 | + </view> | |
13 | +</view> |
littleApp_child/packageA/pages/articleList/articleList.wxss
View file @
60cb40f
1 | +/* packageA/pages/articleList/articleList.wxss */ | |
2 | +.list-page{ | |
3 | + width: 100%; | |
4 | + height: 100vh; | |
5 | + overflow-y: auto; | |
6 | +} | |
7 | +.no-art{ | |
8 | + width: 100%; | |
9 | + line-height: 50px; | |
10 | + text-align: center; | |
11 | +} | |
12 | +.list{ | |
13 | + width: 100%; | |
14 | + height: auto; | |
15 | +} | |
16 | +.art{ | |
17 | + width: 94%; | |
18 | + margin-left: 3%; | |
19 | + margin-top: 20px; | |
20 | + background: white; | |
21 | + height: auto; | |
22 | + border-radius: 5px; | |
23 | +} | |
24 | +.title{ | |
25 | + font-size: 17px; | |
26 | + line-height: 40px; | |
27 | + padding-left: 20px; | |
28 | +} | |
29 | +.type{ | |
30 | + line-height: 30px; | |
31 | + padding-left: 20px; | |
32 | + font-size: 13px; | |
33 | + color: #48C17B; | |
34 | +} | |
35 | +.short{ | |
36 | + color: #999999; | |
37 | + font-size: 13px; | |
38 | + line-height: 20px; | |
39 | + padding-left: 20px; | |
40 | + padding-right: 20px; | |
41 | +} |
littleApp_child/pages/home/home.js
View file @
60cb40f
littleApp_child/pages/home/home.wxml
View file @
60cb40f
... | ... | @@ -113,6 +113,10 @@ |
113 | 113 | <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
114 | 114 | <view class="foundation_item_small_text">补填户籍地址</view> |
115 | 115 | </navigator> |
116 | + <navigator class="foundation_item_small" bind:tap="goArticle"> | |
117 | + <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
118 | + <view class="foundation_item_small_text">中医指导文章</view> | |
119 | + </navigator> | |
116 | 120 | </view> |
117 | 121 | |
118 | 122 | <!--文章列表--> |
littleApp_child/pages/quickArchives/quickArchives.js
View file @
60cb40f
... | ... | @@ -60,8 +60,8 @@ |
60 | 60 | if(0 == res.data.errorcode){ |
61 | 61 | that.setData({ |
62 | 62 | hospitals:res.data.data, |
63 | - selectHospital:{'hospitalId':216,'hospitalName':'秦皇岛市妇幼保健院'}, | |
64 | - 'queryData.hospital':{'hospitalId':216,'hospitalName':'秦皇岛市妇幼保健院'} | |
63 | + selectHospital: {}, //{'hospitalId':216,'hospitalName':'秦皇岛市妇幼保健院'}, | |
64 | + 'queryData.hospital': {} //{'hospitalId':216,'hospitalName':'秦皇岛市妇幼保健院'} | |
65 | 65 | }) |
66 | 66 | } |
67 | 67 | }, function(res) { |