更新
This commit is contained in:
parent
0b6b6f6bbc
commit
fb65aee3d0
@ -249,6 +249,7 @@
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
uni.$emit('refresh');
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
})
|
})
|
||||||
|
@ -87,25 +87,43 @@ export default {
|
|||||||
console.log(this.isTrain)
|
console.log(this.isTrain)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getAllTrainTime() {
|
async getAllTrainTime() {
|
||||||
request({
|
try {
|
||||||
url: '/app-api/process/getAllByCourseId',
|
const res = await request({
|
||||||
method: 'GET',
|
url: "/app-api/process/getAllByCourseId",
|
||||||
|
method: "GET",
|
||||||
params: {
|
params: {
|
||||||
courseId: this.appointmentInfo.courseId
|
courseId: this.appointmentInfo.courseId,
|
||||||
},
|
},
|
||||||
tenantIdFlag: false
|
tenantIdFlag: false,
|
||||||
}).then(res => {
|
});
|
||||||
console.log('获取所有训练时间', res)
|
|
||||||
const data = res.data.find(item => {item.subject == this.appointmentInfo.subject})
|
console.log("获取所有训练时间", res);
|
||||||
if (!data.allDriveTime) {
|
console.log("当前科目:", this.appointmentInfo.subject);
|
||||||
this.appointmentInfo.allDriveTime = data.allDriveTime
|
|
||||||
}else {
|
// 确保 appointmentInfo.subject 已有值
|
||||||
this.appointmentInfo.allDriveTime = '0'
|
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>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
|
Loading…
Reference in New Issue
Block a user