|
|
@@ -68,16 +68,27 @@ Page({
|
|
|
|
|
|
_loaded: false,
|
|
|
},
|
|
|
- async load() {
|
|
|
- await login();
|
|
|
- wx.showLoading({ title: '加载中' });
|
|
|
- const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
- if (!patient) await toCertificationPage();
|
|
|
- else {
|
|
|
- this.setData({ patient });
|
|
|
- this.observerPatient(patient);
|
|
|
- };
|
|
|
- wx.hideLoading();
|
|
|
+ async load(forceLogin = false) {
|
|
|
+ try {
|
|
|
+ await login(forceLogin);
|
|
|
+ wx.showLoading({ title: '加载中' });
|
|
|
+ const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
+ if (!patient) await toCertificationPage();
|
|
|
+ else {
|
|
|
+ this.setData({ patient });
|
|
|
+ this.observerPatient(patient);
|
|
|
+ };
|
|
|
+ wx.hideLoading();
|
|
|
+ } catch (error) {
|
|
|
+ await wx.showModal({
|
|
|
+ title: `加载失败`,
|
|
|
+ content: `${error?.errMsg ?? error?.message ?? ''}`,
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: `重新加载`
|
|
|
+ }).catch(() => { });
|
|
|
+ this.load(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
if (!this.data._loaded) {
|
|
|
this.loadScienceList();
|