This commit is contained in:
2026-08-27 14:30:26 +08:00
parent c704032d66
commit a5a803046b
11 changed files with 178 additions and 66 deletions
+4 -6
View File
@@ -1,6 +1,9 @@
import { session } from '@/stores/session.js'
import { requireOnline } from '@/utils/network.js'
import { apiDownload, apiRequest, apiUpload } from '@/api/http.js'
import { resolveEvidencePreviewUrl } from '@/utils/api-url.js'
export { resolveEvidencePreviewUrl } from '@/utils/api-url.js'
const EVIDENCE_TYPES = Object.freeze([
'PHOTO_STEP_1', 'PHOTO_STEP_2', 'PHOTO_STEP_3', 'PHOTO_STEP_4', 'SEAL'
@@ -221,12 +224,7 @@ export function getEvidencePreviewUrl(inboundId, evidenceId, tenantId) {
export function downloadEvidencePreview(previewUrl) {
requireOnline('当前网络不可用,无法查看装柜照片')
if (!previewUrl) throw new Error('装柜照片地址尚未同步')
const baseUrl = session.apiBase || '/api/platform/v1'
let url = String(previewUrl)
if (!/^https?:\/\//i.test(url) && /^https?:\/\//i.test(baseUrl)) {
const origin = baseUrl.match(/^(https?:\/\/[^/]+)/i)?.[1] || ''
url = `${origin}${url.startsWith('/') ? '' : '/'}${url}`
}
const url = resolveEvidencePreviewUrl(previewUrl, session.apiBase || '/api/platform/v1')
debugLog('evidence.preview.start', { previewPath: String(previewUrl), resolvedUrl: url })
return apiDownload({ url }).then((response) => {
const responseHeaders = response.header || {}