This commit is contained in:
许允枞 2025-04-03 17:33:17 +08:00
parent 0b6b6f6bbc
commit fb65aee3d0
2 changed files with 37 additions and 18 deletions

View File

@ -249,6 +249,7 @@
duration: 2000
})
setTimeout(() => {
uni.$emit('refresh');
uni.navigateBack()
}, 2000)
})

View File

@ -87,25 +87,43 @@ export default {
console.log(this.isTrain)
},
methods: {
getAllTrainTime() {
request({
url: '/app-api/process/getAllByCourseId',
method: 'GET',
async getAllTrainTime() {
try {
const res = await request({
url: "/app-api/process/getAllByCourseId",
method: "GET",
params: {
courseId: this.appointmentInfo.courseId
courseId: this.appointmentInfo.courseId,
},
tenantIdFlag: false
}).then(res => {
console.log('获取所有训练时间', res)
const data = res.data.find(item => {item.subject == this.appointmentInfo.subject})
if (!data.allDriveTime) {
this.appointmentInfo.allDriveTime = data.allDriveTime
}else {
this.appointmentInfo.allDriveTime = '0'
tenantIdFlag: false,
});
console.log("获取所有训练时间", res);
console.log("当前科目:", this.appointmentInfo.subject);
// appointmentInfo.subject
if (!this.appointmentInfo.subject) {
console.warn("appointmentInfo.subject 为空,等待赋值...");
await new Promise((resolve) => setTimeout(resolve, 100));
}
})
const data = res.data.find(
(item) => item.subject == this.appointmentInfo.subject
);
console.log("匹配的训练时间数据:", data);
this.appointmentInfo.allDriveTime = data ? data.trainTime || "0" : "0";
console.log(
"this.appointmentInfo.allDriveTime",
this.appointmentInfo.allDriveTime
);
} catch (error) {
console.error("获取训练时间失败:", error);
}
}
}
};
</script>
<style lang='scss'>