|
|
@@ -4,21 +4,27 @@ import { toCertificationPage } from "../../../../pages/home/router";
|
|
|
import { Post } from "../../../../lib/request/method";
|
|
|
Component({
|
|
|
lifetimes: {
|
|
|
- attached() {
|
|
|
- const showGuideActive = wx.getStorageSync("showGuideActive");
|
|
|
- // 从主页点击健康评估进来的
|
|
|
- if(showGuideActive){
|
|
|
- this.handleA();
|
|
|
- wx.removeStorageSync("showGuideActive");
|
|
|
- }
|
|
|
- // 获取评估剩余次数
|
|
|
- this.setAnalysisCount();
|
|
|
- },
|
|
|
-
|
|
|
+ attached(this: any) {
|
|
|
+ const showGuideActive = wx.getStorageSync("showGuideActive");
|
|
|
+ // 从主页点击健康评估进来的
|
|
|
+ if (showGuideActive) {
|
|
|
+ this.handleA();
|
|
|
+ wx.removeStorageSync("showGuideActive");
|
|
|
+ }
|
|
|
+ // 首次挂载时也拉取一次,避免初次渲染为 0
|
|
|
+ this.setAnalysisCount();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ pageLifetimes: {
|
|
|
+ show(this: any) {
|
|
|
+ // 获取评估剩余次数
|
|
|
+ this.setAnalysisCount();
|
|
|
+ },
|
|
|
},
|
|
|
+
|
|
|
observers: {
|
|
|
- active(newVal,oldVal) {
|
|
|
- console.log("active=>>>",newVal,oldVal);
|
|
|
+ active(newVal, oldVal) {
|
|
|
+ console.log("active=>>>", newVal, oldVal);
|
|
|
},
|
|
|
},
|
|
|
properties: {
|
|
|
@@ -33,10 +39,11 @@ Component({
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取评估剩余次数
|
|
|
- async setAnalysisCount(count: number) {
|
|
|
+ async setAnalysisCount(this: any) {
|
|
|
+ console.log("setAnalysisCount");
|
|
|
try {
|
|
|
// 获取剩余次数
|
|
|
- const count = await Post(
|
|
|
+ const residuedCount = await Post(
|
|
|
`/patientInfoManage/rechargeUseDetail`,
|
|
|
{},
|
|
|
{
|
|
|
@@ -45,7 +52,7 @@ Component({
|
|
|
},
|
|
|
}
|
|
|
);
|
|
|
- this.setData({ analysisCount: count });
|
|
|
+ this.setData({ analysisCount: residuedCount });
|
|
|
console.log(this.data.analysisCount, "this.data.analysisCount");
|
|
|
} catch (error) {
|
|
|
console.error("获取剩余次数失败:", error);
|
|
|
@@ -55,9 +62,12 @@ Component({
|
|
|
const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
if (!patient) await toCertificationPage();
|
|
|
else {
|
|
|
- console.log("patient",this.data.active);
|
|
|
+ console.log("patient", this.data.active);
|
|
|
if (this.data.active) {
|
|
|
- this.triggerEvent("next", { component: "questionnaire", scroll: true });
|
|
|
+ this.triggerEvent("next", {
|
|
|
+ component: "questionnaire",
|
|
|
+ scroll: true,
|
|
|
+ });
|
|
|
this.triggerEvent("nextType", { MessageType: 2 });
|
|
|
}
|
|
|
}
|
|
|
@@ -78,15 +88,15 @@ Component({
|
|
|
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 });
|
|
|
+ wx.navigateTo({
|
|
|
+ url: "/module/user/pages/user-edit/user-edit",
|
|
|
+ events: {
|
|
|
+ update2: () => {
|
|
|
+ this.setData({ result2: true });
|
|
|
+ this.triggerEvent("next", { component: "guide", scroll: true });
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
handleD() {
|