Commits (2)
...@@ -159,3 +159,25 @@ export const deleteTask = async (taskId) => { ...@@ -159,3 +159,25 @@ export const deleteTask = async (taskId) => {
throw error throw error
} }
} }
/**
* 获取任务图像
* @param {number} taskId - 任务ID
* @param {number} imageIndex - 图像索引 (1-5)
* @returns {Promise<Blob>} 图像二进制数据
*/
export const getTaskImage = async (taskId, imageIndex) => {
try {
const response = await apiClient.get(`/api/tasks/${taskId}/images/${imageIndex}/`, {
responseType: 'blob', // 重要:指定响应类型为blob以处理二进制数据
headers: {
'Accept': '*/*' // 接受任何类型的响应,解决406 Not Acceptable错误
}
});
console.log(`Task image ${imageIndex} for task ${taskId} fetched successfully`);
return response.data;
} catch (error) {
console.error(`Failed to fetch task image ${imageIndex} for task ${taskId}:`, error);
throw error;
}
}
...@@ -28,5 +28,9 @@ export default { ...@@ -28,5 +28,9 @@ export default {
delete: 'Are you sure you want to delete this item?', delete: 'Are you sure you want to delete this item?',
unsavedChanges: 'You have unsaved changes. Are you sure you want to leave?', unsavedChanges: 'You have unsaved changes. Are you sure you want to leave?',
irreversible: 'This operation cannot be undone. Please proceed with caution.' irreversible: 'This operation cannot be undone. Please proceed with caution.'
} },
dialogs: {
deleteConfirmation: 'Delete Confirmation'
},
deleteWarning: 'This action cannot be undone. Deleted data cannot be recovered.'
} }
...@@ -29,7 +29,14 @@ export default { ...@@ -29,7 +29,14 @@ export default {
notStarted: 'Not Started', notStarted: 'Not Started',
inProgress: 'In Progress', inProgress: 'In Progress',
completed: 'Completed' completed: 'Completed'
} },
images: 'Task Images',
image: 'Image',
noImage: 'No Image',
clickToLoad: 'Click to load image',
loadingImage: 'Loading image...',
updateImage: 'Update Image',
deleteImage: 'Delete Image'
}, },
filters: { filters: {
title: 'Filters', title: 'Filters',
...@@ -43,8 +50,29 @@ export default { ...@@ -43,8 +50,29 @@ export default {
collapse: 'Collapse Filter Panel', collapse: 'Collapse Filter Panel',
expandToReselect: 'Click to Expand and Reselect' expandToReselect: 'Click to Expand and Reselect'
}, },
edit: {
title: 'Edit Task',
createTitle: 'Create New Task'
},
messages: { messages: {
loadError: 'Failed to load task data', loadError: 'Failed to load task data',
noData: 'No task data available' noData: 'No task data available',
updateError: 'Failed to update task',
loadImageError: 'Failed to load image',
confirmDeleteImage: 'Are you sure you want to delete this image?',
uploadImageError: 'Failed to upload image',
deleteSuccess: 'Task {name} has been successfully deleted',
deleteError: 'Failed to delete task',
deleteConfirmation: 'Are you sure you want to delete this task? This action cannot be undone.'
},
validation: {
nameRequired: 'Task name is required',
descriptionRequired: 'Task description is optional',
studentRequired: 'Please select a student',
subjectRequired: 'Please select a subject',
termRequired: 'Please select a term',
completionRequired: 'Please enter completion percentage',
startDateRequired: 'Please select a start date',
endDateRequired: 'Please select an end date'
} }
} }
...@@ -28,5 +28,9 @@ export default { ...@@ -28,5 +28,9 @@ export default {
delete: '确定要删除此项吗?', delete: '确定要删除此项吗?',
unsavedChanges: '您有未保存的更改,确定要离开吗?', unsavedChanges: '您有未保存的更改,确定要离开吗?',
irreversible: '此操作无法撤销,请谨慎操作。' irreversible: '此操作无法撤销,请谨慎操作。'
} },
dialogs: {
deleteConfirmation: '删除确认'
},
deleteWarning: '此操作无法撤销,删除后数据将无法恢复。'
} }
...@@ -29,7 +29,14 @@ export default { ...@@ -29,7 +29,14 @@ export default {
notStarted: '未开始', notStarted: '未开始',
inProgress: '进行中', inProgress: '进行中',
completed: '已完成' completed: '已完成'
} },
images: '作业图像',
image: '图像',
noImage: '暂无图像',
clickToLoad: '点击加载图像',
loadingImage: '正在加载图像...',
updateImage: '更新图像',
deleteImage: '删除图像'
}, },
filters: { filters: {
title: '筛选条件', title: '筛选条件',
...@@ -43,8 +50,29 @@ export default { ...@@ -43,8 +50,29 @@ export default {
collapse: '收起筛选面板', collapse: '收起筛选面板',
expandToReselect: '点击展开重新选择' expandToReselect: '点击展开重新选择'
}, },
edit: {
title: '编辑作业',
createTitle: '新增作业'
},
messages: { messages: {
loadError: '加载作业数据失败', loadError: '加载作业数据失败',
noData: '暂无作业数据' noData: '暂无作业数据',
updateError: '更新作业失败',
loadImageError: '加载图像失败',
confirmDeleteImage: '确定要删除此图像吗?',
uploadImageError: '上传图像失败',
deleteSuccess: '作业 {name} 已成功删除',
deleteError: '删除作业失败',
deleteConfirmation: '您确定要删除此作业吗?此操作无法撤销。'
},
validation: {
nameRequired: '作业名称不能为空',
descriptionRequired: '作业描述为可选项',
studentRequired: '请选择学生',
subjectRequired: '请选择学科',
termRequired: '请选择学期',
completionRequired: '请输入完成度',
startDateRequired: '请选择开始日期',
endDateRequired: '请选择截止日期'
} }
} }
This diff is collapsed.