视频设置修改

This commit is contained in:
cwchen 2026-01-08 16:11:58 +08:00
parent f3ee222607
commit ae5a2b0989
2 changed files with 67 additions and 12 deletions

View File

@ -135,15 +135,37 @@ export default {
}
}
} else {
this.isError = true
this.errorMessage = res.msg || '启动导出任务失败'
//
const msg = res.msg || ''
if (this.isNoDataError(msg)) {
this.isError = true
this.errorMessage = '当前查询条件下没有数据,无法导出'
} else {
this.isError = true
this.errorMessage = msg || '启动导出任务失败'
}
}
} catch (error) {
console.error('启动导出任务失败:', error)
this.isError = true
this.errorMessage = error.message || '启动导出任务失败,请稍后重试'
const errorMsg = error.message || ''
if (this.isNoDataError(errorMsg)) {
this.isError = true
this.errorMessage = '当前查询条件下没有数据,无法导出'
} else {
this.isError = true
this.errorMessage = errorMsg || '启动导出任务失败,请稍后重试'
}
}
},
/** 判断是否是没有数据的错误 */
isNoDataError(msg) {
if (!msg) return false
const lowerMsg = msg.toLowerCase()
const noDataKeywords = [
'没有查询到数据',
]
return noDataKeywords.some(keyword => lowerMsg.includes(keyword))
},
/** 开始轮询进度 */
startPolling() {
//
@ -180,16 +202,29 @@ export default {
}
} else if (data.status === 'failed' || data.status === 'error') {
//
this.isError = true
this.errorMessage = data.message || '导出任务失败'
const msg = data.message || ''
if (this.isNoDataError(msg)) {
this.isError = true
this.errorMessage = '当前查询条件下没有数据,无法导出'
} else {
this.isError = true
this.errorMessage = msg || '导出任务失败'
}
if (this.pollTimer) {
clearInterval(this.pollTimer)
this.pollTimer = null
}
}
} else {
this.isError = true
this.errorMessage = res.msg || '查询进度失败'
//
const msg = res.msg || ''
if (this.isNoDataError(msg)) {
this.isError = true
this.errorMessage = '当前查询条件下没有数据,无法导出'
} else {
this.isError = true
this.errorMessage = msg || '查询进度失败'
}
if (this.pollTimer) {
clearInterval(this.pollTimer)
this.pollTimer = null

View File

@ -86,6 +86,7 @@ export default {
detectedVehicles: [], //
timer: null,
saving: false, //
videoErrorShown: false, //
lineInfo: {
equipmentName: '',
equipmentStatus: '',
@ -259,7 +260,7 @@ export default {
}
} catch (error) {
console.error('保存画线数据失败:', error)
this.$message.error('保存失败,请稍后重试')
// this.$message.error('')
} finally {
this.saving = false
}
@ -450,15 +451,34 @@ export default {
/** 视频加载错误 */
handleVideoError(e) {
// URL
if (!this.videoUrl) {
return
}
//
if (this.videoErrorShown) {
return
}
console.error('视频加载失败:', e)
this.videoErrorShown = true
this.$message.error('视频加载失败,请检查视频源地址')
},
/** 加载视频流 */
async loadVideoStream() {
const res = await getVideoStreamAPI()
if (res.code === 200) {
this.videoUrl = res.data.streamUrl
try {
const res = await getVideoStreamAPI()
if (res.code === 200 && res.data && res.data.streamUrl) {
//
this.videoErrorShown = false
this.videoUrl = res.data.streamUrl
} else {
//
console.log('未获取到视频流地址')
}
} catch (error) {
console.error('获取视频流失败:', error)
//
}
}
}