|
@@ -1,54 +1,75 @@
|
|
|
// module/chats/components/guide/guide.ts
|
|
// module/chats/components/guide/guide.ts
|
|
|
|
|
+import { getPatients } from "../../../../pages/home/request";
|
|
|
|
|
+import { toCertificationPage } from "../../../../pages/home/router";
|
|
|
Component({
|
|
Component({
|
|
|
lifetimes: {},
|
|
lifetimes: {},
|
|
|
properties: {
|
|
properties: {
|
|
|
- id: { type: String, value: '' },
|
|
|
|
|
|
|
+ id: { type: String, value: "" },
|
|
|
active: { type: Boolean, value: false },
|
|
active: { type: Boolean, value: false },
|
|
|
analysisCount: { type: Number, value: 0 },
|
|
analysisCount: { type: Number, value: 0 },
|
|
|
},
|
|
},
|
|
|
data: {
|
|
data: {
|
|
|
result: [] as string[],
|
|
result: [] as string[],
|
|
|
result2: false,
|
|
result2: false,
|
|
|
|
|
+ patient: {} as any,
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- handleA() {
|
|
|
|
|
- if (this.data.active){
|
|
|
|
|
- this.triggerEvent('next', { component: 'questionnaire', scroll: true});
|
|
|
|
|
- this.triggerEvent('nextType', { MessageType:2 });
|
|
|
|
|
|
|
+ async handleA() {
|
|
|
|
|
+ const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
|
|
+ console.log("patient", patient);
|
|
|
|
|
+ if (!patient) await toCertificationPage();
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (this.data.active) {
|
|
|
|
|
+ this.triggerEvent("next", { component: "questionnaire", scroll: true });
|
|
|
|
|
+ this.triggerEvent("nextType", { MessageType: 2 });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- handleB() {
|
|
|
|
|
- if (this.data.active) wx.navigateTo({
|
|
|
|
|
- url: '/module/health/pages/status/status',
|
|
|
|
|
- events: { update: this._update.bind(this) }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ async handleB() {
|
|
|
|
|
+ const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
|
|
+ if (!patient) await toCertificationPage();
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (this.data.active)
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: "/module/health/pages/status/status",
|
|
|
|
|
+ events: { update: this._update.bind(this) },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- handleC() {
|
|
|
|
|
- if (this.data.active) wx.navigateTo({
|
|
|
|
|
- url: '/module/user/pages/user-edit/user-edit',
|
|
|
|
|
- events: {
|
|
|
|
|
- update2: () => {
|
|
|
|
|
- this.setData({ result2: true });
|
|
|
|
|
- this.triggerEvent('next', { component: 'guide', scroll: true });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ async handleC() {
|
|
|
|
|
+ const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
|
|
+ if (!patient) await toCertificationPage();
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (this.data.active)
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: "/module/user/pages/user-edit/user-edit",
|
|
|
|
|
+ events: {
|
|
|
|
|
+ update2: () => {
|
|
|
|
|
+ this.setData({ result2: true });
|
|
|
|
|
+ this.triggerEvent("next", { component: "guide", scroll: true });
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
handleD() {
|
|
handleD() {
|
|
|
// if (this.data.active) wx.navigateBack();
|
|
// if (this.data.active) wx.navigateBack();
|
|
|
if (this.data.active) {
|
|
if (this.data.active) {
|
|
|
- console.log("tiaohzuan1")
|
|
|
|
|
- wx.redirectTo({url:"/pages/home/home"})
|
|
|
|
|
|
|
+ console.log("tiaohzuan1");
|
|
|
|
|
+ wx.redirectTo({ url: "/pages/home/home" });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
_update(result: string[]) {
|
|
_update(result: string[]) {
|
|
|
if (result.length) {
|
|
if (result.length) {
|
|
|
this.setData({ result });
|
|
this.setData({ result });
|
|
|
- this.triggerEvent('next', { component: 'guide', scroll: true });
|
|
|
|
|
|
|
+ this.triggerEvent("next", { component: "guide", scroll: true });
|
|
|
} else {
|
|
} else {
|
|
|
- setTimeout(() => wx.showToast({ title: `没有更改项`, icon: 'none' }), 300)
|
|
|
|
|
|
|
+ setTimeout(
|
|
|
|
|
+ () => wx.showToast({ title: `没有更改项`, icon: "none" }),
|
|
|
|
|
+ 300
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+});
|