fix:优化代码

zlx
zhoulexin 4 weeks ago
parent 913472fa39
commit ed0ba51647

@ -2,7 +2,8 @@
VITE_APP_TITLE = 'SOP作业检测系统'
# 后端接口地址
VITE_API_BASE_URL = 'http://10.23.22.43:8188/api'
VITE_API_BASE_IP = '127.0.0.1'
VITE_API_BASE_URL = 'http://${VITE_API_BASE_IP}:8188/api'
# 请求超时时间(毫秒)
VITE_API_TIMEOUT = 15000

@ -23,7 +23,6 @@ import { ref, onMounted, onUnmounted, watch } from 'vue'
const props = defineProps({
src: { type: String, required: true }
})
const emit = defineEmits(['connection-status'])
const videoRef = ref(null)
@ -158,7 +157,7 @@ async function connect() {
if (!res.ok) {
const errBody = await res.text().catch(() => '')
const isNotPublishing = errBody.includes('no one is publishing')
const isNotPublishing = errBody.includes('no one is publishing') || errBody.includes('no stream is available')
if (isNotPublishing) throw new Error('NOT_PUBLISHING')
throw new Error(errBody || `HTTP ${res.status}`)
}

@ -1,4 +1,4 @@
const fileHttp = {
ptApi: '10.23.22.43:8001'
const fileHttp = {
ptApi: `${import.meta.env.VITE_API_BASE_IP}:8001`
}
export default fileHttp

@ -33,7 +33,6 @@ const props = defineProps({
offlineVideoUrl: String,
videoAutoplayTrigger: Number
})
defineEmits(['connectionChange'])
const offlineVideoRef = ref(null)

@ -92,12 +92,12 @@ import { downloadAsZip } from '@/utils/zip.js'
// ============ ============
const videoMode = ref('idle')
const streamAddress = ref('rtsp://10.23.22.97:8556/camera2')
const streamAddress = ref('rtsp://127.0.0.1:8556/camera2')
const webrtcUrl = ref('')
const streamRunning = ref(false)
const isLiveMode = computed(() => videoMode.value === 'live')
const RAW_WS_URL = 'ws://10.23.22.43:8001/ws/raw_rtsp'
const DETECT_WS_URL = 'ws://10.23.22.43:8001/ws/detect_rtsp'
const RAW_WS_URL = `ws://${fileHttp.ptApi}/ws/raw_rtsp`
const DETECT_WS_URL = `ws://${fileHttp.ptApi}/ws/detect_rtsp`
let rawWsClient = null
let detectWsClient = null

Loading…
Cancel
Save