hookehuyr

refactor(打卡): 将任务ID字段改为小作业ID字段以支持子任务

统一将task_id字段改为subtask_id字段,支持小作业级别的打卡功能
更新相关API文档说明,增加小作业ID参数
1 /* 1 /*
2 * @Date: 2025-06-06 09:26:16 2 * @Date: 2025-06-06 09:26:16
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-12 14:47:36 4 + * @LastEditTime: 2025-12-12 17:17:31
5 * @FilePath: /mlaj/src/api/checkin.js 5 * @FilePath: /mlaj/src/api/checkin.js
6 * @Description: 签到模块相关接口 6 * @Description: 签到模块相关接口
7 */ 7 */
...@@ -27,7 +27,7 @@ const Api = { ...@@ -27,7 +27,7 @@ const Api = {
27 /** 27 /**
28 * @description: 我的大作业列表 28 * @description: 我的大作业列表
29 * @param: keyword 搜索作业名称 29 * @param: keyword 搜索作业名称
30 - * @return: data: [{ id 大作业id, cover 作业封面, title 大作业名称, begin_date 开始时间, end_date 结束时间, task_type 任务类型 [checkin=签到 | upload=上传附件 | count=计数], is_gray 作业是否应该置灰, is_finish 作业在当前周期是否已经达标 }] 30 + * @return: data: [{ id 大作业id, cover 作业封面, title 大作业名称, begin_date 开始时间, end_date 结束时间, task_type 任务类型 [checkin=签到 | upload=上传附件 | count=计数], is_gray 作业是否应该置灰, is_finish 作业在当前周期是否已经达标, checkin_subtask_id 签到小作业的ID }]
31 */ 31 */
32 32
33 export const getTaskListAPI = (params) => fn(fetch.get(Api.GET_TASK_LIST, params)) 33 export const getTaskListAPI = (params) => fn(fetch.get(Api.GET_TASK_LIST, params))
...@@ -51,17 +51,18 @@ export const getSubtaskListAPI = (params) => fn(fetch.get(Api.GET_SUBTASK_LIST, ...@@ -51,17 +51,18 @@ export const getSubtaskListAPI = (params) => fn(fetch.get(Api.GET_SUBTASK_LIST,
51 51
52 /** 52 /**
53 * @description: 签到打卡 53 * @description: 签到打卡
54 - * @param task_id 签到作业ID 54 + * @param subtask_id 小作业ID
55 * @returns 55 * @returns
56 */ 56 */
57 export const checkinTaskAPI = (params) => fn(fetch.post(Api.TASK_CHECKIN, params)) 57 export const checkinTaskAPI = (params) => fn(fetch.post(Api.TASK_CHECKIN, params))
58 58
59 /** 59 /**
60 * @description: 新增上传打卡 60 * @description: 新增上传打卡
61 - * @param task_id 上传作业ID 61 + * @param subtask_id 小作业ID
62 * @param note 打卡文字 62 * @param note 打卡文字
63 * @param meta_id[] 附件ID列表 63 * @param meta_id[] 附件ID列表
64 * @param file_type 上传附件的类型 image=上传图片,video=视频,audio=音频 64 * @param file_type 上传附件的类型 image=上传图片,video=视频,audio=音频
65 + * @param makeup_time 补卡时间
65 * @returns 66 * @returns
66 */ 67 */
67 export const addUploadTaskAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_ADD, params)) 68 export const addUploadTaskAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_ADD, params))
...@@ -69,12 +70,16 @@ export const addUploadTaskAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_ADD, ...@@ -69,12 +70,16 @@ export const addUploadTaskAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_ADD,
69 /** 70 /**
70 * @description: 获取打卡动态列表 71 * @description: 获取打卡动态列表
71 * @param task_id 上传作业ID 72 * @param task_id 上传作业ID
73 + * @param subtask_id 小作业ID
72 * @param date 日期 74 * @param date 日期
73 * @param keyword 搜索 75 * @param keyword 搜索
74 * @param order_by_time asc=正序,desc=倒序。默认为倒序 76 * @param order_by_time asc=正序,desc=倒序。默认为倒序
75 - * @param limit 77 + * @param limit 条数
76 - * @param offset 78 + * @param offset 页码
77 - * @returns 79 + * @returns data: [{id 打卡动态ID, status 审批状态 3=待审批,5=审批通过,7=审批不通过, created_by 打卡人ID, username 打卡人昵称
80 + * avatar 打卡人头像, created_time 打卡时间, created_time_desc 打卡时间描述, note 打卡内容, files[{meta_id,name,value,extension}] 附件列表,
81 + * file_type 上传附件的类型 image=上传图片,video=视频,audio=音频, like_count 点赞数, is_my 是不是我的打卡, is_like 我是否已经点赞, is_makeup 是否补卡
82 + * subtask_title 小作业标题}]
78 */ 83 */
79 export const getUploadTaskListAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_LIST, params)) 84 export const getUploadTaskListAPI = (params) => fn(fetch.post(Api.TASK_UPLOAD_LIST, params))
80 85
......
...@@ -201,7 +201,7 @@ const handle_submit = async () => { ...@@ -201,7 +201,7 @@ const handle_submit = async () => {
201 } 201 }
202 submitting.value = true 202 submitting.value = true
203 try { 203 try {
204 - const { code } = await checkinTaskAPI({ task_id: selected_item.value.id }) 204 + const { code } = await checkinTaskAPI({ subtask_id: selected_item.value.checkin_subtask_id })
205 if (code) { 205 if (code) {
206 emit('submit-success') 206 emit('submit-success')
207 showToast('打卡成功') 207 showToast('打卡成功')
......
1 <!-- 1 <!--
2 * @Date: 2025-01-25 15:34:17 2 * @Date: 2025-01-25 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-11 15:22:15 4 + * @LastEditTime: 2025-12-11 17:56:07
5 * @FilePath: /mlaj/src/components/ui/CollapsibleCalendar.vue 5 * @FilePath: /mlaj/src/components/ui/CollapsibleCalendar.vue
6 * @Description: 可折叠日历组件 6 * @Description: 可折叠日历组件
7 --> 7 -->
......
...@@ -287,7 +287,6 @@ export function useCheckin() { ...@@ -287,7 +287,6 @@ export function useCheckin() {
287 try { 287 try {
288 // 准备提交数据 288 // 准备提交数据
289 const submitData = { 289 const submitData = {
290 - task_id: route.query.id,
291 note: message.value, 290 note: message.value,
292 file_type: activeType.value, 291 file_type: activeType.value,
293 meta_id: [], 292 meta_id: [],
......
...@@ -354,7 +354,7 @@ const handleSubmit = async () => { ...@@ -354,7 +354,7 @@ const handleSubmit = async () => {
354 } 354 }
355 355
356 const extraData = { 356 const extraData = {
357 - task_option: selectedTaskValue.value // 假设字段名为 task_option 357 + subtask_id: selectedTaskValue.value // 小作业ID
358 } 358 }
359 359
360 // 2. 计数打卡特定校验 360 // 2. 计数打卡特定校验
......
1 <!-- 1 <!--
2 * @Date: 2025-05-29 15:34:17 2 * @Date: 2025-05-29 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-11 20:58:24 4 + * @LastEditTime: 2025-12-12 17:27:43
5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue 5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -543,6 +543,7 @@ const onLoad = async (date) => { ...@@ -543,6 +543,7 @@ const onLoad = async (date) => {
543 limit: limit.value, 543 limit: limit.value,
544 page: nextPage, 544 page: nextPage,
545 task_id: route.query.id, 545 task_id: route.query.id,
546 + subtask_id: selectedSubtaskId.value,
546 date: current_date 547 date: current_date
547 }); 548 });
548 if (res.code) { 549 if (res.code) {
......
1 <!-- 1 <!--
2 * @Date: 2025-11-19 21:00:00 2 * @Date: 2025-11-19 21:00:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-10 11:32:08 4 + * @LastEditTime: 2025-12-12 17:39:55
5 * @FilePath: /mlaj/src/views/teacher/taskHomePage.vue 5 * @FilePath: /mlaj/src/views/teacher/taskHomePage.vue
6 * @Description: 教师端作业主页(头部介绍、统计、日历与学生完成情况;数据Mock) 6 * @Description: 教师端作业主页(头部介绍、统计、日历与学生完成情况;数据Mock)
7 --> 7 -->
...@@ -119,6 +119,8 @@ const $route = useRoute() ...@@ -119,6 +119,8 @@ const $route = useRoute()
119 const $router = useRouter() 119 const $router = useRouter()
120 useTitle('作业主页') 120 useTitle('作业主页')
121 121
122 +// TODO: 等正式接口到来的时候, 小作业列表或者大作业详情切换的时候, 在这个页面加一个切换小作业的列表按钮
123 +
122 const themeVars = { 124 const themeVars = {
123 calendarPopupHeight: '60%', 125 calendarPopupHeight: '60%',
124 } 126 }
...@@ -225,6 +227,10 @@ const today = new Date() ...@@ -225,6 +227,10 @@ const today = new Date()
225 const selected_date = ref(format_date(today)) 227 const selected_date = ref(format_date(today))
226 const user_list = ref([]) 228 const user_list = ref([])
227 const task_type = ref('') 229 const task_type = ref('')
230 +// 小作业ID
231 +const selectedSubtaskId = ref('')
232 +// 小作业列表
233 +const subtask_list = ref([])
228 234
229 /** 235 /**
230 * 获取作业详情和学生完成情况 236 * 获取作业详情和学生完成情况
...@@ -233,6 +239,7 @@ async function fetchData() { ...@@ -233,6 +239,7 @@ async function fetchData() {
233 try { 239 try {
234 const res = await getTeacherTaskDetailAPI({ 240 const res = await getTeacherTaskDetailAPI({
235 id: task_id, 241 id: task_id,
242 + subtask_id: selectedSubtaskId.value,
236 date: selected_date.value 243 date: selected_date.value
237 }) 244 })
238 245
...@@ -240,6 +247,8 @@ async function fetchData() { ...@@ -240,6 +247,8 @@ async function fetchData() {
240 task_title.value = res.data.title 247 task_title.value = res.data.title
241 task_intro.value = res.data.note 248 task_intro.value = res.data.note
242 task_type.value = res.data.task_type || '' 249 task_type.value = res.data.task_type || ''
250 + // 小作业列表
251 + subtask_list.value = res.data.subtask_list || []
243 252
244 // 格式化周期显示 253 // 格式化周期显示
245 const cycleMap = { 254 const cycleMap = {
......