Commit b994bb5761102ec22c4027d73b44bd7a16398c84
Exists in
master
and in
2 other branches
Merge branch 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child
# Conflicts: # littleApp_child/app.json
Showing 20 changed files
- littleApp_child/app.json
- littleApp_child/pages/PersonalInfo/PersonalInfo.js
- littleApp_child/pages/PersonalInfo/PersonalInfo.json
- littleApp_child/pages/PersonalInfo/PersonalInfo.wxml
- littleApp_child/pages/PersonalInfo/PersonalInfo.wxss
- littleApp_child/pages/Setting/Setting.js
- littleApp_child/pages/Setting/Setting.json
- littleApp_child/pages/Setting/Setting.wxml
- littleApp_child/pages/Setting/Setting.wxss
- littleApp_child/pages/home/home.wxml
- littleApp_child/pages/home/home.wxss
- littleApp_child/pages/hospitalDetail/hospitalDetail.js
- littleApp_child/pages/hospitalDetail/hospitalDetail.json
- littleApp_child/pages/hospitalDetail/hospitalDetail.wxml
- littleApp_child/pages/hospitalList/hospitalList.js
- littleApp_child/pages/hospitalList/hospitalList.json
- littleApp_child/pages/hospitalList/hospitalList.wxml
- littleApp_child/pages/hospitalList/hospitalList.wxss
- littleApp_child/utils/apiFile.js
- littleApp_child/utils/qiniuUploader.js
littleApp_child/app.json
View file @
b994bb5
1 | 1 | { |
2 | 2 | "pages": [ |
3 | - "pages/home/home", | |
4 | - | |
5 | - | |
3 | + | |
4 | + "pages/home/home", | |
5 | + "pages/Setting/Setting", | |
6 | + "pages/PersonalInfo/PersonalInfo", | |
6 | 7 | "pages/checkTabList/checkTabList", |
7 | - | |
8 | + "pages/feedback/feedback", | |
9 | + "pages/mySaved/mySaved", | |
8 | 10 | "pages/CheckReport/CheckReport", |
9 | 11 | "pages/articleLists/articleLists", |
10 | - "pages/hospitalList/hospitalList", | |
11 | 12 | |
12 | 13 | |
13 | 14 | "pages/SearchPage/SearchPage", |
... | ... | @@ -16,7 +17,7 @@ |
16 | 17 | |
17 | 18 | "pages/doctorList/doctorList", |
18 | 19 | "pages/doctor/doctor", |
19 | - "pages/hospitalDetail/hospitalDetail", | |
20 | + | |
20 | 21 | |
21 | 22 | "pages/chatroom/chatroom", |
22 | 23 | "pages/chat/chat", |
littleApp_child/pages/PersonalInfo/PersonalInfo.js
View file @
b994bb5
1 | +//hospitalList.js 医院列表 联系医院 | |
2 | + | |
3 | +// 网络请求工具类 | |
4 | +var networkUtil = require('../../utils/network_util.js') | |
5 | + | |
6 | +var api = require('../../utils/apiFile.js') | |
7 | + | |
8 | +// 页码 | |
9 | +var page = 0 | |
10 | +// 地理位置信息 | |
11 | +var latitude = 0 | |
12 | +var longitude = 0 | |
13 | +// 是否有更多 | |
14 | +var hasMore = true | |
15 | + | |
16 | +Page({ | |
17 | + data: { | |
18 | + list:[] | |
19 | + }, | |
20 | + /*---------生命周期--------*/ | |
21 | + onLoad: function () { | |
22 | + | |
23 | + | |
24 | + } | |
25 | +}) |
littleApp_child/pages/PersonalInfo/PersonalInfo.json
View file @
b994bb5
littleApp_child/pages/PersonalInfo/PersonalInfo.wxml
View file @
b994bb5
1 | +<view class="TopBar" style="height:140px"> | |
2 | + <!--头像--> | |
3 | + <image class="avatar" bindtap="tapAvatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover"></image> | |
4 | + <!--用户名--> | |
5 | + <view class="top_name"> | |
6 | + <view class="userName">{{userData.username}}么么么</view> | |
7 | + </view> | |
8 | +</view> | |
9 | +<view class="infoBar_title">分娩信息</view> | |
10 | +<view class="infoBar_content"> | |
11 | + <view class="infoBar_content_item"> | |
12 | + <label class="infoBar_content_item_title">分娩日期:</label> | |
13 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
14 | + </view> | |
15 | + <view class="infoBar_content_item"> | |
16 | + <label class="infoBar_content_item_title">出生时间:</label> | |
17 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
18 | + </view> | |
19 | + <view class="infoBar_content_item"> | |
20 | + <label class="infoBar_content_item_title">分娩孕周:</label> | |
21 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
22 | + </view> | |
23 | + <view class="infoBar_content_item"> | |
24 | + <label class="infoBar_content_item_title">分娩方式:</label> | |
25 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
26 | + </view> | |
27 | + <view class="infoBar_content_item"> | |
28 | + <label class="infoBar_content_item_title">体重:</label> | |
29 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
30 | + </view> | |
31 | + <view class="infoBar_content_item"> | |
32 | + <label class="infoBar_content_item_title">身长:</label> | |
33 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
34 | + </view> | |
35 | + <view class="infoBar_content_item"> | |
36 | + <label class="infoBar_content_item_title">头围:</label> | |
37 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
38 | + </view> | |
39 | +</view> | |
40 | +<view class="infoBar_title">高危及诊断</view> | |
41 | +<view class="infoBar_content"> | |
42 | + <view class="infoBar_content_item"> | |
43 | + <label class="infoBar_content_item_title">母亲高危因素:</label> | |
44 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
45 | + </view> | |
46 | + <view class="infoBar_content_item"> | |
47 | + <label class="infoBar_content_item_title">高危儿:</label> | |
48 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
49 | + </view> | |
50 | + <view class="infoBar_content_item_one"> | |
51 | + <label class="infoBar_content_item_title">新生儿出院诊断:</label> | |
52 | + <label class="infoBar_content_item_text">2017.1.</label> | |
53 | + </view> | |
54 | +</view> | |
55 | +<view class="infoBar_title">院内系统</view> | |
56 | +<view class="infoBar_content"> | |
57 | + <view class="infoBar_content_item"> | |
58 | + <label class="infoBar_content_item_title">就诊卡号:</label> | |
59 | + <label class="infoBar_content_item_text">22222222222222222222</label> | |
60 | + </view> | |
61 | + <view class="infoBar_content_item"> | |
62 | + <label class="infoBar_content_item_title">住院号:</label> | |
63 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
64 | + </view> | |
65 | + <view class="infoBar_content_item"> | |
66 | + <label class="infoBar_content_item_title">建档医生:</label> | |
67 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
68 | + </view> | |
69 | + <view class="infoBar_content_item"> | |
70 | + <label class="infoBar_content_item_title">建档日期:</label> | |
71 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
72 | + </view> | |
73 | + <view class="infoBar_content_item"> | |
74 | + <label class="infoBar_content_item_title">服务类型:</label> | |
75 | + <label class="infoBar_content_item_text">2017.1.1</label> | |
76 | + </view> | |
77 | +</view> |
littleApp_child/pages/PersonalInfo/PersonalInfo.wxss
View file @
b994bb5
1 | +@import '../home/home.wxss'; | |
2 | + | |
3 | +.infoBar_title { | |
4 | + font-size: 12px; | |
5 | + color: #999999; | |
6 | + margin-left: 15px; | |
7 | + height: 24px; | |
8 | + line-height: 24px; | |
9 | + background: rgb(244, 244, 244); | |
10 | +} | |
11 | + | |
12 | +.infoBar_content { | |
13 | + background: white; | |
14 | + display: flex; | |
15 | + flex-wrap: wrap; | |
16 | +} | |
17 | + | |
18 | +.infoBar_content_item { | |
19 | + background: white; | |
20 | + height: 35px; | |
21 | + min-width: 50%; | |
22 | +} | |
23 | + | |
24 | +.infoBar_content_item_one { | |
25 | + width: 100%; | |
26 | +} | |
27 | + | |
28 | +.infoBar_content_item_title { | |
29 | + font-size: 13px; | |
30 | + color: #222222; | |
31 | + line-height: 35px; | |
32 | + margin-left: 15px; | |
33 | +} | |
34 | + | |
35 | +.infoBar_content_item_text { | |
36 | + font-size: 13px; | |
37 | + color: #666; | |
38 | + line-height: 35px; | |
39 | +} |
littleApp_child/pages/Setting/Setting.js
View file @
b994bb5
1 | +//hospitalDetail.js 医院详情介绍 | |
2 | + | |
3 | +// 网络请求工具类 | |
4 | +var networkUtil = require('../../utils/network_util.js') | |
5 | +var api = require('../../utils/apiFile.js') | |
6 | +var qiniuUploader = require('../../utils/qiniuUploader.js') | |
7 | + | |
8 | +Page({ | |
9 | + data: { | |
10 | + setList: [{ icon: '../../source/jianchajilu.png', text: '我的预约', right_text:'',margin:0}, | |
11 | + { icon: '../../source/jianchajilu.png', text: '儿童档案', right_text: '', margin: 10 }, | |
12 | + { icon: '../../source/jianchajilu.png', text: '消息提醒', right_text: '', margin: 0 }, | |
13 | + { icon: '../../source/jianchajilu.png', text: '交易记录', right_text: '', margin: 0 }, | |
14 | + { icon: '../../source/jianchajilu.png', text: '我的收藏', right_text: '', margin: 10 }, | |
15 | + { icon: '../../source/jianchajilu.png', text: '用户反馈', right_text: '', margin: 0 }, | |
16 | + { icon: '../../source/jianchajilu.png', text: '清楚缓存', right_text: '0.2 MB', margin:10} ], | |
17 | + isShowOne: false, | |
18 | + isShowTwo: false, | |
19 | + isShowThree: false, | |
20 | + }, | |
21 | + onLoad: function (option) { | |
22 | + | |
23 | + }, | |
24 | + selectPhoto(){ | |
25 | + var that = this | |
26 | + wx.showActionSheet({ | |
27 | + itemList: ['手机拍照','本地相册'], | |
28 | + success: function (res) { | |
29 | + if (!res.tapIndex) { | |
30 | + return | |
31 | + } | |
32 | + var imgType = 'camera' | |
33 | + if (res.tapIndex == 1) { | |
34 | + imgType = 'album' | |
35 | + } | |
36 | + wx.chooseImage({ | |
37 | + count: 1, // 默认9 | |
38 | + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 | |
39 | + sourceType: [imgType], // 可以指定来源是相册还是相机,默认二者都有 | |
40 | + success: function (res) { | |
41 | + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 | |
42 | + console.log('图片',res) | |
43 | + that.qiniuToken(res.tempFilePaths[0]) | |
44 | + } | |
45 | + }) | |
46 | + }, | |
47 | + fail: function (res) { | |
48 | + console.log(res.errMsg) | |
49 | + } | |
50 | + }) | |
51 | + }, | |
52 | + clickPage(e){ | |
53 | + console.log(e) | |
54 | + var index = e.currentTarget.dataset.index | |
55 | + var url = '' | |
56 | + switch(index){ | |
57 | + case 0: | |
58 | + url = '../PersonalInfo/PersonalInfo' | |
59 | + break | |
60 | + case 1: | |
61 | + url = '../PersonalInfo/PersonalInfo' | |
62 | + break | |
63 | + case 2: | |
64 | + url = '../system_notifacations/system_notifacations' | |
65 | + break | |
66 | + case 3: | |
67 | + url = '../PersonalInfo/PersonalInfo' | |
68 | + break | |
69 | + case 4: | |
70 | + url = '../PersonalInfo/PersonalInfo' | |
71 | + break | |
72 | + case 5: | |
73 | + url = '../PersonalInfo/PersonalInfo' | |
74 | + break | |
75 | + case 6: | |
76 | + | |
77 | + break | |
78 | + } | |
79 | + wx.navigateTo({ | |
80 | + url: url | |
81 | + }) | |
82 | + }, | |
83 | + logout(){ | |
84 | + var that = this | |
85 | + wx.showActionSheet({ | |
86 | + itemList: ['退出当前用户'], | |
87 | + success: function (res) { | |
88 | + if (res.tapIndex == 0) { | |
89 | + wx.setStorageSync('userToken', '') | |
90 | + wx.setStorageSync('userId', '') | |
91 | + getApp().globalData.token = '' | |
92 | + getApp().globalData.userId = '' | |
93 | + that.toLogin() | |
94 | + } | |
95 | + }, | |
96 | + fail: function (res) { | |
97 | + console.log(res.errMsg) | |
98 | + } | |
99 | + }) | |
100 | + }, | |
101 | + uploadImg(upToken,imageUrl){ | |
102 | + var that = this; | |
103 | + console.log(upToken, imageUrl) | |
104 | + // qiniuUploader.upload(imageUrl, (res) => { | |
105 | + // console.log(res) | |
106 | + // that.setData({ | |
107 | + // 'imageURL': res.imageURL, | |
108 | + // }); | |
109 | + // }, (error) => { | |
110 | + // console.log('error: ' + error); | |
111 | + // }, { | |
112 | + // uploadURL: 'https://up.qbox.me', | |
113 | + // domain: 'upload.qiniu.com', | |
114 | + // uptokenURL: 'UpTokenURL.com/uptoken', | |
115 | + // }) | |
116 | + wx.uploadFile({ | |
117 | + url: 'https://up.qbox.me', | |
118 | + filePath: imageUrl, | |
119 | + name: 'file', | |
120 | + formData: { | |
121 | + 'key': imageUrl.split('//')[1], | |
122 | + 'token': upToken | |
123 | + }, | |
124 | + success: function (res) { | |
125 | + var data = JSON.parse(res.data); | |
126 | + }, | |
127 | + fail(error) { | |
128 | + console.log(error) | |
129 | + }, | |
130 | + complete(res) { | |
131 | + console.log(res) | |
132 | + } | |
133 | + }) | |
134 | + }, | |
135 | + qiniuToken(imageUrl){ | |
136 | + var that = this; | |
137 | + networkUtil._get(api.kApiQiNiuImageToken, {}, function (res) { | |
138 | + if (res.data && res.data.upToken){ | |
139 | + that.uploadImg(res.data.upToken, imageUrl) | |
140 | + } | |
141 | + }, function (res) { | |
142 | + networkUtil.showErrorToast(res.errormsg) | |
143 | + }) | |
144 | + }, | |
145 | + changeUserInfo(image){ | |
146 | + var that = this; | |
147 | + networkUtil._put(api.kApiModifyMyInfo, {}, function (res) { | |
148 | + if (res.data && res.data.upToken) { | |
149 | + that.uploadImg(res.data.upToken, imageUrl) | |
150 | + } | |
151 | + }, function (res) { | |
152 | + networkUtil.showErrorToast(res.errormsg) | |
153 | + }) | |
154 | + } | |
155 | + | |
156 | +}) |
littleApp_child/pages/Setting/Setting.json
View file @
b994bb5
littleApp_child/pages/Setting/Setting.wxml
View file @
b994bb5
1 | +<view class="TopBar"> | |
2 | + <!--用户名--> | |
3 | + <view class="top_baseInfo" bindtap="selectPhoto"> | |
4 | + <!--头像--> | |
5 | + <image class="top_baseInfo_avatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover"></image> | |
6 | + <view class="top_baseInfo_userName"> | |
7 | + <view class="name">{{userData.username}}胡子涵</view> | |
8 | + <view class="phone">{{userData.username}}18787231231</view> | |
9 | + </view> | |
10 | + <image class="indicator" mode="aspectFit" src="../../source/gengduo.png"></image> | |
11 | + </view> | |
12 | + <!--下方黑色横条--> | |
13 | + <view class="infoBar"> | |
14 | + <view class="infoView"> | |
15 | + <view class="titleText">月龄</view> | |
16 | + <view class="timeText">{{userData.birth}}122</view> | |
17 | + </view> | |
18 | + <view class="infoView"> | |
19 | + <view class="titleText">出生日期</view> | |
20 | + <view class="timeText">{{userData.birth}}122</view> | |
21 | + </view> | |
22 | + <view class="infoView"> | |
23 | + <view class="titleText">出生时间</view> | |
24 | + <view class="timeText">{{userData.birth}}122</view> | |
25 | + </view> | |
26 | + <view class="infoView"> | |
27 | + <view class="titleText">分娩方式</view> | |
28 | + <view class="timeText">{{userData.birth}}122</view> | |
29 | + </view> | |
30 | + </view> | |
31 | + <!--下方黑色横条--> | |
32 | +</view> | |
33 | +<block wx:for="{{setList}}"> | |
34 | + <view class="setting_cell" bindtap="clickPage" data-index="{{index}}" style="margin-bottom:{{item.margin}}px" hover-class="hover"> | |
35 | + <image src="{{item.icon}}"></image> | |
36 | + <text>{{item.text}}</text> | |
37 | + <image class="indicator" mode="aspectFit" src="../../source/gengduo.png"></image> | |
38 | + <label class="right_text">{{item.right_text}}</label> | |
39 | + </view> | |
40 | + <view class="line" wx:if="{{item.margin == 0}}"></view> | |
41 | +</block> | |
42 | +<view class="btn">退出登录</view> |
littleApp_child/pages/Setting/Setting.wxss
View file @
b994bb5
1 | + | |
2 | +.top_baseInfo { | |
3 | + width: 100%; | |
4 | + height: 105px; | |
5 | + background: #48C17B; | |
6 | + display: flex; | |
7 | + flex-direction: row; | |
8 | + align-items: center; | |
9 | + justify-content: flex-start; | |
10 | +} | |
11 | + | |
12 | +.top_baseInfo_avatar { | |
13 | + width:64px; | |
14 | + height:64px; | |
15 | + border-radius: 50%; | |
16 | + /* position: absolute; | |
17 | + top: 15px; | |
18 | + left: 15px; */ | |
19 | + border: 3px solid white; | |
20 | + box-shadow: 0 2px 4px 0 rgba(186,70,70,0.5); | |
21 | + margin-left: 15px; | |
22 | +} | |
23 | + | |
24 | +.top_baseInfo_userName { | |
25 | + margin-left: 12px; | |
26 | + width: 200px; | |
27 | +} | |
28 | + | |
29 | +.top_baseInfo_userName .name { | |
30 | + font-family: PingFang-SC-Medium; | |
31 | + font-size: 20px; | |
32 | + color: #FFFFFF; | |
33 | +} | |
34 | + | |
35 | +.top_baseInfo_userName .phone { | |
36 | + font-family: PingFang-SC-Medium; | |
37 | + font-size: 14px; | |
38 | + color: #FFFFFF; | |
39 | +} | |
40 | + | |
41 | +.top_baseInfo .indicator { | |
42 | + height: 22px; | |
43 | + width: 22px; | |
44 | + margin-left: calc(100% - 330px); | |
45 | +} | |
46 | + | |
47 | +.infoBar { | |
48 | + width: 100%; | |
49 | + height: 60px; | |
50 | + background: #48C17B; | |
51 | + display: flex; | |
52 | + margin-bottom: 10px; | |
53 | +} | |
54 | + | |
55 | +.infoView { | |
56 | + width: 25%; | |
57 | + background: rgba(255,255,255,0.08); | |
58 | +} | |
59 | + | |
60 | +.titleText { | |
61 | + font-size: 11px; | |
62 | + color: #CAF7DE; | |
63 | + width: 100%; | |
64 | + height: 16px; | |
65 | + text-align: center; | |
66 | + margin-top: 13px; | |
67 | +} | |
68 | + | |
69 | +.timeText { | |
70 | + font-size: 12px; | |
71 | + color: #FFFFFF; | |
72 | + width: 100%; | |
73 | + text-align: center; | |
74 | + height: 17px; | |
75 | + margin-top: 2px; | |
76 | +} | |
77 | + | |
78 | +.setting_cell { | |
79 | + height: 50px; | |
80 | + width: 100%; | |
81 | + font-size: 14px; | |
82 | + background: white; | |
83 | +} | |
84 | + | |
85 | +.setting_cell image { | |
86 | + height: 26px; | |
87 | + width: 26px; | |
88 | + display: inline-block; | |
89 | + margin-top: 12px; | |
90 | + margin-left: 15px; | |
91 | +} | |
92 | + | |
93 | +.setting_cell text { | |
94 | + display: inline-block; | |
95 | + transform: translateY(-7px); | |
96 | + margin-left: 14px; | |
97 | + height: 20px; | |
98 | + color: #333333; | |
99 | +} | |
100 | + | |
101 | +.right_text { | |
102 | + float: right; | |
103 | + margin-top: 15px; | |
104 | + color: #888888; | |
105 | +} | |
106 | + | |
107 | +.setting_cell .indicator { | |
108 | + width: 12px; | |
109 | + height: 12px; | |
110 | + float: right; | |
111 | + margin-right: 8px; | |
112 | + margin-top: 20px; | |
113 | +} | |
114 | + | |
115 | +.line { | |
116 | + border-top: 1px solid #E6E6E6; | |
117 | + margin-left: 15px; | |
118 | + width: calc(100% - 15px); | |
119 | +} | |
120 | + | |
121 | +.btn { | |
122 | + margin-left: 15px; | |
123 | + margin-right: 15px; | |
124 | + height: 38px; | |
125 | + background: #EAEAEA; | |
126 | + border: 1px solid #E6E6E6; | |
127 | + border-radius: 51px; | |
128 | + text-align: center; | |
129 | + font-size: 16px; | |
130 | + color: #888888; | |
131 | + line-height: 38px; | |
132 | +} | |
133 | + | |
134 | +.hover { | |
135 | + background: lightcyan | |
136 | +} |
littleApp_child/pages/home/home.wxml
View file @
b994bb5
... | ... | @@ -50,10 +50,14 @@ |
50 | 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 | - <navigator class="foundation_item_small" url=""> | |
53 | + <navigator class="foundation_item_small" url="../Setting/Setting"> | |
54 | 54 | <image src="../../source/except.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
55 | - <view class="foundation_item_small_text">敬请期待</view> | |
55 | + <view class="foundation_item_small_text">设置</view> | |
56 | 56 | </navigator> |
57 | + <!-- <navigator class="foundation_item_small" url=""> | |
58 | + <image src="../../source/except.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
59 | + <view class="foundation_item_small_text">设置</view> | |
60 | + </navigator> --> | |
57 | 61 | </view> |
58 | 62 | |
59 | 63 | <!--文章列表--> |
littleApp_child/pages/home/home.wxss
View file @
b994bb5
littleApp_child/pages/hospitalDetail/hospitalDetail.js
View file @
b994bb5
1 | -//hospitalDetail.js 医院详情介绍 | |
2 | - | |
3 | -// 网络请求工具类 | |
4 | -var networkUtil = require('../../utils/network_util.js') | |
5 | -var api = require('../../utils/apiFile.js') | |
6 | - | |
7 | -Page({ | |
8 | - data: { | |
9 | - hosiptalInfo: {}, | |
10 | - isShowOne: false, | |
11 | - isShowTwo: false, | |
12 | - isShowThree: false, | |
13 | - }, | |
14 | - onLoad: function (option) { | |
15 | - | |
16 | - }, | |
17 | - isShowMore:function(e){ | |
18 | - var self=this | |
19 | - console.log(e) | |
20 | - var index =e.currentTarget.dataset.index | |
21 | - console.log(index) | |
22 | - if(index==1){ | |
23 | - self.setData({ | |
24 | - isShowOne: !self.data.isShowOne, | |
25 | - isShowTwo: false, | |
26 | - isShowThree: false, | |
27 | - }) | |
28 | - } if (index == 2) { | |
29 | - self.setData({ | |
30 | - isShowOne: false , | |
31 | - isShowTwo: !self.data.isShowTwo, | |
32 | - isShowThree: false, | |
33 | - }) | |
34 | - } if (index == 3) { | |
35 | - self.setData({ | |
36 | - isShowOne: false, | |
37 | - isShowTwo: false, | |
38 | - isShowThree: !self.data.isShowThree, | |
39 | - }) | |
40 | - } | |
41 | - }, | |
42 | - getArticleInfo(days) { | |
43 | - var self = this | |
44 | - // 文章列表 | |
45 | - networkUtil._get(api.homeArtList, { page: 0, limit: 100, days: days }, function (res) { | |
46 | - console.log('获取文章信息', res.data.list) | |
47 | - app.globalData.artList = res.data.list | |
48 | - self.setData({ | |
49 | - list: res.data.list | |
50 | - }) | |
51 | - }, function (res) { | |
52 | - wx.stopPullDownRefresh() | |
53 | - }) | |
54 | - }, | |
55 | - | |
56 | - | |
57 | -}) |
littleApp_child/pages/hospitalDetail/hospitalDetail.json
View file @
b994bb5
littleApp_child/pages/hospitalDetail/hospitalDetail.wxml
View file @
b994bb5
1 | -<!--hospitalDetail.wxml 医院详情介绍--> |
littleApp_child/pages/hospitalList/hospitalList.js
View file @
b994bb5
1 | -//hospitalList.js 医院列表 联系医院 | |
2 | - | |
3 | -// 网络请求工具类 | |
4 | -var networkUtil = require('../../utils/network_util.js') | |
5 | -var api = require('../../utils/apiFile.js') | |
6 | - | |
7 | -// 页码 | |
8 | -var page = 0 | |
9 | -// 地理位置信息 | |
10 | -var latitude = 0 | |
11 | -var longitude = 0 | |
12 | -// 是否有更多 | |
13 | -var hasMore = true | |
14 | - | |
15 | -Page({ | |
16 | - data: { | |
17 | - list:[] | |
18 | - }, | |
19 | - /*---------生命周期--------*/ | |
20 | - onLoad: function () { | |
21 | - networkUtil.showLoading() | |
22 | - this.getUserLocation() | |
23 | - } | |
24 | -}) |
littleApp_child/pages/hospitalList/hospitalList.json
View file @
b994bb5
littleApp_child/pages/hospitalList/hospitalList.wxml
View file @
b994bb5
1 | -<!--hospitalList.wxml 医院列表 联系医院--> | |
2 | - <scroll-view scroll-y="true" style="height: 100%;" bindscrolltolower="loadMore"> | |
3 | - <!--list的item--> | |
4 | - <navigator url="../hospitalDetail/hospitalDetail?hosipitalId={{item.id}}" class="item" wx:for="{{list}}" wx:key="index"> | |
5 | - <view class="item-left"> | |
6 | - <image class="item__logo" src="{{item.logo.medium ? item.logo.medium : '../../source/imageSource/hospitalIcon.png'}}" mode="aspectFill"></image> | |
7 | - </view> | |
8 | - | |
9 | - <view class="item-middle"> | |
10 | - <view class="item-middle__title">{{item.title}}</view> | |
11 | - <view class="item-middle__specialty"> | |
12 | - <view class="item-middle__specialty__left">{{item.gradeLevelName == null ? '' : item.gradeLevelName}}</view> | |
13 | - <view class="item-middle__specialty__middle" wx:if="{{item.distance}}">距离{{item.distance}}km</view> | |
14 | - <view class="item-middle__specialty__right" > | |
15 | - <image class="stars-star" wx:if="{{item.starLevel > 0}}" src="../../source/imageSource/icon_star.png"></image> | |
16 | - <image class="stars-star" wx:if="{{item.starLevel > 1}}" src="../../source/imageSource/icon_star.png"></image> | |
17 | - <image class="stars-star" wx:if="{{item.starLevel > 2}}" src="../../source/imageSource/icon_star.png"></image> | |
18 | - <image class="stars-star" wx:if="{{item.starLevel > 3}}" src="../../source/imageSource/icon_star.png"></image> | |
19 | - <image class="stars-star" wx:if="{{item.starLevel > 4}}" src="../../source/imageSource/icon_star.png"></image> | |
20 | - </view> | |
21 | - </view> | |
22 | - <view class="item-middle__description">{{item.introduction == null ? '-' : item.introduction}}</view> | |
23 | - </view> | |
24 | - <view class="item-right"> | |
25 | - <image class="item-right__right" src="../../source/imageSource/page1_icon_arrow_n@3x.png"></image> | |
26 | - </view> | |
27 | - </navigator> | |
28 | - <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view> | |
29 | -</scroll-view> |
littleApp_child/pages/hospitalList/hospitalList.wxss
View file @
b994bb5
1 | -/**hospitalList.wxss 医院列表 联系医院**/ | |
2 | - | |
3 | -.item{ | |
4 | - position: relative; | |
5 | - height: 273rpx; | |
6 | - display: flex; | |
7 | - flex-direction: row; | |
8 | - align-items: center; | |
9 | - background: white; | |
10 | - margin-bottom:10rpx; | |
11 | -} | |
12 | - | |
13 | -/*item左边布局-----------------------*/ | |
14 | -.item-left{ | |
15 | - width: 18.67%; | |
16 | - height: 273rpx; | |
17 | -} | |
18 | - | |
19 | -.item__logo{ | |
20 | - width: 90rpx; | |
21 | - height: 90rpx; | |
22 | - border-radius: 500rpx; | |
23 | - position: absolute; | |
24 | - top: 30rpx; | |
25 | - left: 20rpx; | |
26 | -} | |
27 | - | |
28 | -/*item中间布局----------------------*/ | |
29 | -.item-middle{ | |
30 | - width: 69.33%; | |
31 | - height: 273rpx; | |
32 | -} | |
33 | - | |
34 | -.item-middle__title{ | |
35 | - color: #5e5e5e; | |
36 | - font: medium; | |
37 | - font-size: 34rpx; | |
38 | - margin-top: 40rpx; | |
39 | - line-height: 34rpx; | |
40 | -} | |
41 | - | |
42 | -.item-middle__specialty{ | |
43 | - color: #ee7289; | |
44 | - font: normal; | |
45 | - font-size: 22rpx; | |
46 | - line-height: 22rpx; | |
47 | - margin-top: 16rpx; | |
48 | - | |
49 | - display: flex; | |
50 | - flex-direction: row; | |
51 | -} | |
52 | - | |
53 | -.item-middle__description{ | |
54 | - color: #858585; | |
55 | - font: lighter; | |
56 | - font-size: 24rpx; | |
57 | - line-height: 130%; | |
58 | - margin-top: 30rpx; | |
59 | - overflow: hidden; | |
60 | - text-overflow: ellipsis; | |
61 | - display: -webkit-box; | |
62 | - -webkit-box-orient: vertical; | |
63 | - -webkit-line-clamp: 3; | |
64 | -} | |
65 | - | |
66 | -.item-middle__specialty__middle{ | |
67 | - margin-left: 18rpx; | |
68 | -} | |
69 | - | |
70 | -.item-middle__specialty__right{ | |
71 | - margin-left: 30rpx | |
72 | -} | |
73 | - | |
74 | -.stars-star{ | |
75 | - width: 20rpx; | |
76 | - height: 20rpx; | |
77 | -} | |
78 | - | |
79 | -/*item右边布局--------------------------*/ | |
80 | -.item-right{ | |
81 | - width: 12%; | |
82 | -} | |
83 | -.item-right__right{ | |
84 | - width: 35rpx; | |
85 | - height: 35rpx; | |
86 | - margin-left: 50%; | |
87 | - transform: translateX(-50%); | |
88 | - | |
89 | - margin-right: 4rpx; | |
90 | -} |
littleApp_child/utils/apiFile.js
View file @
b994bb5
littleApp_child/utils/qiniuUploader.js
View file @
b994bb5
1 | +// created by gpake | |
2 | +(function() { | |
3 | + | |
4 | +var config = { | |
5 | + qiniuRegion: '', | |
6 | + qiniuImageURLPrefix: '', | |
7 | + qiniuUploadToken: '', | |
8 | + qiniuUploadTokenURL: '', | |
9 | + qiniuUploadTokenFunction: null, | |
10 | + qiniuShouldUseQiniuFileName: false | |
11 | +} | |
12 | + | |
13 | +module.exports = { | |
14 | + init: init, | |
15 | + upload: upload, | |
16 | +} | |
17 | + | |
18 | +// 在整个程序生命周期中,只需要 init 一次即可 | |
19 | +// 如果需要变更参数,再调用 init 即可 | |
20 | +function init(options) { | |
21 | + config = { | |
22 | + qiniuRegion: '', | |
23 | + qiniuImageURLPrefix: '', | |
24 | + qiniuUploadToken: '', | |
25 | + qiniuUploadTokenURL: '', | |
26 | + qiniuUploadTokenFunction: null, | |
27 | + qiniuShouldUseQiniuFileName: false | |
28 | + }; | |
29 | + updateConfigWithOptions(options); | |
30 | +} | |
31 | + | |
32 | +function updateConfigWithOptions(options) { | |
33 | + if (options.region) { | |
34 | + config.qiniuRegion = options.region; | |
35 | + } else { | |
36 | + console.error('qiniu uploader need your bucket region'); | |
37 | + } | |
38 | + if (options.uptoken) { | |
39 | + config.qiniuUploadToken = options.uptoken; | |
40 | + } else if (options.uptokenURL) { | |
41 | + config.qiniuUploadTokenURL = options.uptokenURL; | |
42 | + } else if(options.uptokenFunc) { | |
43 | + config.qiniuUploadTokenFunction = options.uptokenFunc; | |
44 | + } | |
45 | + if (options.domain) { | |
46 | + config.qiniuImageURLPrefix = options.domain; | |
47 | + } | |
48 | + config.qiniuShouldUseQiniuFileName = options.shouldUseQiniuFileName | |
49 | +} | |
50 | + | |
51 | +function upload(filePath, success, fail, options) { | |
52 | + if (null == filePath) { | |
53 | + console.error('qiniu uploader need filePath to upload'); | |
54 | + return; | |
55 | + } | |
56 | + if (options) { | |
57 | + updateConfigWithOptions(options); | |
58 | + } | |
59 | + if (config.qiniuUploadToken) { | |
60 | + doUpload(filePath, success, fail, options); | |
61 | + } else if (config.qiniuUploadTokenURL) { | |
62 | + getQiniuToken(function() { | |
63 | + doUpload(filePath, success, fail, options); | |
64 | + }); | |
65 | + } else if (config.qiniuUploadTokenFunction) { | |
66 | + config.qiniuUploadToken = config.qiniuUploadTokenFunction(); | |
67 | + if (null == config.qiniuUploadToken && config.qiniuUploadToken.length > 0) { | |
68 | + console.error('qiniu UploadTokenFunction result is null, please check the return value'); | |
69 | + return | |
70 | + } | |
71 | + } else { | |
72 | + console.error('qiniu uploader need one of [uptoken, uptokenURL, uptokenFunc]'); | |
73 | + return; | |
74 | + } | |
75 | +} | |
76 | + | |
77 | +function doUpload(filePath, success, fail, options) { | |
78 | + if (null == config.qiniuUploadToken && config.qiniuUploadToken.length > 0) { | |
79 | + console.error('qiniu UploadToken is null, please check the init config or networking'); | |
80 | + return | |
81 | + } | |
82 | + var url = uploadURLFromRegionCode(config.qiniuRegion); | |
83 | + var fileName = filePath.split('//')[1]; | |
84 | + if (options && options.key) { | |
85 | + fileName = options.key; | |
86 | + } | |
87 | + var formData = { | |
88 | + 'token': config.qiniuUploadToken | |
89 | + }; | |
90 | + if (!config.qiniuShouldUseQiniuFileName) { | |
91 | + formData['key'] = fileName | |
92 | + } | |
93 | + wx.uploadFile({ | |
94 | + url: url, | |
95 | + filePath: filePath, | |
96 | + name: 'file', | |
97 | + formData: formData, | |
98 | + success: function (res) { | |
99 | + var dataString = res.data | |
100 | + try { | |
101 | + var dataObject = JSON.parse(dataString); | |
102 | + //do something | |
103 | + var imageUrl = config.qiniuImageURLPrefix + '/' + dataObject.key; | |
104 | + dataObject.imageURL = imageUrl; | |
105 | + console.log(dataObject); | |
106 | + if (success) { | |
107 | + success(dataObject); | |
108 | + } | |
109 | + } catch(e) { | |
110 | + console.log('parse JSON failed, origin String is: ' + dataString) | |
111 | + if (fail) { | |
112 | + fail(e); | |
113 | + } | |
114 | + } | |
115 | + }, | |
116 | + fail: function (error) { | |
117 | + console.error(error); | |
118 | + if (fail) { | |
119 | + fail(error); | |
120 | + } | |
121 | + } | |
122 | + }) | |
123 | +} | |
124 | + | |
125 | +function getQiniuToken(callback) { | |
126 | + wx.request({ | |
127 | + url: config.qiniuUploadTokenURL, | |
128 | + success: function (res) { | |
129 | + var token = res.data.uptoken; | |
130 | + if (token && token.length > 0) { | |
131 | + config.qiniuUploadToken = token; | |
132 | + if (callback) { | |
133 | + callback(); | |
134 | + } | |
135 | + } else { | |
136 | + console.error('qiniuUploader cannot get your token, please check the uptokenURL or server') | |
137 | + } | |
138 | + }, | |
139 | + fail: function (error) { | |
140 | + console.error('qiniu UploadToken is null, please check the init config or networking: ' + error); | |
141 | + } | |
142 | + }) | |
143 | +} | |
144 | + | |
145 | +function uploadURLFromRegionCode(code) { | |
146 | + var uploadURL = null; | |
147 | + switch(code) { | |
148 | + case 'ECN': uploadURL = 'https://up.qbox.me'; break; | |
149 | + case 'NCN': uploadURL = 'https://up-z1.qbox.me'; break; | |
150 | + case 'SCN': uploadURL = 'https://up-z2.qbox.me'; break; | |
151 | + case 'NA': uploadURL = 'https://up-na0.qbox.me'; break; | |
152 | + default: console.error('please make the region is with one of [ECN, SCN, NCN, NA]'); | |
153 | + } | |
154 | + return uploadURL; | |
155 | +} | |
156 | + | |
157 | +})(); |