Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
student-app-frontend
Commits
ede4c3bf
Commit
ede4c3bf
authored
Sep 02, 2025
by
Administrator
Browse files
used specific API to show task images
parent
2b6a8092
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
src/api/taskService.js
View file @
ede4c3bf
...
@@ -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
;
}
}
src/locales/en/modules/task.js
View file @
ede4c3bf
...
@@ -29,7 +29,12 @@ export default {
...
@@ -29,7 +29,12 @@ 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...
'
},
},
filters
:
{
filters
:
{
title
:
'
Filters
'
,
title
:
'
Filters
'
,
...
@@ -43,8 +48,13 @@ export default {
...
@@ -43,8 +48,13 @@ 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
'
},
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
'
}
}
}
}
src/locales/zh-CN/modules/task.js
View file @
ede4c3bf
...
@@ -29,7 +29,12 @@ export default {
...
@@ -29,7 +29,12 @@ export default {
notStarted
:
'
未开始
'
,
notStarted
:
'
未开始
'
,
inProgress
:
'
进行中
'
,
inProgress
:
'
进行中
'
,
completed
:
'
已完成
'
completed
:
'
已完成
'
}
},
images
:
'
作业图像
'
,
image
:
'
图像
'
,
noImage
:
'
暂无图像
'
,
clickToLoad
:
'
点击加载图像
'
,
loadingImage
:
'
正在加载图像...
'
},
},
filters
:
{
filters
:
{
title
:
'
筛选条件
'
,
title
:
'
筛选条件
'
,
...
@@ -43,8 +48,13 @@ export default {
...
@@ -43,8 +48,13 @@ export default {
collapse
:
'
收起筛选面板
'
,
collapse
:
'
收起筛选面板
'
,
expandToReselect
:
'
点击展开重新选择
'
expandToReselect
:
'
点击展开重新选择
'
},
},
edit
:
{
title
:
'
编辑作业
'
},
messages
:
{
messages
:
{
loadError
:
'
加载作业数据失败
'
,
loadError
:
'
加载作业数据失败
'
,
noData
:
'
暂无作业数据
'
noData
:
'
暂无作业数据
'
,
updateError
:
'
更新作业失败
'
,
loadImageError
:
'
加载图像失败
'
}
}
}
}
src/views/TaskView.vue
View file @
ede4c3bf
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment