视频设置修改
This commit is contained in:
parent
f3ee222607
commit
ae5a2b0989
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
// 接口调用失败时不显示错误,因为可能是正常的(没有配置视频流)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue