正在显示
17 个修改的文件
包含
563 行增加
和
294 行删除
@@ -43,7 +43,7 @@ App({ | @@ -43,7 +43,7 @@ App({ | ||
43 | wx.showNavigationBarLoading() | 43 | wx.showNavigationBarLoading() |
44 | wx.showLoading({ | 44 | wx.showLoading({ |
45 | title: '加载中', | 45 | title: '加载中', |
46 | - }) | 46 | + }) |
47 | var promise = new Promise((resolve, reject) => { | 47 | var promise = new Promise((resolve, reject) => { |
48 | let that = this; | 48 | let that = this; |
49 | let postData = data; | 49 | let postData = data; |
@@ -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": [ | ||
4 | - "pages/start/start", | ||
5 | - "pages/index/index", | ||
6 | - "pages/aboutme/aboutme", | ||
7 | - "pages/addrecord/addrecord", | ||
8 | - "pages/addfile/addfile", | ||
9 | - "pages/introduce/introduce", | ||
10 | - "pages/my/my", | ||
11 | - "pages/opinion/opinion", | ||
12 | - "pages/record/record", | ||
13 | - "pages/normal/normal", | ||
14 | - "pages/file_manage/file_manage", | ||
15 | - "pages/article/article", | ||
16 | - "pages/mold/mold", | ||
17 | - "pages/line/line", | ||
18 | - "pages/article_detail/article_detail", | ||
19 | - "pages/ence_push/ence_push", | ||
20 | - "pages/map/map", | ||
21 | - "pages/editfile/editfile", | ||
22 | - "pages/editrecord/editrecord", | ||
23 | - "pages/agreement/agreement" | ||
24 | - ], | ||
25 | - "window": { | ||
26 | - "backgroundTextStyle": "light", | ||
27 | - "navigationBarBackgroundColor": "#3AA0EA", | ||
28 | - "navigationBarTitleText": "术后小程序", | ||
29 | - "navigationBarTextStyle": "white", | ||
30 | - "enablePullDownRefresh": false | ||
31 | - }, | ||
32 | - "tabBar": { | ||
33 | - "color": "#A1A1A1", | ||
34 | - "selectedColor": "#1CB9FA", | ||
35 | - "list": [ | ||
36 | - { | ||
37 | - "pagePath": "pages/index/index", | ||
38 | - "text": "血项测评", | ||
39 | - "iconPath": "img/x2.png", | ||
40 | - "selectedIconPath": "img/x1.png" | ||
41 | - }, | ||
42 | - { | ||
43 | - "pagePath": "pages/my/my", | ||
44 | - "text": "我的", | ||
45 | - "iconPath": "img/w2.png", | ||
46 | - "selectedIconPath": "img/w1.png" | ||
47 | - } | ||
48 | - ] | ||
49 | - } | 2 | + "pages": [ |
3 | + "pages/start/start", | ||
4 | + "pages/index/index", | ||
5 | + "pages/aboutme/aboutme", | ||
6 | + "pages/addrecord/addrecord", | ||
7 | + "pages/addfile/addfile", | ||
8 | + "pages/introduce/introduce", | ||
9 | + "pages/my/my", | ||
10 | + "pages/opinion/opinion", | ||
11 | + "pages/record/record", | ||
12 | + "pages/normal/normal", | ||
13 | + "pages/file_manage/file_manage", | ||
14 | + "pages/article/article", | ||
15 | + "pages/mold/mold", | ||
16 | + "pages/line/line", | ||
17 | + "pages/article_detail/article_detail", | ||
18 | + "pages/ence_push/ence_push", | ||
19 | + "pages/map/map", | ||
20 | + "pages/editfile/editfile", | ||
21 | + "pages/editrecord/editrecord", | ||
22 | + "pages/agreement/agreement", | ||
23 | + "pages/file_choose/file_choose" | ||
24 | + ], | ||
25 | + "window": { | ||
26 | + "backgroundTextStyle": "light", | ||
27 | + "navigationBarBackgroundColor": "#3AA0EA", | ||
28 | + "navigationBarTitleText": "术后小程序", | ||
29 | + "navigationBarTextStyle": "white", | ||
30 | + "enablePullDownRefresh": false | ||
31 | + }, | ||
32 | + "tabBar": { | ||
33 | + "color": "#A1A1A1", | ||
34 | + "selectedColor": "#1CB9FA", | ||
35 | + "list": [ | ||
36 | + { | ||
37 | + "pagePath": "pages/index/index", | ||
38 | + "text": "血项测评", | ||
39 | + "iconPath": "img/x2.png", | ||
40 | + "selectedIconPath": "img/x1.png" | ||
41 | + }, | ||
42 | + { | ||
43 | + "pagePath": "pages/my/my", | ||
44 | + "text": "我的", | ||
45 | + "iconPath": "img/w2.png", | ||
46 | + "selectedIconPath": "img/w1.png" | ||
47 | + } | ||
48 | + ] | ||
49 | + } | ||
50 | } | 50 | } |
@@ -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> |
28 | +</view> | ||
27 | 29 | ||
28 | -</view> | ||
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 | //到文章详情 |
@@ -89,15 +93,19 @@ Page({ | @@ -89,15 +93,19 @@ Page({ | ||
89 | wx.setStorageSync('token', res.token); | 93 | wx.setStorageSync('token', res.token); |
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 { | ||
99 | + that.setData({ | ||
100 | + showdoctor: true | ||
101 | + }) | ||
102 | + that.getDoctorInfo(app.globalData.doctorid); | ||
103 | + that.bindDoctor(openid,app.globalData.doctorid); | ||
104 | + } | ||
105 | + } else { //有关联医生获取医生详情 | ||
93 | that.setData({ | 106 | that.setData({ |
94 | - showdoctor: false | 107 | + showdoctor: true |
95 | }) | 108 | }) |
96 | - } else { | ||
97 | - that.getDoctorInfo(app.globalData.doctorid); | ||
98 | - that.bindDoctor(openid,app.globalData.doctorid); | ||
99 | - } | ||
100 | - } else { //有关联医生获取医生详情 | ||
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,65 +228,66 @@ Page({ | @@ -217,65 +228,66 @@ 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') == ''){ | ||
223 | - wx.login({ | ||
224 | - success: (res) => { | ||
225 | - let url = 'public/login'; | ||
226 | - let params = { | ||
227 | - code: res.code, | ||
228 | - encrypted_data: e.detail.encryptedData, | ||
229 | - iv: e.detail.iv, | ||
230 | - doctorid: app.globalData.doctorid | ||
231 | - } | ||
232 | - app.post(url, params).then((res) => { | ||
233 | - wx.setStorageSync('token', res.token); | ||
234 | - if (e.currentTarget.dataset.tag == '1') { | ||
235 | - 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 | - } | ||
241 | - }).catch((errMsg) => { | ||
242 | - console.log(errMsg) | 233 | + if (e.detail.encryptedData){ |
234 | + wx.login({ | ||
235 | + success: (res) => { | ||
236 | + let url = 'public/login'; | ||
237 | + let params = { | ||
238 | + code: res.code, | ||
239 | + encrypted_data: e.detail.encryptedData, | ||
240 | + iv: e.detail.iv, | ||
241 | + doctorid: app.globalData.doctorid | ||
242 | + } | ||
243 | + app.post(url, params).then((res) => { | ||
244 | + wx.setStorageSync('token', res.token); | ||
245 | + that.setData({ | ||
246 | + hasToken: true | ||
247 | + }) | ||
248 | + // if (e.currentTarget.dataset.tag == '1') { | ||
249 | + that.goaddfile(); | ||
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 | + // } | ||
255 | + }).catch((errMsg) => { | ||
256 | + console.log(errMsg) | ||
257 | + }) | ||
258 | + } | ||
259 | + }) | ||
260 | + }else{ | ||
261 | + wx.showToast({ | ||
262 | + title: '授权后才能正常使用', | ||
263 | + icon:'none' | ||
243 | }) | 264 | }) |
244 | - } | ||
245 | - }) | ||
246 | - }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 | } | 265 | } |
254 | - } | 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) | ||
276 | - }) | 283 | + // var openid = wx.getStorageSync('openid'); |
284 | + let token = wx.getStorageSync('token'); | ||
285 | + // 判断是否授权设置授权权限 | ||
286 | + if(token){ | ||
287 | + this.setData({ | ||
288 | + hasToken: true | ||
289 | + }) | ||
277 | } | 290 | } |
278 | - }) | ||
279 | }, | 291 | }, |
280 | /** | 292 | /** |
281 | * 生命周期函数--监听页面初次渲染完成 | 293 | * 生命周期函数--监听页面初次渲染完成 |
@@ -285,23 +297,14 @@ Page({ | @@ -285,23 +297,14 @@ Page({ | ||
285 | * 生命周期函数--监听页面显示 | 297 | * 生命周期函数--监听页面显示 |
286 | */ | 298 | */ |
287 | onShow: function(options) { | 299 | onShow: function(options) { |
288 | - 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 | ||
297 | - | ||
298 | - that.getFilesNumber(res.openid); //获取档案数量 | ||
299 | - that.getLastFilesLog(res.openid); | ||
300 | - }).catch((errMsg) => { | ||
301 | - console.log(errMsg) | ||
302 | - }) | ||
303 | - } | ||
304 | - }) | 300 | + let that = this; |
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'); //统计打开界面数量 | ||
307 | + | ||
305 | }, | 308 | }, |
306 | /** | 309 | /** |
307 | * 生命周期函数--监听页面隐藏 | 310 | * 生命周期函数--监听页面隐藏 |
1 | <view wx:if='{{showdoctor}}'> | 1 | <view wx:if='{{showdoctor}}'> |
2 | - <view class='index_item' bindtap='gointroduce' data-id='{{doctorinfo.doctor_id}}'> | ||
3 | - <view class='index_item_left'> | ||
4 | - <view class='itemimg'> | ||
5 | - <image src='{{doctorinfo.avatar}}'></image> | ||
6 | - </view> | ||
7 | - <view class='item_box'> | ||
8 | - <view class='item_box_title'>{{doctorinfo.name}}</view> | ||
9 | - <view class='item_contenr'>{{doctorinfo.department_name}} {{doctorinfo.title_name}}</view> | ||
10 | - <view>{{doctorinfo.hospital_name}}</view> | ||
11 | - </view> | 2 | + <view class='index_item' bindtap='gointroduce' data-id='{{doctorinfo.doctor_id}}'> |
3 | + <view class='index_item_left'> | ||
4 | + <view class='itemimg'> | ||
5 | + <image src='{{doctorinfo.avatar}}'></image> | ||
6 | + </view> | ||
7 | + <view class='item_box'> | ||
8 | + <view class='item_box_title'>{{doctorinfo.name}}</view> | ||
9 | + <view class='item_contenr'>{{doctorinfo.department_name}} {{doctorinfo.title_name}}</view> | ||
10 | + <view>{{doctorinfo.hospital_name}}</view> | ||
11 | + </view> | ||
12 | + </view> | ||
13 | + <view class='iconfont icon-xiangyou'></view> | ||
12 | </view> | 14 | </view> |
13 | - <view class='iconfont icon-xiangyou'></view> | ||
14 | - </view> | ||
15 | </view> | 15 | </view> |
16 | <view class='index_test' wx:if='{{show_notest}}'> | 16 | <view class='index_test' wx:if='{{show_notest}}'> |
17 | - <view class='test_frist'> | ||
18 | - <view class='dot'></view> | ||
19 | - 记录血项测评结果,并获得专家建议和正确医学科普知识。 | ||
20 | - <view class='button_box'> | ||
21 | - <button open-type="getUserInfo" bindgetuserinfo='getopwer' data-tag='1'></button> | ||
22 | - <view class='jia_box'> | ||
23 | - <view class='iconfont icon-jia'></view> | ||
24 | - </view> | ||
25 | - <view class='jia_txt'>添加血项检测记录</view> | 17 | + <view class='test_frist'> |
18 | + <view class='dot'></view> | ||
19 | + 记录血项测评结果,并获得专家建议和正确医学科普知识。 | ||
20 | + <view class='button_box' > | ||
21 | + <view class='jia_box' wx:if='{{hasToken}}' bindtap='goaddfile'> | ||
22 | + <view class='iconfont icon-jia'></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> | ||
26 | + </view> | ||
26 | </view> | 27 | </view> |
27 | - </view> | ||
28 | </view> | 28 | </view> |
29 | <view class='index_twotest' wx:else> | 29 | <view class='index_twotest' wx:else> |
30 | - <view class='index_twotab'> | ||
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> | ||
34 | - 切换用户 | ||
35 | - </view> | ||
36 | - </view> | ||
37 | - <view class='two_main'> | ||
38 | - <view class='two_item'> | ||
39 | - <view> | ||
40 | - 最近添加记录: | ||
41 | - <text class='time_txt'>{{fileslog.create_time}}</text> | 30 | + <view class='index_twotab'> |
31 | + <view>用户:{{fileslog.patient}} {{fileslog.age}}岁</view> | ||
32 | + <view class='twotab' bindtap='switchUser' data-files_id='{{fileslog.files_id}}' wx:if="{{filesLogdata>1}}"> | ||
33 | + 切换用户 | ||
42 | </view> | 34 | </view> |
43 | </view> | 35 | </view> |
44 | - <view class='two_item_box' wx:if='{{showfilesLog}}'> | ||
45 | - <view class="two_item two_items {{fileslog.more.white_blood_cell_result=='正常'?'':'danger'}} " > | ||
46 | - <view class='two_items_left'> | ||
47 | - <view class='two_txt'>白细胞计数</view> | ||
48 | - <view class='two_state' bindtap='gonormal'> | ||
49 | - <view class='iconbox'> | ||
50 | - <view class='iconfont icon-jinggao'></view> | 36 | + <view class='two_main'> |
37 | + <view class='two_item'> | ||
38 | + <view> | ||
39 | + 最近添加记录: | ||
40 | + <text class='time_txt'>{{fileslog.create_time}}</text> | ||
51 | </view> | 41 | </view> |
52 | - {{fileslog.more.white_blood_cell_result}} | ||
53 | - </view> | ||
54 | </view> | 42 | </view> |
55 | - <view class="two_item_rigth"> | ||
56 | - <text class='two_num'> {{fileslog.more.white_blood_cell}}</text>*10^9/L</view> | ||
57 | - </view> | ||
58 | - <view class="two_item two_items {{fileslog.more.neutrophils_result=='正常'?'':'danger'}} "> | ||
59 | - <view class='two_items_left'> | ||
60 | - <view class='two_txt'>中性粒细胞计数</view> | ||
61 | - <view class='two_state' bindtap='gonormal'> | ||
62 | - <view class='iconbox'> | ||
63 | - <view class='iconfont icon-jinggao'></view> | 43 | + <view class='two_item_box' wx:if='{{showfilesLog}}'> |
44 | + <view class="two_item two_items {{fileslog.more.white_blood_cell_result=='正常'?'':'danger'}} "> | ||
45 | + <view class='two_items_left'> | ||
46 | + <view class='two_txt'>白细胞计数</view> | ||
47 | + <view class='two_state' bindtap='gonormal'> | ||
48 | + <view class='iconbox'> | ||
49 | + <view class='iconfont icon-jinggao'></view> | ||
50 | + </view> | ||
51 | + {{fileslog.more.white_blood_cell_result}} | ||
52 | + </view> | ||
53 | + </view> | ||
54 | + <view class="two_item_rigth"> | ||
55 | + <text class='two_num'> {{fileslog.more.white_blood_cell}}</text>*10^9/L</view> | ||
64 | </view> | 56 | </view> |
65 | - {{fileslog.more.neutrophils_result}} | ||
66 | - </view> | ||
67 | - </view> | ||
68 | - <view class="two_item_rigth"> | ||
69 | - <text class='two_num'> {{fileslog.more.neutrophils}}</text>*10^9/L</view> | ||
70 | - </view> | ||
71 | - <view class="two_item two_items {{fileslog.more.hemoglobin_result=='正常'?'':'danger'}} " > | ||
72 | - <view class='two_items_left'> | ||
73 | - <view class='two_txt'>血红蛋白</view> | ||
74 | - <view class='two_state' bindtap='gonormal'> | ||
75 | - <view class='iconbox'> | ||
76 | - <view class='iconfont icon-jinggao'></view> | 57 | + <view class="two_item two_items {{fileslog.more.neutrophils_result=='正常'?'':'danger'}} "> |
58 | + <view class='two_items_left'> | ||
59 | + <view class='two_txt'>中性粒细胞计数</view> | ||
60 | + <view class='two_state' bindtap='gonormal'> | ||
61 | + <view class='iconbox'> | ||
62 | + <view class='iconfont icon-jinggao'></view> | ||
63 | + </view> | ||
64 | + {{fileslog.more.neutrophils_result}} | ||
65 | + </view> | ||
66 | + </view> | ||
67 | + <view class="two_item_rigth"> | ||
68 | + <text class='two_num'> {{fileslog.more.neutrophils}}</text>*10^9/L</view> | ||
77 | </view> | 69 | </view> |
78 | - {{fileslog.more.hemoglobin_result}} | ||
79 | - </view> | ||
80 | - </view> | ||
81 | - <view class="two_item_rigth"> | ||
82 | - <text class='two_num'> {{fileslog.more.hemoglobin}}</text>g/L</view> | ||
83 | - </view> | ||
84 | - <view class="two_item two_items {{fileslog.more.platelet_result=='正常'?'':'danger'}} "> | ||
85 | - <view class='two_items_left'> | ||
86 | - <view class='two_txt'>血小板计数</view> | ||
87 | - <view class='two_state' bindtap='gonormal'> | ||
88 | - <view class='iconbox'> | ||
89 | - <view class='iconfont icon-jinggao'></view> | 70 | + <view class="two_item two_items {{fileslog.more.hemoglobin_result=='正常'?'':'danger'}} "> |
71 | + <view class='two_items_left'> | ||
72 | + <view class='two_txt'>血红蛋白</view> | ||
73 | + <view class='two_state' bindtap='gonormal'> | ||
74 | + <view class='iconbox'> | ||
75 | + <view class='iconfont icon-jinggao'></view> | ||
76 | + </view> | ||
77 | + {{fileslog.more.hemoglobin_result}} | ||
78 | + </view> | ||
79 | + </view> | ||
80 | + <view class="two_item_rigth"> | ||
81 | + <text class='two_num'> {{fileslog.more.hemoglobin}}</text>g/L</view> | ||
82 | + </view> | ||
83 | + <view class="two_item two_items {{fileslog.more.platelet_result=='正常'?'':'danger'}} "> | ||
84 | + <view class='two_items_left'> | ||
85 | + <view class='two_txt'>血小板计数</view> | ||
86 | + <view class='two_state' bindtap='gonormal'> | ||
87 | + <view class='iconbox'> | ||
88 | + <view class='iconfont icon-jinggao'></view> | ||
89 | + </view> | ||
90 | + {{fileslog.more.platelet_result}} | ||
91 | + </view> | ||
92 | + </view> | ||
93 | + <view class="two_item_rigth"> | ||
94 | + <text class='two_num'> {{fileslog.more.platelet}}</text>*10^9/L</view> | ||
90 | </view> | 95 | </view> |
91 | - {{fileslog.more.platelet_result}} | ||
92 | - </view> | ||
93 | - </view> | ||
94 | - <view class="two_item_rigth"> | ||
95 | - <text class='two_num'> {{fileslog.more.platelet}}</text>*10^9/L</view> | ||
96 | - </view> | ||
97 | - </view> | ||
98 | - <view class='notest' wx:else>暂无记录</view> | ||
99 | - <view class='two_item' wx:if='{{fileslog.doctor_reply != null}}'> | ||
100 | - <view>医生建议:</view> | ||
101 | - <view class='two_item_content'>{{fileslog.doctor_reply == null ? '等待医生回复':fileslog.doctor_reply}}</view> | ||
102 | - </view> | ||
103 | - <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'> | ||
106 | - <image src='../../img/qst.png'></image> | ||
107 | </view> | 96 | </view> |
108 | - <view>趋势图</view> | ||
109 | - </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> | ||
112 | - <view class='jia_box two_jiabox'> | ||
113 | - <view class='iconfont icon-jia'></view> | 97 | + <view class='notest' wx:else>暂无记录</view> |
98 | + <view class='two_item' wx:if='{{fileslog.doctor_reply != null}}'> | ||
99 | + <view>医生建议:</view> | ||
100 | + <view class='two_item_content'>{{fileslog.doctor_reply == null ? '等待医生回复':fileslog.doctor_reply}}</view> | ||
114 | </view> | 101 | </view> |
115 | - <view>添加血项检测记录</view> | ||
116 | - </view> | ||
117 | - <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'> | ||
119 | - <image src='../../img/bq.png'></image> | 102 | + |
103 | + <!-- 授权判断 --> | ||
104 | + <view class='two_item two_items' > | ||
105 | + <view class='two_item_yuan_box' bindtap='gorecord' data-files_id='{{fileslog.files_id}}' data-showrecord='1'> | ||
106 | + <view class='two_item_yuan'> | ||
107 | + <image src='../../img/qst.png'></image> | ||
108 | + </view> | ||
109 | + <view>趋势图</view> | ||
110 | + </view> | ||
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> --> | ||
114 | + <view class='jia_box two_jiabox'> | ||
115 | + <view class='iconfont icon-jia'></view> | ||
116 | + </view> | ||
117 | + <view>添加血项检测记录</view> | ||
118 | + </view> | ||
119 | + | ||
120 | + <view class='two_item_yuan_box' bindtap='gorecord' data-showrecord='2' data-files_id='{{fileslog.files_id}}' data-patient='{{fileslog.patient}}'> | ||
121 | + <view class='two_item_yuan'> | ||
122 | + <image src='../../img/bq.png'></image> | ||
123 | + </view> | ||
124 | + <view>病情记录</view> | ||
125 | + </view> | ||
120 | </view> | 126 | </view> |
121 | - <view>病情记录</view> | ||
122 | - </view> | 127 | + |
128 | + | ||
123 | </view> | 129 | </view> |
124 | - </view> | ||
125 | </view> | 130 | </view> |
131 | + | ||
126 | <view class='index_three'> | 132 | <view class='index_three'> |
127 | - <view class='three'> | ||
128 | - <view class='three_title'>相关文章:</view> | ||
129 | - </view> | ||
130 | - <view wx:for='{{articlelist}}' wx:key> | ||
131 | - <view class='three' bindtap='goarticle_details' id='{{item.id}}'> | ||
132 | - <view class='threeimg_box'> | ||
133 | - <image src='{{item.more.thumbnail}}'></image> | ||
134 | - </view> | ||
135 | - <view class='three_txtbox'> | ||
136 | - <view class='three_txtbox_title'>{{item.post_title}}</view> | ||
137 | - <view> | ||
138 | - {{item.hospital_name}} {{item.department_name}}{{item.title_name}} {{item.doctor_name}}</view> | ||
139 | - </view> | 133 | + <view class='three'> |
134 | + <view class='three_title'>相关文章:</view> | ||
135 | + </view> | ||
136 | + <view wx:for='{{articlelist}}' wx:key> | ||
137 | + <view class='three' bindtap='goarticle_details' id='{{item.id}}'> | ||
138 | + <view class='threeimg_box'> | ||
139 | + <image src='{{item.more.thumbnail}}'></image> | ||
140 | + </view> | ||
141 | + <view class='three_txtbox'> | ||
142 | + <view class='three_txtbox_title'>{{item.post_title}}</view> | ||
143 | + <view> | ||
144 | + {{item.hospital_name}} {{item.department_name}}{{item.title_name}} {{item.doctor_name}}</view> | ||
145 | + </view> | ||
146 | + </view> | ||
147 | + </view> | ||
148 | + <view class='three just_last' bindtap='goarticle'> | ||
149 | + <view class='more'>查看更多</view> | ||
150 | + <view class='iconfont icon-xiangyou'></view> | ||
140 | </view> | 151 | </view> |
141 | - </view> | ||
142 | - <view class='three just_last' bindtap='goarticle'> | ||
143 | - <view class='more'>查看更多</view> | ||
144 | - <view class='iconfont icon-xiangyou'></view> | ||
145 | - </view> | ||
146 | </view> | 152 | </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(){ |
65 | - wx.navigateTo({ | ||
66 | - url: '/pages/file_manage/file_manage?show='+1, | ||
67 | - success: function(res) {}, | ||
68 | - fail: function(res) {}, | ||
69 | - complete: function(res) {}, | ||
70 | - }) | 69 | + let token = wx.getStorageSync('token'); |
70 | + if(token){ | ||
71 | + wx.navigateTo({ | ||
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' | ||
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'> |
@@ -74,4 +74,16 @@ page{ | @@ -74,4 +74,16 @@ page{ | ||
74 | } | 74 | } |
75 | .button_item{ | 75 | .button_item{ |
76 | padding:6rpx 30rpx; | 76 | padding:6rpx 30rpx; |
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; | ||
77 | } | 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 | }) |
@@ -50,13 +52,16 @@ Page({ | @@ -50,13 +52,16 @@ Page({ | ||
50 | let that = this; | 52 | let that = this; |
51 | let url = 'public/checkOpenid'; | 53 | let url = 'public/checkOpenid'; |
52 | let params = { | 54 | let params = { |
53 | - openid: openid | 55 | + openid: openid |
54 | } | 56 | } |
55 | app.post(url, params).then((res) => { | 57 | app.post(url, params).then((res) => { |
56 | - wx.setStorageSync('token', res.token); | 58 | + console.log(res) |
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 | * 生命周期函数--监听页面初次渲染完成 |
-
请 注册 或 登录 后发表评论