index.js
7.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
status: '',
buildid: '',
childrenid: '',
doctorid: '',
hospid: '',
activeid: '',
goodtail_id: '',
hospital_id:'',
hospital_address_id:''
},
onLoad: function(options) {
console.log('woshibuildid',options)
this.setData({
token: wx.getStorageSync('token'),
status: options.status,
})
if (JSON.stringify(options) != '{}') {
console.log('9999887766555454',options.buildid)
if (options.buildid!=undefined){
this.setData({
buildid: options.buildid,
})
}
if(options.hospital_id!=undefined){
this.setData({
hospital_id:options.hospital_id,
hospital_address_id:options.hospital_address_id
})
}
if (options.childrenid!=undefined){
this.setData({
childrenid: options.childrenid,
})
}
if (options.doctorid != undefined) {
this.setData({
doctorid: options.doctorid,
})
}
if (options.hospid != undefined) {
this.setData({
hospid: options.hospid,
})
}
if (options.activeid != undefined) {
this.setData({
activeid: options.activeid,
})
}
if (options.goodtail_id != undefined) {
this.setData({
goodtail_id: options.goodtail_id,
})
}
this.setData({
status: options.status,
})
}
console.log(this.data.status)
},
// 登录
start(e) {
let that = this;
console.log('666666',that.data.status)
app.globalData.userInfo = e.detail.userInfo
wx.login({
success: (res) => {
console.log(res)
let url = '/portal/common/getToken';
let params = {
code: res.code,
user_nickname: e.detail.userInfo.nickName,
avatar: e.detail.userInfo.avatarUrl, //分享进入的需要此参数
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
}
app.post(url, params).then((res) => {
console.log('99999')
wx.setStorageSync('token', res.token);
if (that.data.status != undefined) {
console.log('wohsiewuuiweurui',that.data.status)
if (that.data.status == 1) {
let buildid = that.data.buildid
wx.navigateTo({
url: "/pages/home/buildtextdetail/buildtextdetail?buildid=" + buildid,
})
} else if (that.data.status == 2) {
let childrenid = that.data.childrenid
wx.navigateTo({
url: "/pages/home/childbirthnotedetail/childbirthnotedetail?childrenid=" + childrenid,
})
} else if (that.data.status == 3) {
let doctorid = that.data.doctorid
wx.navigateTo({
url: "/pages/home/commentdoctordetail/commentdoctordetail?doctorid=" + doctorid,
})
} else if (that.data.status == 4) {
let hospid = that.data.hospid
wx.navigateTo({
url: "/pages/home/commenthospitaldetail/commenthospitaldetail?hospid=" + hospid,
})
} else if (that.data.status == 5) {
console.log('5', that.data.status)
let activeid = that.data.activeid
wx.navigateTo({
url: "/pages/cityWide/monthDetail/monthDetail?activeid=" + activeid,
})
} else if (that.data.status == 6) {
let goodtail_id = that.data.goodtail_id
wx.navigateTo({
url: "/pages/home/goodtail/goodtail_id?goodtail_id=" + goodtail_id,
})
}else if(that.data.status==7){
wx.navigateTo({
url: "/pages/home/hometail/hometail?hospital_id=" + that.data.hospital_id+'&hospital_address_id='+that.data.hospital_address_id,
})
} else{
wx.switchTab({
url: '/pages/homepage/homepage',
})
}
} else {
wx.switchTab({
url: "/pages/homepage/homepage",
})
}
}).catch((errMsg) => {
console.log(errMsg)
})
}
});
},
// enter(e){
// wx.getSetting({
// success(res) {
// console.log(res)
// console.log(res.authSetting["scope.userLocation"])
// console.log(8080)
// if (res.authSetting['scope.userLocation'] == undefined) {
// console.log(9090)
// wx.openSetting({
// })
// } else {
// console.log(666)
// //打开选择地址
// wx.getLocation({
// type: 'wgs84',
// success: function (res) {
// console.log(res)
// wx.switchTab({
// url: "/pages/homepage/homepage",
// })
// }
// })
// }
// },
// fail(res) {
// console.log('调用失败')
// }
// })
// },
navigate() {
let that = this;
console.log('99999',that.data.status)
if (that.data.status == 1) {
let buildid = that.data.buildid
wx.navigateTo({
url: "/pages/home/buildtextdetail/buildtextdetail?buildid=" + buildid,
})
} else if (that.data.status == 2) {
let childrenid = that.data.childrenid
wx.navigateTo({
url: "/pages/home/childbirthnotedetail/childbirthnotedetail?childrenid=" + childrenid,
})
} else if (that.data.status == 3) {
let doctorid = that.data.doctorid
wx.navigateTo({
url: "/pages/home/commentdoctordetail/commentdoctordetail?doctorid=" + doctorid,
})
} else if (that.data.status == 4) {
let hospid = that.data.hospid
wx.navigateTo({
url: "/pages/home/commenthospitaldetail/commenthospitaldetail?hospid=" + hospid,
})
} else if (that.data.status == 5) {
console.log('5', that.data.status)
let activeid = that.data.activeid
wx.navigateTo({
url: "/pages/cityWide/monthDetail/monthDetail?activeid=" + activeid,
})
} else if (that.data.status == 6) {
console.log(2348982934889342)
let goodtail_id = that.data.goodtail_id;
console.log('23894823489',goodtail_id)
wx.navigateTo({
url: "/pages/home/goodtail/goodtail?goodtail_id="+ goodtail_id,
})
} else {
wx.switchTab({
url: "/pages/homepage/homepage",
})
}
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
// 已登录直接跳
redirect() {
wx.navigateTo({
url: "/pages/homepage/homepage",
})
},
getUserInfo: function(e) {
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
},
// enter:function(){
// console.log(11)
// wx.switchTab({
// url: '../homepage/homepage',
// })
// }
})