diff --git a/src/pages/learningTasks/details.vue b/src/pages/learningTasks/details.vue index 47303386..dc360999 100644 --- a/src/pages/learningTasks/details.vue +++ b/src/pages/learningTasks/details.vue @@ -64,7 +64,7 @@ - 32% + {{progress}} @@ -94,7 +94,14 @@ const data_list = ref([]); const total = ref(-1); const taskId = ref(''); - const progress = computed(() => '30%'); + // const progress = computed(() => '30%'); + const progress = computed(() => { + // 计算进度百分比(保留两位小数) + const total = detailData.sumCrs ?? detailData.taskNumber ?? 0; + if (total === 0) return '0%'; + const completed = detailData.finishCrs ?? detailData.learnedNumber ?? 0; + return Math.min(Math.round((completed / total) * 10000) / 100, 100) + '%'; + }); const queryList = async (pageNo, pageSize, from) => { const requests = [queryAllTraTaskCrsInfo({ taskId: taskId.value })]; // 如果不是第一次请求,才添加第二个请求