From 613ed5173cce1ac98f28820afba7839137041a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Fri, 8 Aug 2025 14:05:32 +0800 Subject: [PATCH] tijiao --- pages/my/index.vue | 157 ++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 81 deletions(-) diff --git a/pages/my/index.vue b/pages/my/index.vue index f661fa26..b53d6289 100644 --- a/pages/my/index.vue +++ b/pages/my/index.vue @@ -197,54 +197,7 @@ export default { return { userMes: {}, shengpiNumber: 0, - pageList: [ - // { - // name: "我的病历夹", - // url: "/pages/folder/index", - // type: "pageJump", - // }, - // { - // name: "会话记录", - // url: "/pages/my/recordsList", - // type: "pageJump", - // }, - { - name: "我的订单", - url: "/pages/order/index", - type: "pageJump", - }, - // { - // name: "我的文章", - // url: "/pages/articleList/index", - // type: "pageJump" - // }, - - // { - // name: "待审核医案", - // url: "/pages/medicalRecords/PendingApprovalIndex", - // type: "pageJump" - // }, - { - name: "我的课程", - url: "/pages/curriculum/index/index", - type: "pageJump", - }, - { - name: "个人资料", - url: "/pages/my/persData", - type: "pageJump", - }, - { - name: "关于我们", - url: "/pages/my/aboutUs", - type: "pageJump", - }, - { - name: "问题反馈/申诉", - url: "/pages/user/workOrder", - type: "pageJump", - }, - ], + pageList: [], infoShow: false, // 显示电子书相关 aiVipLog: null, flag: null, @@ -256,15 +209,18 @@ export default { //第一次加载 onLoad(e) { uni.hideTabBar(); - this.getMedicalRecords(); - this.getMedicalRecordsCanCheck(); + }, //页面显示 - onShow() { + async onShow() { if(uni.getStorageSync('medicalRecordsStatusId')){ uni.removeStorageSync('medicalRecordsStatusId'); } - this.getShengpiNumber() + + + await this.getShengpiNumber() + await this.getMedicalRecords(); + await this.getMedicalRecordsCanCheck(); this.getData(); this.getVipData(); }, @@ -302,37 +258,76 @@ export default { }); } }, - getMedicalRecords() { - if (this.userInfo.id != undefined) { - this.$http - .post("common/medicalRecords/getMedicalRecordsRoleByUser") - .then((res) => { - console.log("res at line 237:", res); - if (res.code == 0 && res.roleFlag == 1) { - this.pageList.splice(1, 0, { - name: "我的医案", - url: "/pages/medicalRecords/index", - type: "pageJump", - }); - } - }); - } - }, - getMedicalRecordsCanCheck() { - if (this.userInfo.id != undefined) { - this.$http.post("common/medicalRecords/canCheck").then((res) => { - console.log("res at line 237:", res); - if (res.code == 0 && res.flag == true) { - - this.pageList.splice(1, 0, { - name: "待审批医案", - url: "/pages/medicalRecords/PendingApprovalIndex", - type: "pageJump", - contentType: "shengpi", - }); - } + async getMedicalRecords() { + this.pageList = [ + { + name: "我的订单", + url: "/pages/order/index", + type: "pageJump", + }, + { + name: "我的课程", + url: "/pages/curriculum/index/index", + type: "pageJump", + }, + { + name: "个人资料", + url: "/pages/my/persData", + type: "pageJump", + }, + { + name: "关于我们", + url: "/pages/my/aboutUs", + type: "pageJump", + }, + { + name: "问题反馈/申诉", + url: "/pages/user/workOrder", + type: "pageJump", + }, + ]; + // 确保 userInfo.id 是有效的 + if (this.userInfo.id != undefined) { + try { + // 同时发送两个请求,使用 Promise.all 确保并行处理 + const [res1, res2] = await Promise.all([ + this.$http.post("common/medicalRecords/getMedicalRecordsRoleByUser"), + this.$http.post("common/medicalRecords/canCheck") + ]); + + console.log("res1 at line 237:", res1); + console.log("res2 at line 237:", res2); + + // 在所有请求完成后根据返回结果更新 pageList + + + if (res2.code == 0 && res2.flag == true) { + this.pageList.splice(2, 0, { + name: "待审批医案", + url: "/pages/medicalRecords/PendingApprovalIndex", + type: "pageJump", + contentType: "shengpi", + }); + } if (res1.code == 0 && res1.roleFlag == 1) { + this.pageList.splice(2, 0, { + name: "我的医案", + url: "/pages/medicalRecords/index", + type: "pageJump", }); } + + // 在两个请求都成功后更新 pageList + + + } catch (error) { + console.error("Error fetching data:", error); + } + } +} + +, + getMedicalRecordsCanCheck() { + }, getShengpiNumber() { this.$http