|
@@ -7,7 +7,7 @@
|
7
|
7
|
<view>
|
8
|
8
|
您好,{{ userData.name }}
|
9
|
9
|
</view>
|
10
|
|
- <view>{{userData.currentHospital.hosName}}</view>
|
|
10
|
+ <view v-if="userData.currentHospital">{{userData.currentHospital.hosName}}</view>
|
11
|
11
|
</view>
|
12
|
12
|
<!-- <button v-show="!userData.online" class="changeHospital" size="mini" type="default" @click="changeHospital">
|
13
|
13
|
切换院区
|
|
@@ -284,7 +284,7 @@
|
284
|
284
|
type: "off",
|
285
|
285
|
customWorking: "off",
|
286
|
286
|
classId: uni.getStorageSync("setDeptConfg").classesId,
|
287
|
|
- }).then((res) => {
|
|
287
|
+ }).then(async (res) => {
|
288
|
288
|
uni.hideLoading();
|
289
|
289
|
if (res.status == 200) {
|
290
|
290
|
let obj = uni.getStorageSync("userData");
|
|
@@ -299,7 +299,7 @@
|
299
|
299
|
uni.removeStorageSync("manager"); //清空选择的分组组长,初始化
|
300
|
300
|
}
|
301
|
301
|
uni.setStorageSync("userData", obj);
|
302
|
|
- this.getCurrentUser();
|
|
302
|
+ await this.getCurrentUser();
|
303
|
303
|
this.getTabData();
|
304
|
304
|
} else {
|
305
|
305
|
uni.showToast({
|
|
@@ -333,7 +333,7 @@
|
333
|
333
|
post("/auth/onOrOffLine", {
|
334
|
334
|
type: "off",
|
335
|
335
|
classId: uni.getStorageSync("setDeptConfg").classesId,
|
336
|
|
- }).then((res) => {
|
|
336
|
+ }).then(async (res) => {
|
337
|
337
|
uni.hideLoading();
|
338
|
338
|
if (res.status == 200) {
|
339
|
339
|
if (uni.getStorageSync("setDeptConfg")) {
|
|
@@ -348,7 +348,7 @@
|
348
|
348
|
let obj = uni.getStorageSync("userData");
|
349
|
349
|
obj.user.online = false;
|
350
|
350
|
uni.setStorageSync("userData", obj);
|
351
|
|
- this.getCurrentUser();
|
|
351
|
+ await this.getCurrentUser();
|
352
|
352
|
this.getTabData();
|
353
|
353
|
} else {
|
354
|
354
|
uni.showToast({
|
|
@@ -504,16 +504,22 @@
|
504
|
504
|
this.getTabData();
|
505
|
505
|
},
|
506
|
506
|
// 获取当前用户信息
|
507
|
|
- getCurrentUser() {
|
508
|
|
- if (uni.getStorageSync("userData")) {
|
509
|
|
- this.userData = uni.getStorageSync("userData").user;
|
510
|
|
- } else {
|
511
|
|
- this.userData = {};
|
|
507
|
+ async getCurrentUser() {
|
|
508
|
+ let res = await get("/user/data/getCurrentUser");
|
|
509
|
+ if (res.status == 200) {
|
|
510
|
+ let obj = uni.getStorageSync("userData");
|
|
511
|
+ this.userData = obj.user = res.data || {};
|
|
512
|
+ uni.setStorageSync("userData", obj);
|
|
513
|
+ }else{
|
|
514
|
+ uni.showToast({
|
|
515
|
+ icon: "none",
|
|
516
|
+ title: res.msg || "接口获取数据失败!",
|
|
517
|
+ });
|
512
|
518
|
}
|
513
|
519
|
},
|
514
|
520
|
},
|
515
|
|
- onLoad(options) {
|
516
|
|
- this.getCurrentUser();
|
|
521
|
+ async onLoad(options) {
|
|
522
|
+ await this.getCurrentUser();
|
517
|
523
|
//#ifdef H5
|
518
|
524
|
if (options.login == 1) {
|
519
|
525
|
uni.redirectTo({
|