正在显示
17 个修改的文件
包含
372 行增加
和
103 行删除
@@ -151,7 +151,7 @@ App({ | @@ -151,7 +151,7 @@ App({ | ||
151 | let params = { | 151 | let params = { |
152 | code: res.code | 152 | code: res.code |
153 | } | 153 | } |
154 | - that.post(url, params).then((res) => { | 154 | + that.post(url, params ).then((res) => { |
155 | let url = 'index/setStatisticsVisitorLog'; | 155 | let url = 'index/setStatisticsVisitorLog'; |
156 | let params = { | 156 | let params = { |
157 | 'doctor_id': that.globalData.doctorid, | 157 | 'doctor_id': that.globalData.doctorid, |
1 | { | 1 | { |
2 | - | ||
3 | "pages": [ | 2 | "pages": [ |
4 | "pages/start/start", | 3 | "pages/start/start", |
5 | "pages/index/index", | 4 | "pages/index/index", |
@@ -20,7 +19,8 @@ | @@ -20,7 +19,8 @@ | ||
20 | "pages/map/map", | 19 | "pages/map/map", |
21 | "pages/editfile/editfile", | 20 | "pages/editfile/editfile", |
22 | "pages/editrecord/editrecord", | 21 | "pages/editrecord/editrecord", |
23 | - "pages/agreement/agreement" | 22 | + "pages/agreement/agreement", |
23 | + "pages/file_choose/file_choose" | ||
24 | ], | 24 | ], |
25 | "window": { | 25 | "window": { |
26 | "backgroundTextStyle": "light", | 26 | "backgroundTextStyle": "light", |
@@ -27,6 +27,14 @@ | @@ -27,6 +27,14 @@ | ||
27 | .wxParse-img{ | 27 | .wxParse-img{ |
28 | width:100% !important; | 28 | width:100% !important; |
29 | } | 29 | } |
30 | +.nodata{ | ||
31 | + width: 100%; | ||
32 | + height: 60px; | ||
33 | + line-height: 60px; | ||
34 | + text-align: center; | ||
35 | + font-size: 15px; | ||
36 | + color: #ccc; | ||
37 | +} | ||
30 | @font-face {font-family: "iconfont"; | 38 | @font-face {font-family: "iconfont"; |
31 | src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388'); /* IE9*/ | 39 | src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388'); /* IE9*/ |
32 | src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388#iefix') format('embedded-opentype'), /* IE6-IE8 */ | 40 | src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
@@ -153,8 +153,8 @@ Page({ | @@ -153,8 +153,8 @@ Page({ | ||
153 | let err = ''; | 153 | let err = ''; |
154 | if (that.data.files_id == '') { | 154 | if (that.data.files_id == '') { |
155 | err = '患者id不能为空' | 155 | err = '患者id不能为空' |
156 | - } else if (that.data.drug == '请选择用药') { | ||
157 | - err = '请选择用药' | 156 | + } else if (that.data.drug == '') { |
157 | + err = '请输入用药' | ||
158 | } else if (that.data.date == '请选择时间') { | 158 | } else if (that.data.date == '请选择时间') { |
159 | err = '请停药日期' | 159 | err = '请停药日期' |
160 | } else if (that.data.date1 == '请选择时间') { | 160 | } else if (that.data.date1 == '请选择时间') { |
@@ -187,7 +187,7 @@ Page({ | @@ -187,7 +187,7 @@ Page({ | ||
187 | remark: that.data.remarks, | 187 | remark: that.data.remarks, |
188 | images: that.data.upimg | 188 | images: that.data.upimg |
189 | } | 189 | } |
190 | - app.post(url, params, header).then((res) => { | 190 | + app.post(url, params,header).then((res) => { |
191 | wx.showModal({ | 191 | wx.showModal({ |
192 | title: '成功', | 192 | title: '成功', |
193 | content: '添加记录成功', | 193 | content: '添加记录成功', |
pages/file_choose/file_choose.js
0 → 100644
1 | +// pages/file_manage/file_manage.js | ||
2 | +// 请注意常量的命名必须是Page | ||
3 | +const Page = require('../../utils/ald-stat.js').Page; | ||
4 | +const app = getApp(); | ||
5 | +Page({ | ||
6 | + | ||
7 | + /** | ||
8 | + * 页面的初始数据 | ||
9 | + */ | ||
10 | + data: { | ||
11 | + datalist: [], | ||
12 | + files_id: '', | ||
13 | + show: true,//是否显示选择项 | ||
14 | + hadData: true | ||
15 | + }, | ||
16 | + goaddfile() { | ||
17 | + wx.navigateTo({ | ||
18 | + url: '/pages/addfile/addfile', | ||
19 | + success: function (res) { }, | ||
20 | + fail: function (res) { }, | ||
21 | + complete: function (res) { }, | ||
22 | + }) | ||
23 | + }, | ||
24 | + setstate(e) { | ||
25 | + let that = this; | ||
26 | + let index = e.currentTarget.dataset.index; | ||
27 | + let datalist = this.data.datalist; | ||
28 | + let url = 'user/setDefaultFilesId'; | ||
29 | + let header = { | ||
30 | + 'XX-Token': wx.getStorageSync('token'), | ||
31 | + 'XX-Device-Type': '' | ||
32 | + } | ||
33 | + let params = { | ||
34 | + fields_id: e.currentTarget.id | ||
35 | + } | ||
36 | + app.post(url, params, header).then((res) => { | ||
37 | + for (let obj of datalist) { | ||
38 | + obj.state = false; | ||
39 | + } | ||
40 | + datalist[index].state = true; | ||
41 | + that.setData({ | ||
42 | + datalist: datalist | ||
43 | + }) | ||
44 | + wx.showToast({ | ||
45 | + title: '切换成功', | ||
46 | + icon: 'success', | ||
47 | + duration: 1000, | ||
48 | + success: function(res) { | ||
49 | + | ||
50 | + }, | ||
51 | + fail: function(res) {}, | ||
52 | + complete: function(res) {}, | ||
53 | + }) | ||
54 | + setTimeout(()=>{ | ||
55 | + wx.switchTab({ | ||
56 | + url: '/pages/index/index', | ||
57 | + }) | ||
58 | + },1000) | ||
59 | + // wx.showModal({ | ||
60 | + // title: '提示', | ||
61 | + // content: '设置成功', | ||
62 | + // showCancel: false, | ||
63 | + // success: function (res) { | ||
64 | + // if (res.cancel) { | ||
65 | + // } else { | ||
66 | + | ||
67 | + // } | ||
68 | + // }, | ||
69 | + // fail: function (res) { }, | ||
70 | + // complete: function (res) { }, | ||
71 | + // }) | ||
72 | + | ||
73 | + }).catch((errMsg) => { | ||
74 | + console.log(errMsg) | ||
75 | + }) | ||
76 | + | ||
77 | + }, | ||
78 | + //获取档案列表 | ||
79 | + getFilesList() { | ||
80 | + let that = this; | ||
81 | + let header = { | ||
82 | + 'XX-Token': wx.getStorageSync('token'), | ||
83 | + 'XX-Device-Type': ''//不知道啥含义 | ||
84 | + } | ||
85 | + let url = 'user/getFilesList'; | ||
86 | + app.post(url, {}, header).then((res) => { | ||
87 | + let list = res; | ||
88 | + | ||
89 | + for (let obj of list) { | ||
90 | + obj.state = false; | ||
91 | + if (obj.id == that.data.files_id) { | ||
92 | + obj.state = true | ||
93 | + } | ||
94 | + } | ||
95 | + that.setData({ | ||
96 | + datalist: list | ||
97 | + }) | ||
98 | + console.log(res) | ||
99 | + }).catch((errMsg) => { | ||
100 | + console.log(errMsg) | ||
101 | + }) | ||
102 | + }, | ||
103 | + //编辑档案 | ||
104 | + goeditfile(e) { | ||
105 | + console.log(e.currentTarget.dataset.obj) | ||
106 | + wx.navigateTo({ | ||
107 | + url: '/pages/editfile/editfile?obj=' + JSON.stringify(e.currentTarget.dataset.obj), | ||
108 | + success: function (res) { }, | ||
109 | + fail: function (res) { }, | ||
110 | + complete: function (res) { }, | ||
111 | + }) | ||
112 | + | ||
113 | + }, | ||
114 | + /** | ||
115 | + * 生命周期函数--监听页面加载 | ||
116 | + */ | ||
117 | + onLoad: function (options) { | ||
118 | + let that = this; | ||
119 | + app.setStatisticsVisitorLog('/pages/file_manage/file_manage'); | ||
120 | + if (options.files_id != undefined) { | ||
121 | + that.setData({ | ||
122 | + files_id: options.files_id | ||
123 | + }) | ||
124 | + } | ||
125 | + if (options.show != undefined) { | ||
126 | + that.setData({ | ||
127 | + show: false | ||
128 | + }) | ||
129 | + } | ||
130 | + that.getFilesList(); | ||
131 | + }, | ||
132 | + | ||
133 | + /** | ||
134 | + * 生命周期函数--监听页面初次渲染完成 | ||
135 | + */ | ||
136 | + onReady: function () { | ||
137 | + | ||
138 | + }, | ||
139 | + | ||
140 | + /** | ||
141 | + * 生命周期函数--监听页面显示 | ||
142 | + */ | ||
143 | + onShow: function () { | ||
144 | + let that = this; | ||
145 | + that.getFilesList(); | ||
146 | + }, | ||
147 | + | ||
148 | + /** | ||
149 | + * 生命周期函数--监听页面隐藏 | ||
150 | + */ | ||
151 | + onHide: function () { | ||
152 | + | ||
153 | + }, | ||
154 | + | ||
155 | + /** | ||
156 | + * 生命周期函数--监听页面卸载 | ||
157 | + */ | ||
158 | + onUnload: function () { | ||
159 | + | ||
160 | + }, | ||
161 | + | ||
162 | + /** | ||
163 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
164 | + */ | ||
165 | + onPullDownRefresh: function () { | ||
166 | + | ||
167 | + }, | ||
168 | + | ||
169 | + /** | ||
170 | + * 页面上拉触底事件的处理函数 | ||
171 | + */ | ||
172 | + onReachBottom: function () { | ||
173 | + | ||
174 | + }, | ||
175 | + | ||
176 | + /** | ||
177 | + * 用户点击右上角分享 | ||
178 | + */ | ||
179 | + onShareAppMessage: function () { | ||
180 | + | ||
181 | + } | ||
182 | +}) |
pages/file_choose/file_choose.json
0 → 100644
1 | +{} |
pages/file_choose/file_choose.wxml
0 → 100644
1 | +<!--pages/file_manage/file_manage.wxml--> | ||
2 | +<view class='addfile' bindtap='goaddfile'> | ||
3 | + <view class='addfile_left'> | ||
4 | + <view class='addfile_img'> | ||
5 | + <image src='../../img/jia.png'></image> | ||
6 | + </view> | ||
7 | + <view>添加新档案</view> | ||
8 | + </view> | ||
9 | + <view class='iconfont icon-xiangyou'></view> | ||
10 | +</view> | ||
11 | +<view class='manage'> | ||
12 | + <view class='manage_item' wx:for='{{datalist}}' wx:key bindtap='setstate' data-index='{{index}}' id='{{item.id}}' data-obj='{{item}}'> | ||
13 | + <view class='manage_left'> | ||
14 | + <view>{{item.patient}} | ||
15 | + <text class='txt_sex'>{{item.sex_string}}</text>{{item.age}}岁</view> | ||
16 | + <view class='sub_item'>{{item.disease_name}}</view> | ||
17 | + </view> | ||
18 | + <view wx:if='{{show}}'> | ||
19 | + <view class='manage_right' wx:if='{{item.state}}' > | ||
20 | + <image src='../../img/choose_yes.png'></image> | ||
21 | + </view> | ||
22 | + <view class='manage_right' wx:else > | ||
23 | + <image src='../../img/choose_no.png'></image> | ||
24 | + </view> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | + | ||
28 | +</view> |
pages/file_choose/file_choose.wxss
0 → 100644
@@ -10,7 +10,8 @@ Page({ | @@ -10,7 +10,8 @@ Page({ | ||
10 | data: { | 10 | data: { |
11 | datalist:[], | 11 | datalist:[], |
12 | files_id:'', | 12 | files_id:'', |
13 | - show:true//是否显示选择项 | 13 | + show:true,//是否显示选择项 |
14 | + hadData: true | ||
14 | }, | 15 | }, |
15 | goaddfile(){ | 16 | goaddfile(){ |
16 | wx.navigateTo({ | 17 | wx.navigateTo({ |
@@ -70,7 +71,12 @@ Page({ | @@ -70,7 +71,12 @@ Page({ | ||
70 | } | 71 | } |
71 | let url ='user/getFilesList'; | 72 | let url ='user/getFilesList'; |
72 | app.post(url,{},header).then((res)=>{ | 73 | app.post(url,{},header).then((res)=>{ |
73 | - const list = res; | 74 | + let list = res; |
75 | + if(res.length<1){ | ||
76 | + that.setData({ | ||
77 | + hadData: false | ||
78 | + }) | ||
79 | + } | ||
74 | for (let obj of list){ | 80 | for (let obj of list){ |
75 | obj.state=false; | 81 | obj.state=false; |
76 | if (obj.id == that.data.files_id){ | 82 | if (obj.id == that.data.files_id){ |
@@ -8,7 +8,8 @@ | @@ -8,7 +8,8 @@ | ||
8 | </view> | 8 | </view> |
9 | <view class='iconfont icon-xiangyou'></view> | 9 | <view class='iconfont icon-xiangyou'></view> |
10 | </view> | 10 | </view> |
11 | -<view class='manage'> | 11 | + |
12 | +<view class='manage' wx:if="{{hadData}}"> | ||
12 | <view class='manage_item' wx:for='{{datalist}}' wx:key bindtap='goeditfile' data-obj='{{item}}'> | 13 | <view class='manage_item' wx:for='{{datalist}}' wx:key bindtap='goeditfile' data-obj='{{item}}'> |
13 | <view class='manage_left'> | 14 | <view class='manage_left'> |
14 | <view>{{item.patient}} | 15 | <view>{{item.patient}} |
@@ -24,5 +25,6 @@ | @@ -24,5 +25,6 @@ | ||
24 | </view> | 25 | </view> |
25 | </view> | 26 | </view> |
26 | </view> | 27 | </view> |
27 | - | ||
28 | </view> | 28 | </view> |
29 | + | ||
30 | +<view class='nodata' wx:else>您还没有建立档案哦</view> |
@@ -8,7 +8,7 @@ Page({ | @@ -8,7 +8,7 @@ Page({ | ||
8 | * 页面的初始数据 | 8 | * 页面的初始数据 |
9 | */ | 9 | */ |
10 | data: { | 10 | data: { |
11 | - showdoctor: true, //是否显示首页医生信息 | 11 | + showdoctor: false, //是否显示首页医生信息 |
12 | show_notest: false, //显示有记录和无记录之间的切换 | 12 | show_notest: false, //显示有记录和无记录之间的切换 |
13 | showfilesLog: false, //是否显示最新记录(没有记录不显示) | 13 | showfilesLog: false, //是否显示最新记录(没有记录不显示) |
14 | showdoc_adv:true, | 14 | showdoc_adv:true, |
@@ -16,6 +16,7 @@ Page({ | @@ -16,6 +16,7 @@ Page({ | ||
16 | filesLogdata: '', //档案数量 | 16 | filesLogdata: '', //档案数量 |
17 | doctorinfo: [], //医生信息 | 17 | doctorinfo: [], //医生信息 |
18 | fileslog: {}, //最新记录 | 18 | fileslog: {}, //最新记录 |
19 | + hasToken: false | ||
19 | }, | 20 | }, |
20 | goaddrecord(files_id, patient) { | 21 | goaddrecord(files_id, patient) { |
21 | wx.navigateTo({ | 22 | wx.navigateTo({ |
@@ -64,9 +65,12 @@ Page({ | @@ -64,9 +65,12 @@ Page({ | ||
64 | }) | 65 | }) |
65 | } | 66 | } |
66 | }, | 67 | }, |
68 | + addrecord(e){ | ||
69 | + this.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient); | ||
70 | + }, | ||
67 | gofile_manage(files_id) { | 71 | gofile_manage(files_id) { |
68 | wx.navigateTo({ | 72 | wx.navigateTo({ |
69 | - url: '/pages/file_manage/file_manage?files_id=' + files_id, | 73 | + url: '/pages/file_choose/file_choose?files_id=' + files_id, |
70 | }) | 74 | }) |
71 | }, | 75 | }, |
72 | //到文章详情 | 76 | //到文章详情 |
@@ -90,14 +94,18 @@ Page({ | @@ -90,14 +94,18 @@ Page({ | ||
90 | that.getRecommendArticleList(openid, res.doctor_id); | 94 | that.getRecommendArticleList(openid, res.doctor_id); |
91 | if (res.doctor_id == 0) { //没有关联医生 | 95 | if (res.doctor_id == 0) { //没有关联医生 |
92 | if (app.globalData.doctorid == 0) { //没有传过来的doctorid | 96 | if (app.globalData.doctorid == 0) { //没有传过来的doctorid |
97 | + | ||
98 | + } else { | ||
93 | that.setData({ | 99 | that.setData({ |
94 | - showdoctor: false | 100 | + showdoctor: true |
95 | }) | 101 | }) |
96 | - } else { | ||
97 | that.getDoctorInfo(app.globalData.doctorid); | 102 | that.getDoctorInfo(app.globalData.doctorid); |
98 | that.bindDoctor(openid,app.globalData.doctorid); | 103 | that.bindDoctor(openid,app.globalData.doctorid); |
99 | } | 104 | } |
100 | } else { //有关联医生获取医生详情 | 105 | } else { //有关联医生获取医生详情 |
106 | + that.setData({ | ||
107 | + showdoctor: true | ||
108 | + }) | ||
101 | app.globalData.doctor_id = res.doctor_id; | 109 | app.globalData.doctor_id = res.doctor_id; |
102 | app.globalData.doctorid = res.doctorid; | 110 | app.globalData.doctorid = res.doctorid; |
103 | that.getDoctorInfo(res.doctorid); | 111 | that.getDoctorInfo(res.doctorid); |
@@ -169,6 +177,9 @@ Page({ | @@ -169,6 +177,9 @@ Page({ | ||
169 | complete: function(res) {}, | 177 | complete: function(res) {}, |
170 | }) | 178 | }) |
171 | }, | 179 | }, |
180 | + switchUser(e){ | ||
181 | + this.gofile_manage(e.currentTarget.dataset.files_id); | ||
182 | + }, | ||
172 | //获取最新病情记录 | 183 | //获取最新病情记录 |
173 | getLastFilesLog(openid) { | 184 | getLastFilesLog(openid) { |
174 | let that = this; | 185 | let that = this; |
@@ -217,9 +228,9 @@ Page({ | @@ -217,9 +228,9 @@ Page({ | ||
217 | }, | 228 | }, |
218 | //授权 | 229 | //授权 |
219 | getopwer(e) { | 230 | getopwer(e) { |
231 | + console.log(e) | ||
220 | let that = this; | 232 | let that = this; |
221 | - console.log('token',wx.getStorageSync('token')); | ||
222 | - if (wx.getStorageSync('token') == undefined || wx.getStorageSync('token') == ''){ | 233 | + if (e.detail.encryptedData){ |
223 | wx.login({ | 234 | wx.login({ |
224 | success: (res) => { | 235 | success: (res) => { |
225 | let url = 'public/login'; | 236 | let url = 'public/login'; |
@@ -231,51 +242,52 @@ Page({ | @@ -231,51 +242,52 @@ Page({ | ||
231 | } | 242 | } |
232 | app.post(url, params).then((res) => { | 243 | app.post(url, params).then((res) => { |
233 | wx.setStorageSync('token', res.token); | 244 | wx.setStorageSync('token', res.token); |
234 | - if (e.currentTarget.dataset.tag == '1') { | 245 | + that.setData({ |
246 | + hasToken: true | ||
247 | + }) | ||
248 | + // if (e.currentTarget.dataset.tag == '1') { | ||
235 | that.goaddfile(); | 249 | that.goaddfile(); |
236 | - } else if (e.currentTarget.dataset.tag == '2') { | ||
237 | - that.gofile_manage(e.currentTarget.dataset.files_id); | ||
238 | - } else if (e.currentTarget.dataset.tag == '3') { | ||
239 | - that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient); | ||
240 | - } | 250 | + // } else if (e.currentTarget.dataset.tag == '2') { |
251 | + // that.gofile_manage(e.currentTarget.dataset.files_id); | ||
252 | + // } else if (e.currentTarget.dataset.tag == '3') { | ||
253 | + // that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient); | ||
254 | + // } | ||
241 | }).catch((errMsg) => { | 255 | }).catch((errMsg) => { |
242 | console.log(errMsg) | 256 | console.log(errMsg) |
243 | }) | 257 | }) |
244 | } | 258 | } |
245 | }) | 259 | }) |
246 | }else{ | 260 | }else{ |
247 | - if (e.currentTarget.dataset.tag == '1') { | ||
248 | - that.goaddfile(); | ||
249 | - } else if (e.currentTarget.dataset.tag == '2') { | ||
250 | - that.gofile_manage(e.currentTarget.dataset.files_id); | ||
251 | - } else if (e.currentTarget.dataset.tag == '3') { | ||
252 | - that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient); | ||
253 | - } | 261 | + wx.showToast({ |
262 | + title: '授权后才能正常使用', | ||
263 | + icon:'none' | ||
264 | + }) | ||
254 | } | 265 | } |
266 | + // if (wx.getStorageSync('token') == undefined || wx.getStorageSync('token') == ''){ | ||
267 | + | ||
268 | + // }else{ | ||
269 | + // if (e.currentTarget.dataset.tag == '1') { | ||
270 | + // that.goaddfile(); | ||
271 | + // } else if (e.currentTarget.dataset.tag == '2') { | ||
272 | + // that.gofile_manage(e.currentTarget.dataset.files_id); | ||
273 | + // } else if (e.currentTarget.dataset.tag == '3') { | ||
274 | + // that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient); | ||
275 | + // } | ||
276 | + // } | ||
255 | }, | 277 | }, |
256 | 278 | ||
257 | /** | 279 | /** |
258 | * 生命周期函数--监听页面加载 | 280 | * 生命周期函数--监听页面加载 |
259 | */ | 281 | */ |
260 | onLoad: function(options) { | 282 | onLoad: function(options) { |
261 | - let that = this; | ||
262 | - wx.login({ | ||
263 | - success: (res) => { | ||
264 | - let url = 'public/getSessionKey'; | ||
265 | - let params = { | ||
266 | - code: res.code | ||
267 | - } | ||
268 | - app.post(url, params).then((res) => { | ||
269 | - wx.setStorageSync('openid', res.openid) | ||
270 | - that.ifdoctorid(res.openid); //判断是否有医生ID | ||
271 | - that.getFilesNumber(res.openid); //获取档案数量 | ||
272 | - that.getLastFilesLog(res.openid); | ||
273 | - app.setStatisticsVisitorLog('/pages/index/index'); //统计打开界面数量 | ||
274 | - }).catch((errMsg) => { | ||
275 | - console.log(errMsg) | 283 | + // var openid = wx.getStorageSync('openid'); |
284 | + let token = wx.getStorageSync('token'); | ||
285 | + // 判断是否授权设置授权权限 | ||
286 | + if(token){ | ||
287 | + this.setData({ | ||
288 | + hasToken: true | ||
276 | }) | 289 | }) |
277 | } | 290 | } |
278 | - }) | ||
279 | }, | 291 | }, |
280 | /** | 292 | /** |
281 | * 生命周期函数--监听页面初次渲染完成 | 293 | * 生命周期函数--监听页面初次渲染完成 |
@@ -286,22 +298,13 @@ Page({ | @@ -286,22 +298,13 @@ Page({ | ||
286 | */ | 298 | */ |
287 | onShow: function(options) { | 299 | onShow: function(options) { |
288 | let that = this; | 300 | let that = this; |
289 | - wx.login({ | ||
290 | - success: (res) => { | ||
291 | - let url = 'public/getSessionKey'; | ||
292 | - let params = { | ||
293 | - code: res.code | ||
294 | - } | ||
295 | - app.post(url, params).then((res) => { | ||
296 | - that.ifdoctorid(res.openid); //判断是否有医生ID | 301 | + var openid = wx.getStorageSync('openid'); |
302 | + let token = wx.getStorageSync('token'); | ||
303 | + this.ifdoctorid(openid); //判断是否有医生ID | ||
304 | + this.getFilesNumber(openid); //获取档案数量 | ||
305 | + this.getLastFilesLog(openid); | ||
306 | + app.setStatisticsVisitorLog('/pages/index/index'); //统计打开界面数量 | ||
297 | 307 | ||
298 | - that.getFilesNumber(res.openid); //获取档案数量 | ||
299 | - that.getLastFilesLog(res.openid); | ||
300 | - }).catch((errMsg) => { | ||
301 | - console.log(errMsg) | ||
302 | - }) | ||
303 | - } | ||
304 | - }) | ||
305 | }, | 308 | }, |
306 | /** | 309 | /** |
307 | * 生命周期函数--监听页面隐藏 | 310 | * 生命周期函数--监听页面隐藏 |
@@ -17,11 +17,11 @@ | @@ -17,11 +17,11 @@ | ||
17 | <view class='test_frist'> | 17 | <view class='test_frist'> |
18 | <view class='dot'></view> | 18 | <view class='dot'></view> |
19 | 记录血项测评结果,并获得专家建议和正确医学科普知识。 | 19 | 记录血项测评结果,并获得专家建议和正确医学科普知识。 |
20 | - <view class='button_box'> | ||
21 | - <button open-type="getUserInfo" bindgetuserinfo='getopwer' data-tag='1'></button> | ||
22 | - <view class='jia_box'> | 20 | + <view class='button_box' > |
21 | + <view class='jia_box' wx:if='{{hasToken}}' bindtap='goaddfile'> | ||
23 | <view class='iconfont icon-jia'></view> | 22 | <view class='iconfont icon-jia'></view> |
24 | </view> | 23 | </view> |
24 | + <button open-type="getUserInfo" wx:else class='jia_box' bindgetuserinfo='getopwer' data-tag='1'><view class='iconfont icon-jia'></view></button> | ||
25 | <view class='jia_txt'>添加血项检测记录</view> | 25 | <view class='jia_txt'>添加血项检测记录</view> |
26 | </view> | 26 | </view> |
27 | </view> | 27 | </view> |
@@ -29,8 +29,7 @@ | @@ -29,8 +29,7 @@ | ||
29 | <view class='index_twotest' wx:else> | 29 | <view class='index_twotest' wx:else> |
30 | <view class='index_twotab'> | 30 | <view class='index_twotab'> |
31 | <view>用户:{{fileslog.patient}} {{fileslog.age}}岁</view> | 31 | <view>用户:{{fileslog.patient}} {{fileslog.age}}岁</view> |
32 | - <view class='twotab' wx:if='{{filesLogdata > 1}}'> | ||
33 | - <button class='twotab_button' open-type='getUserInfo' bindgetuserinfo='getopwer' data-tag='2' data-files_id='{{fileslog.files_id}}'></button> | 32 | + <view class='twotab' bindtap='switchUser' data-files_id='{{fileslog.files_id}}' wx:if="{{filesLogdata>1}}"> |
34 | 切换用户 | 33 | 切换用户 |
35 | </view> | 34 | </view> |
36 | </view> | 35 | </view> |
@@ -42,7 +41,7 @@ | @@ -42,7 +41,7 @@ | ||
42 | </view> | 41 | </view> |
43 | </view> | 42 | </view> |
44 | <view class='two_item_box' wx:if='{{showfilesLog}}'> | 43 | <view class='two_item_box' wx:if='{{showfilesLog}}'> |
45 | - <view class="two_item two_items {{fileslog.more.white_blood_cell_result=='正常'?'':'danger'}} " > | 44 | + <view class="two_item two_items {{fileslog.more.white_blood_cell_result=='正常'?'':'danger'}} "> |
46 | <view class='two_items_left'> | 45 | <view class='two_items_left'> |
47 | <view class='two_txt'>白细胞计数</view> | 46 | <view class='two_txt'>白细胞计数</view> |
48 | <view class='two_state' bindtap='gonormal'> | 47 | <view class='two_state' bindtap='gonormal'> |
@@ -68,7 +67,7 @@ | @@ -68,7 +67,7 @@ | ||
68 | <view class="two_item_rigth"> | 67 | <view class="two_item_rigth"> |
69 | <text class='two_num'> {{fileslog.more.neutrophils}}</text>*10^9/L</view> | 68 | <text class='two_num'> {{fileslog.more.neutrophils}}</text>*10^9/L</view> |
70 | </view> | 69 | </view> |
71 | - <view class="two_item two_items {{fileslog.more.hemoglobin_result=='正常'?'':'danger'}} " > | 70 | + <view class="two_item two_items {{fileslog.more.hemoglobin_result=='正常'?'':'danger'}} "> |
72 | <view class='two_items_left'> | 71 | <view class='two_items_left'> |
73 | <view class='two_txt'>血红蛋白</view> | 72 | <view class='two_txt'>血红蛋白</view> |
74 | <view class='two_state' bindtap='gonormal'> | 73 | <view class='two_state' bindtap='gonormal'> |
@@ -100,20 +99,24 @@ | @@ -100,20 +99,24 @@ | ||
100 | <view>医生建议:</view> | 99 | <view>医生建议:</view> |
101 | <view class='two_item_content'>{{fileslog.doctor_reply == null ? '等待医生回复':fileslog.doctor_reply}}</view> | 100 | <view class='two_item_content'>{{fileslog.doctor_reply == null ? '等待医生回复':fileslog.doctor_reply}}</view> |
102 | </view> | 101 | </view> |
103 | - <view class='two_item two_items'> | 102 | + |
103 | + <!-- 授权判断 --> | ||
104 | + <view class='two_item two_items' > | ||
104 | <view class='two_item_yuan_box' bindtap='gorecord' data-files_id='{{fileslog.files_id}}' data-showrecord='1'> | 105 | <view class='two_item_yuan_box' bindtap='gorecord' data-files_id='{{fileslog.files_id}}' data-showrecord='1'> |
105 | <view class='two_item_yuan'> | 106 | <view class='two_item_yuan'> |
106 | <image src='../../img/qst.png'></image> | 107 | <image src='../../img/qst.png'></image> |
107 | </view> | 108 | </view> |
108 | <view>趋势图</view> | 109 | <view>趋势图</view> |
109 | </view> | 110 | </view> |
110 | - <view class='two_item_yuan_box'> | ||
111 | - <button class='two_item_yuan_box_button' open-type='getUserInfo' bindgetuserinfo='getopwer' data-tag='3' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}'></button> | 111 | + |
112 | + <view class='two_item_yuan_box' bindtap='addrecord' data-tag='3' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}'> | ||
113 | + <!-- <button class='two_item_yuan_box_button' open-type='getUserInfo' bindgetuserinfo='getopwer' data-tag='3' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}' ></button> --> | ||
112 | <view class='jia_box two_jiabox'> | 114 | <view class='jia_box two_jiabox'> |
113 | <view class='iconfont icon-jia'></view> | 115 | <view class='iconfont icon-jia'></view> |
114 | </view> | 116 | </view> |
115 | <view>添加血项检测记录</view> | 117 | <view>添加血项检测记录</view> |
116 | </view> | 118 | </view> |
119 | + | ||
117 | <view class='two_item_yuan_box' bindtap='gorecord' data-showrecord='2' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}'> | 120 | <view class='two_item_yuan_box' bindtap='gorecord' data-showrecord='2' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}'> |
118 | <view class='two_item_yuan'> | 121 | <view class='two_item_yuan'> |
119 | <image src='../../img/bq.png'></image> | 122 | <image src='../../img/bq.png'></image> |
@@ -121,8 +124,11 @@ | @@ -121,8 +124,11 @@ | ||
121 | <view>病情记录</view> | 124 | <view>病情记录</view> |
122 | </view> | 125 | </view> |
123 | </view> | 126 | </view> |
127 | + | ||
128 | + | ||
124 | </view> | 129 | </view> |
125 | </view> | 130 | </view> |
131 | + | ||
126 | <view class='index_three'> | 132 | <view class='index_three'> |
127 | <view class='three'> | 133 | <view class='three'> |
128 | <view class='three_title'>相关文章:</view> | 134 | <view class='three_title'>相关文章:</view> |
@@ -288,10 +288,14 @@ opacity: 0; | @@ -288,10 +288,14 @@ opacity: 0; | ||
288 | .button_box{ | 288 | .button_box{ |
289 | position:relative; | 289 | position:relative; |
290 | } | 290 | } |
291 | -.button_box button{ | 291 | +button.jia_box{ |
292 | + width: 130rpx; | ||
293 | + height: 130rpx; | ||
294 | +} | ||
295 | +/* .button_box button{ | ||
292 | position: absolute; | 296 | position: absolute; |
293 | width:100%; | 297 | width:100%; |
294 | height: 100%; | 298 | height: 100%; |
295 | opacity: 0; | 299 | opacity: 0; |
296 | z-index:100; | 300 | z-index:100; |
297 | -} | ||
301 | +} */ |
@@ -11,14 +11,12 @@ Page({ | @@ -11,14 +11,12 @@ Page({ | ||
11 | }, | 11 | }, |
12 | //登陆 | 12 | //登陆 |
13 | getopwer(e){ | 13 | getopwer(e){ |
14 | - console.log(e) | ||
15 | let that = this; | 14 | let that = this; |
16 | app.globalData.userInfo = e.detail.userInfo; | 15 | app.globalData.userInfo = e.detail.userInfo; |
17 | wx.setStorageSync('userInfo', e.detail.userInfo); | 16 | wx.setStorageSync('userInfo', e.detail.userInfo); |
18 | - if (wx.getStorageSync('token') == undefined || wx.getStorageSync('token') == ''){ | 17 | + if (e.detail.encryptedData){ |
19 | wx.login({ | 18 | wx.login({ |
20 | success: (res) => { | 19 | success: (res) => { |
21 | - console.log(res); | ||
22 | let url = 'public/login'; | 20 | let url = 'public/login'; |
23 | let params = { | 21 | let params = { |
24 | code: res.code, | 22 | code: res.code, |
@@ -28,6 +26,7 @@ Page({ | @@ -28,6 +26,7 @@ Page({ | ||
28 | } | 26 | } |
29 | app.post(url, params).then((res) => { | 27 | app.post(url, params).then((res) => { |
30 | wx.setStorageSync('token', res.token); | 28 | wx.setStorageSync('token', res.token); |
29 | + wx.setStorageSync('token', res.token); | ||
31 | that.setData({ | 30 | that.setData({ |
32 | userInfo: app.globalData.userInfo, | 31 | userInfo: app.globalData.userInfo, |
33 | ifpower: true | 32 | ifpower: true |
@@ -37,6 +36,11 @@ Page({ | @@ -37,6 +36,11 @@ Page({ | ||
37 | }) | 36 | }) |
38 | } | 37 | } |
39 | }) | 38 | }) |
39 | + }else{ | ||
40 | + wx.showToast({ | ||
41 | + title: '授权登录后才能正常使用', | ||
42 | + icon: 'none' | ||
43 | + }) | ||
40 | } | 44 | } |
41 | 45 | ||
42 | }, | 46 | }, |
@@ -62,12 +66,21 @@ Page({ | @@ -62,12 +66,21 @@ Page({ | ||
62 | }) | 66 | }) |
63 | }, | 67 | }, |
64 | gofile_manage(){ | 68 | gofile_manage(){ |
69 | + let token = wx.getStorageSync('token'); | ||
70 | + if(token){ | ||
65 | wx.navigateTo({ | 71 | wx.navigateTo({ |
66 | - url: '/pages/file_manage/file_manage?show='+1, | ||
67 | - success: function(res) {}, | ||
68 | - fail: function(res) {}, | ||
69 | - complete: function(res) {}, | 72 | + url: '/pages/file_manage/file_manage?show=' + 1, |
73 | + success: function (res) { }, | ||
74 | + fail: function (res) { }, | ||
75 | + complete: function (res) { }, | ||
76 | + }) | ||
77 | + }else{ | ||
78 | + wx.showToast({ | ||
79 | + title: '请授权登录后使用', | ||
80 | + icon: 'none' | ||
70 | }) | 81 | }) |
82 | + } | ||
83 | + | ||
71 | }, | 84 | }, |
72 | goaboutme(){ | 85 | goaboutme(){ |
73 | wx.navigateTo({ | 86 | wx.navigateTo({ |
@@ -83,18 +96,7 @@ Page({ | @@ -83,18 +96,7 @@ Page({ | ||
83 | * 生命周期函数--监听页面加载 | 96 | * 生命周期函数--监听页面加载 |
84 | */ | 97 | */ |
85 | onLoad: function (options) { | 98 | onLoad: function (options) { |
86 | - let that=this; | ||
87 | - app.setStatisticsVisitorLog('/pages/my/my'); | ||
88 | - if (wx.getStorageSync('token')==undefined){ | ||
89 | - that.setData({ | ||
90 | - ifpower: false | ||
91 | - }) | ||
92 | - }else{ | ||
93 | - that.setData({ | ||
94 | - userInfo: app.globalData.userInfo, | ||
95 | - ifpower: true | ||
96 | - }) | ||
97 | - } | 99 | + |
98 | }, | 100 | }, |
99 | /** | 101 | /** |
100 | * 生命周期函数--监听页面初次渲染完成 | 102 | * 生命周期函数--监听页面初次渲染完成 |
@@ -107,7 +109,18 @@ Page({ | @@ -107,7 +109,18 @@ Page({ | ||
107 | * 生命周期函数--监听页面显示 | 109 | * 生命周期函数--监听页面显示 |
108 | */ | 110 | */ |
109 | onShow: function () { | 111 | onShow: function () { |
110 | - | 112 | + app.setStatisticsVisitorLog('/pages/my/my'); |
113 | + let that = this; | ||
114 | + let token = wx.getStorageSync('token') | ||
115 | + if (token) { | ||
116 | + that.setData({ | ||
117 | + ifpower: true | ||
118 | + }) | ||
119 | + } else { | ||
120 | + that.setData({ | ||
121 | + ifpower: false | ||
122 | + }) | ||
123 | + } | ||
111 | }, | 124 | }, |
112 | 125 | ||
113 | /** | 126 | /** |
1 | <!--pages/my/my.wxml--> | 1 | <!--pages/my/my.wxml--> |
2 | <view class='my_top'> | 2 | <view class='my_top'> |
3 | - <button class='login_btn' wx:if='{{!ifpower}}' open-type="getUserInfo" bindgetuserinfo='getopwer'> | ||
4 | - </button> | ||
5 | - <view class='my_top_content' wx:if='{{ifpower}}' > | 3 | + <view class='my_top_content'> |
6 | <view class='my_img'> | 4 | <view class='my_img'> |
7 | <open-data type="userAvatarUrl"></open-data> | 5 | <open-data type="userAvatarUrl"></open-data> |
8 | - <!-- <image src='{{userInfo.avatarUrl}}'></image> --> | ||
9 | </view> | 6 | </view> |
10 | - <!-- <view>{{userInfo.nickName}}</view> --> | ||
11 | - <view><open-data type="userNickName"></open-data></view> | 7 | + <view wx:if="{{ifpower}}"><open-data type="userNickName"></open-data></view> |
8 | + <view wx:else><button class='user_login' open-type="getUserInfo" bindgetuserinfo='getopwer'>授权登录</button></view> | ||
12 | </view> | 9 | </view> |
13 | - <view class='my_top_content' wx:else> | 10 | + <!-- <view class='my_top_content'> |
14 | <view class='my_img'> | 11 | <view class='my_img'> |
15 | <image src='../../img/no_puimg.png'></image> | 12 | <image src='../../img/no_puimg.png'></image> |
16 | </view> | 13 | </view> |
17 | - <view>点击登录</view> | ||
18 | - </view> | 14 | + <view></view> |
15 | + </view> --> | ||
19 | </view> | 16 | </view> |
20 | <view class='my_itembox'> | 17 | <view class='my_itembox'> |
21 | <view class='my_item' bindtap='gofile_manage'> | 18 | <view class='my_item' bindtap='gofile_manage'> |
@@ -75,3 +75,15 @@ page{ | @@ -75,3 +75,15 @@ page{ | ||
75 | .button_item{ | 75 | .button_item{ |
76 | padding:6rpx 30rpx; | 76 | padding:6rpx 30rpx; |
77 | } | 77 | } |
78 | +button.user_login{ | ||
79 | + line-height: 1.4; | ||
80 | + color: #FFF; | ||
81 | + background: none; | ||
82 | + font-size: 30rpx; | ||
83 | + padding-left: 6px; | ||
84 | + padding-right: 6px; | ||
85 | + border: none; | ||
86 | +} | ||
87 | +button.user_login:after{ | ||
88 | + border: 1rpx solid #FFF; | ||
89 | +} |
@@ -31,6 +31,7 @@ Page({ | @@ -31,6 +31,7 @@ Page({ | ||
31 | }) | 31 | }) |
32 | }, | 32 | }, |
33 | getopenid(){ | 33 | getopenid(){ |
34 | + wx.clearStorageSync('token') | ||
34 | let that=this; | 35 | let that=this; |
35 | wx.login({ | 36 | wx.login({ |
36 | success: (res) => { | 37 | success: (res) => { |
@@ -40,6 +41,7 @@ Page({ | @@ -40,6 +41,7 @@ Page({ | ||
40 | } | 41 | } |
41 | app.post(url, params).then((res) => { | 42 | app.post(url, params).then((res) => { |
42 | that.gettoken(res.openid) | 43 | that.gettoken(res.openid) |
44 | + wx.setStorageSync('openid', res.openid) | ||
43 | }).catch((errMsg) => { | 45 | }).catch((errMsg) => { |
44 | console.log(errMsg) | 46 | console.log(errMsg) |
45 | }) | 47 | }) |
@@ -53,10 +55,13 @@ Page({ | @@ -53,10 +55,13 @@ Page({ | ||
53 | openid: openid | 55 | openid: openid |
54 | } | 56 | } |
55 | app.post(url, params).then((res) => { | 57 | app.post(url, params).then((res) => { |
58 | + console.log(res) | ||
56 | wx.setStorageSync('token', res.token); | 59 | wx.setStorageSync('token', res.token); |
60 | + wx.setStorageSync('userInfo', res.user); | ||
57 | }).catch((errMsg) => { | 61 | }).catch((errMsg) => { |
58 | console.log(errMsg) | 62 | console.log(errMsg) |
59 | }) | 63 | }) |
64 | + | ||
60 | }, | 65 | }, |
61 | /** | 66 | /** |
62 | * 生命周期函数--监听页面加载 | 67 | * 生命周期函数--监听页面加载 |
@@ -64,6 +69,8 @@ Page({ | @@ -64,6 +69,8 @@ Page({ | ||
64 | onLoad: function (options) { | 69 | onLoad: function (options) { |
65 | let that = this; | 70 | let that = this; |
66 | console.log(options); | 71 | console.log(options); |
72 | + that.getopenid(); | ||
73 | + | ||
67 | if (options.scene != undefined) { | 74 | if (options.scene != undefined) { |
68 | var scene = decodeURIComponent(options.scene); | 75 | var scene = decodeURIComponent(options.scene); |
69 | var doctorid = scene.split("=")[1]; | 76 | var doctorid = scene.split("=")[1]; |
@@ -72,12 +79,10 @@ Page({ | @@ -72,12 +79,10 @@ Page({ | ||
72 | app.globalData.doctorid = doctorid; | 79 | app.globalData.doctorid = doctorid; |
73 | } | 80 | } |
74 | } | 81 | } |
75 | - console.log(options.doctorid); | ||
76 | if (options.doctorid != undefined) { | 82 | if (options.doctorid != undefined) { |
77 | app.globalData.doctorid = options.doctorid; | 83 | app.globalData.doctorid = options.doctorid; |
78 | } | 84 | } |
79 | that.getWelcomeInfo(); | 85 | that.getWelcomeInfo(); |
80 | - that.getopenid(); | ||
81 | }, | 86 | }, |
82 | /** | 87 | /** |
83 | * 生命周期函数--监听页面初次渲染完成 | 88 | * 生命周期函数--监听页面初次渲染完成 |
-
请 注册 或 登录 后发表评论