fix(检查): 修复任务详情和子任务列表的查询参数
将post_id替换为task_id以保持参数一致性 使用可选链操作符处理可能为null的数据
Showing
3 changed files
with
8 additions
and
7 deletions
| ... | @@ -374,10 +374,10 @@ export function useCheckin() { | ... | @@ -374,10 +374,10 @@ export function useCheckin() { |
| 374 | try { | 374 | try { |
| 375 | const { code, data } = await getUploadTaskInfoAPI({ i: route.query.post_id }) | 375 | const { code, data } = await getUploadTaskInfoAPI({ i: route.query.post_id }) |
| 376 | if (code) { | 376 | if (code) { |
| 377 | - message.value = data.note || '' | 377 | + message.value = data?.note || '' |
| 378 | - activeType.value = data.file_type || 'text' | 378 | + activeType.value = data?.file_type || 'text' |
| 379 | // 小作业ID | 379 | // 小作业ID |
| 380 | - subTaskId.value = data.subtask_id | 380 | + subTaskId.value = data?.subtask_id |
| 381 | 381 | ||
| 382 | // 更新选中的任务显示 | 382 | // 更新选中的任务显示 |
| 383 | if (subTaskId.value) { | 383 | if (subTaskId.value) { |
| ... | @@ -389,7 +389,7 @@ export function useCheckin() { | ... | @@ -389,7 +389,7 @@ export function useCheckin() { |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | // 如果有文件数据,初始化文件列表 - 使用data.files而不是data.meta | 391 | // 如果有文件数据,初始化文件列表 - 使用data.files而不是data.meta |
| 392 | - if (data.files && data.files.length > 0) { | 392 | + if (data?.files && data.files.length > 0) { |
| 393 | const files = data.files.map(item => { | 393 | const files = data.files.map(item => { |
| 394 | const fileItem = { | 394 | const fileItem = { |
| 395 | url: item.value, | 395 | url: item.value, | ... | ... |
| ... | @@ -464,7 +464,7 @@ const getUploadTips = () => { | ... | @@ -464,7 +464,7 @@ const getUploadTips = () => { |
| 464 | * @param {string} month - 月份 | 464 | * @param {string} month - 月份 |
| 465 | */ | 465 | */ |
| 466 | const getTaskDetail = async (month) => { | 466 | const getTaskDetail = async (month) => { |
| 467 | - const { code, data } = await getTaskDetailAPI({ i: route.query.post_id, month }) | 467 | + const { code, data } = await getTaskDetailAPI({ i: route.query.task_id, month }) |
| 468 | if (code) { | 468 | if (code) { |
| 469 | taskDetail.value = data | 469 | taskDetail.value = data |
| 470 | 470 | ||
| ... | @@ -802,7 +802,7 @@ onMounted(async () => { | ... | @@ -802,7 +802,7 @@ onMounted(async () => { |
| 802 | selectedTaskValue.value = [+route.query.subtask_id] | 802 | selectedTaskValue.value = [+route.query.subtask_id] |
| 803 | 803 | ||
| 804 | // 获取小作业列表 | 804 | // 获取小作业列表 |
| 805 | - const subtask_list = await getSubtaskListAPI({ task_id: route.query.post_id, date: current_date }) | 805 | + const subtask_list = await getSubtaskListAPI({ task_id: route.query.task_id, date: current_date }) |
| 806 | if (subtask_list.code) { | 806 | if (subtask_list.code) { |
| 807 | taskOptions.value = [...subtask_list.data.map(item => ({ | 807 | taskOptions.value = [...subtask_list.data.map(item => ({ |
| 808 | text: item.is_makeup ? '补卡:' + item.title : item.title, | 808 | text: item.is_makeup ? '补卡:' + item.title : item.title, | ... | ... |
| 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-15 14:33:37 | 4 | + * @LastEditTime: 2025-12-15 14:46:49 |
| 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue | 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -469,6 +469,7 @@ const editCheckin = (post) => { | ... | @@ -469,6 +469,7 @@ const editCheckin = (post) => { |
| 469 | path: '/checkin/detail', | 469 | path: '/checkin/detail', |
| 470 | query: { | 470 | query: { |
| 471 | post_id: post.id, | 471 | post_id: post.id, |
| 472 | + task_id: post.task_id, | ||
| 472 | subtask_id: post.subtask_id, | 473 | subtask_id: post.subtask_id, |
| 473 | type: post.file_type, | 474 | type: post.file_type, |
| 474 | task_type: taskDetail.value.task_type, | 475 | task_type: taskDetail.value.task_type, | ... | ... |
-
Please register or login to post a comment