hookehuyr

fix(打卡功能): 修复签到小作业ID未传递的问题

在CourseDetailPage.vue中添加缺失的checkin_subtask_id字段
在CheckInList.vue中增加对checkin_subtask_id的校验
...@@ -83,6 +83,7 @@ import dayjs from 'dayjs' ...@@ -83,6 +83,7 @@ import dayjs from 'dayjs'
83 * @property {string} name - 任务名称。 83 * @property {string} name - 任务名称。
84 * @property {string} task_type - 任务类型,`checkin` 或 `upload`。 84 * @property {string} task_type - 任务类型,`checkin` 或 `upload`。
85 * @property {boolean} [is_gray] - 是否置灰,表示今日已完成。 85 * @property {boolean} [is_gray] - 是否置灰,表示今日已完成。
86 + * @property {number|string} [checkin_subtask_id] - 签到小作业ID(接口 checkinTaskAPI 需要)。
86 */ 87 */
87 88
88 /** 89 /**
...@@ -209,9 +210,14 @@ const handle_submit = async () => { ...@@ -209,9 +210,14 @@ const handle_submit = async () => {
209 showToast('请选择打卡项目') 210 showToast('请选择打卡项目')
210 return 211 return
211 } 212 }
213 + const subtask_id = selected_item.value.checkin_subtask_id
214 + if (!subtask_id) {
215 + showToast('打卡数据异常,请刷新页面重试')
216 + return
217 + }
212 submitting.value = true 218 submitting.value = true
213 try { 219 try {
214 - const { code } = await checkinTaskAPI({ subtask_id: selected_item.value.checkin_subtask_id }) 220 + const { code } = await checkinTaskAPI({ subtask_id })
215 if (code === 1) { 221 if (code === 1) {
216 emit('submit-success') 222 emit('submit-success')
217 showToast('打卡成功') 223 showToast('打卡成功')
......
...@@ -754,7 +754,9 @@ onMounted(async () => { ...@@ -754,7 +754,9 @@ onMounted(async () => {
754 id: item.id, 754 id: item.id,
755 name: item.title, 755 name: item.title,
756 task_type: item.task_type, 756 task_type: item.task_type,
757 - is_gray: item.is_gray 757 + is_gray: item.is_gray,
758 + is_finish: item.is_finish,
759 + checkin_subtask_id: item.checkin_subtask_id
758 }); 760 });
759 }); 761 });
760 } 762 }
...@@ -766,7 +768,9 @@ onMounted(async () => { ...@@ -766,7 +768,9 @@ onMounted(async () => {
766 id: item.id, 768 id: item.id,
767 name: item.title, 769 name: item.title,
768 task_type: item.task_type, 770 task_type: item.task_type,
769 - is_gray: item.is_gray 771 + is_gray: item.is_gray,
772 + is_finish: item.is_finish,
773 + checkin_subtask_id: item.checkin_subtask_id
770 }); 774 });
771 }); 775 });
772 } 776 }
......