更新
This commit is contained in:
parent
0b6b6f6bbc
commit
fb65aee3d0
@ -249,6 +249,7 @@
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.$emit('refresh');
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
})
|
||||
|
@ -37,7 +37,7 @@
|
||||
<view style="width: 90%; height: 1px; background-color: #e0e0e0; margin: 20px 10rpx auto;"></view>
|
||||
<view class="text-wrapper_5 flex-row justify-between" v-if="!isTrain">
|
||||
<text class="text_12">累计训练时长</text>
|
||||
<text class="text_13" >{{ appointmentInfo.allDriveTime }}分钟</text>
|
||||
<text class="text_13">{{ appointmentInfo.allDriveTime }}分钟</text>
|
||||
</view>
|
||||
<view class="text-wrapper_6 flex-row justify-between" v-if="isTrain">
|
||||
<text class="text_14">训练地址</text>
|
||||
@ -81,30 +81,48 @@ export default {
|
||||
console.log(this.appointmentInfo)
|
||||
if (options.type === 'train') {
|
||||
this.isTrain = true
|
||||
}else {
|
||||
} else {
|
||||
this.isTrain = false
|
||||
}
|
||||
console.log(this.isTrain)
|
||||
},
|
||||
methods: {
|
||||
getAllTrainTime() {
|
||||
request({
|
||||
url: '/app-api/process/getAllByCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
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'
|
||||
async getAllTrainTime() {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/app-api/process/getAllByCourseId",
|
||||
method: "GET",
|
||||
params: {
|
||||
courseId: this.appointmentInfo.courseId,
|
||||
},
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user