fix(api): fix getServerImage
This commit is contained in:
@@ -37,6 +37,7 @@ export const getServerImage = async (data: {
|
||||
flag?: number
|
||||
project_id: number
|
||||
}) => {
|
||||
let data_type = data.data_type
|
||||
return new Promise((resolve, reject) => {
|
||||
httpFetch<ServerResponse>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/data/list",
|
||||
@@ -47,35 +48,39 @@ export const getServerImage = async (data: {
|
||||
reject({ proxy: res.proxy, params: data })
|
||||
} else {
|
||||
if (res.data_list && res.data_list.length) {
|
||||
const { image_data } = res.data_list[0]
|
||||
const { image_data, video_data, pointcloud_data } = res.data_list[0]
|
||||
resolve({
|
||||
image_data,
|
||||
base64data:
|
||||
data_type === 0
|
||||
? image_data
|
||||
: data_type === 2
|
||||
? video_data
|
||||
: pointcloud_data,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}).then(({ base64data }: any) => {
|
||||
return base64data
|
||||
})
|
||||
.then(({ image_data }: any) => {
|
||||
return image_data
|
||||
})
|
||||
.catch(async ({ proxy, params }) => {
|
||||
try {
|
||||
const res = await httpFetch<ServerResponse>({
|
||||
url: `/http://${proxy}:9112/api/v1/label_sync/get_data_list`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
})
|
||||
return res.data.data_list?.[0].image_data || ""
|
||||
} catch (error: unknown) {
|
||||
console.log(error)
|
||||
const res = await httpFetch<ServerResponse>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/data/list",
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ...params, flag: 1 }),
|
||||
})
|
||||
return res.data_list?.[0].image_data || ""
|
||||
}
|
||||
})
|
||||
// .catch(async ({ proxy, params }) => {
|
||||
// try {
|
||||
// const res = await httpFetch<ServerResponse>({
|
||||
// url: `/http://${proxy}:9112/api/v1/label_sync/get_data_list`,
|
||||
// method: "POST",
|
||||
// body: JSON.stringify(params),
|
||||
// })
|
||||
// return res.data.data_list?.[0].image_data || ""
|
||||
// } catch (error: unknown) {
|
||||
// console.log(error)
|
||||
// const res = await httpFetch<ServerResponse>({
|
||||
// url: BASE_LABEL_API + "/api/v1/label_server/data/list",
|
||||
// method: "POST",
|
||||
// body: JSON.stringify({ ...params, flag: 1 }),
|
||||
// })
|
||||
// return res.data_list?.[0].image_data || ""
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
// 获取标注图片
|
||||
|
||||
Reference in New Issue
Block a user