hookehuyr

fix(检查): 修复任务详情和子任务列表的查询参数

将post_id替换为task_id以保持参数一致性
使用可选链操作符处理可能为null的数据
......@@ -374,10 +374,10 @@ export function useCheckin() {
try {
const { code, data } = await getUploadTaskInfoAPI({ i: route.query.post_id })
if (code) {
message.value = data.note || ''
activeType.value = data.file_type || 'text'
message.value = data?.note || ''
activeType.value = data?.file_type || 'text'
// 小作业ID
subTaskId.value = data.subtask_id
subTaskId.value = data?.subtask_id
// 更新选中的任务显示
if (subTaskId.value) {
......@@ -389,7 +389,7 @@ export function useCheckin() {
}
// 如果有文件数据,初始化文件列表 - 使用data.files而不是data.meta
if (data.files && data.files.length > 0) {
if (data?.files && data.files.length > 0) {
const files = data.files.map(item => {
const fileItem = {
url: item.value,
......
......@@ -464,7 +464,7 @@ const getUploadTips = () => {
* @param {string} month - 月份
*/
const getTaskDetail = async (month) => {
const { code, data } = await getTaskDetailAPI({ i: route.query.post_id, month })
const { code, data } = await getTaskDetailAPI({ i: route.query.task_id, month })
if (code) {
taskDetail.value = data
......@@ -802,7 +802,7 @@ onMounted(async () => {
selectedTaskValue.value = [+route.query.subtask_id]
// 获取小作业列表
const subtask_list = await getSubtaskListAPI({ task_id: route.query.post_id, date: current_date })
const subtask_list = await getSubtaskListAPI({ task_id: route.query.task_id, date: current_date })
if (subtask_list.code) {
taskOptions.value = [...subtask_list.data.map(item => ({
text: item.is_makeup ? '补卡:' + item.title : item.title,
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-15 14:33:37
* @LastEditTime: 2025-12-15 14:46:49
* @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
* @Description: 文件描述
-->
......@@ -469,6 +469,7 @@ const editCheckin = (post) => {
path: '/checkin/detail',
query: {
post_id: post.id,
task_id: post.task_id,
subtask_id: post.subtask_id,
type: post.file_type,
task_type: taskDetail.value.task_type,
......