修复开发环境截图URL缺少/dev-api前缀问题

img标签src不走axios,需手动加VUE_APP_BASE_API前缀,
否则开发环境下请求不经过devServer代理直接404

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 09:35:35 +08:00
parent 3c8c6fa0c9
commit 682b56a2ec

View File

@@ -114,7 +114,8 @@ export default {
this.cameraId = decodeURIComponent(this.$route.params.cameraId)
this.srcUrl = this.$route.query.srcUrl || ''
if (this.srcUrl) {
this.snapUrl = `/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}`
const base = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : ''
this.snapUrl = `${base}/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}`
}
this.loadRois()
},
@@ -146,7 +147,8 @@ export default {
},
refreshSnap() {
if (this.srcUrl) {
this.snapUrl = `/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}&t=${Date.now()}`
const base = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : ''
this.snapUrl = `${base}/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}&t=${Date.now()}`
}
},
onRoiDrawn(data) {