diff --git a/dist01.zip b/dist01.zip deleted file mode 100644 index d40da14..0000000 Binary files a/dist01.zip and /dev/null differ diff --git a/dist5.31.zip b/dist5.31.zip deleted file mode 100644 index 191faee..0000000 Binary files a/dist5.31.zip and /dev/null differ diff --git a/package-lock.json b/package-lock.json index 9969e43..e3c6bdd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "hls.js": "^1.5.18", "jssip": "^3.10.1", "lodash": "^4.17.21", + "mpegts.js": "^1.8.0", "pinia": "^2.2.6", "pinia-plugin-persistedstate": "^4.2.0", "pubsub-js": "^1.9.5", @@ -3201,6 +3202,12 @@ "node": ">= 0.4" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT" + }, "node_modules/esbuild": { "version": "0.25.1", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", @@ -4272,6 +4279,16 @@ "ufo": "^1.5.4" } }, + "node_modules/mpegts.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/mpegts.js/-/mpegts.js-1.8.0.tgz", + "integrity": "sha512-ZtujqtmTjWgcDDkoOnLvrOKUTO/MKgLHM432zGDI8oPaJ0S+ebPxg1nEpDpLw6I7KmV/GZgUIrfbWi3qqEircg==", + "license": "Apache-2.0", + "dependencies": { + "es6-promise": "^4.2.5", + "webworkify-webpack": "github:xqq/webworkify-webpack" + } + }, "node_modules/mrmime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", @@ -6143,6 +6160,11 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/webworkify-webpack": { + "version": "2.1.5", + "resolved": "git+ssh://git@github.com/xqq/webworkify-webpack.git#24d1e719b4a6cac37a518b2bb10fe124527ef4ef", + "license": "MIT" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index c010dea..58b73b9 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "hls.js": "^1.5.18", "jssip": "^3.10.1", "lodash": "^4.17.21", + "mpegts.js": "^1.8.0", "pinia": "^2.2.6", "pinia-plugin-persistedstate": "^4.2.0", "pubsub-js": "^1.9.5", diff --git a/src/api/request.js b/src/api/request.js index a2d78c1..cd728b7 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -12,6 +12,7 @@ const instance = axios.create({ timeout: 100000, headers: { Authorization: mode == 'dev' ? devToken : proToken, + 'User-Type': '1', 'Content-Type': 'application/json;charset=UTF-8' } }) diff --git a/src/components/HlsPlayer/index-bak.vue b/src/components/HlsPlayer/index-bak.vue new file mode 100644 index 0000000..5d0c0d3 --- /dev/null +++ b/src/components/HlsPlayer/index-bak.vue @@ -0,0 +1,352 @@ + + + + + diff --git a/src/components/HlsPlayer/index.vue b/src/components/HlsPlayer/index.vue index 8689e22..be8f30f 100644 --- a/src/components/HlsPlayer/index.vue +++ b/src/components/HlsPlayer/index.vue @@ -2,6 +2,7 @@
- + diff --git a/src/components/VideoDialog/index.vue b/src/components/VideoDialog/index.vue index d3e5f35..3a94f65 100644 --- a/src/components/VideoDialog/index.vue +++ b/src/components/VideoDialog/index.vue @@ -49,10 +49,10 @@
-
收藏
-
取消收藏
+
收藏
+
取消收藏
- + @@ -103,10 +103,10 @@ watch( () =>modelValue.value, (val) => { - // colletCond.value = props.isCollect - // isDayCurr.value = props.isDiy + colletCond.value = props.isCollect + isDayCurr.value = props.isDiy console.log(props.isDiy,'val[0].value') - + }, { immediate: true @@ -114,12 +114,12 @@ ) const emit = defineEmits(['isDiyChange']); // 收藏 - const handleCollectAdd = async (id, status, index) => { + const handleCollectAdd = async () => { await getColletDiyApi({ cameraIndexCode:props.cameraIndexCode, isDiy: props.isDiy == 0 ? 1 : 0 }) - + if(props.isDiy==1){ isDayCurr.value=0 // modelValue.value = false @@ -128,7 +128,7 @@ } emit('isDiyChange', isDayCurr.value); pubSub.publish('videoIsDiy',{isDiy:props.isDiy,cameraIndexCode:props.cameraIndexCode} ) - + } // 关注 const handleCollect = async (id, status, index) => { @@ -136,7 +136,7 @@ cameraIndexCode:props.cameraIndexCode, isCollect: colletCond.value == 0 ? 1 : 0 }) - + if (colletCond.value == 0) { colletCond.value = 1 } else { @@ -144,7 +144,7 @@ modelValue.value = false } pubSub.publish('videoCollect', props.cameraIndexCode) - + } const handleAction = async (e) => { if (e == STOP) { diff --git a/src/hooks/echart.js b/src/hooks/echart.js index f262ec8..24c9d79 100644 --- a/src/hooks/echart.js +++ b/src/hooks/echart.js @@ -13,9 +13,9 @@ export function useEchart() { const setOption = (params, update = false) => { initChart() chart.setOption(params, update) + return chart; } const clearOption = () => { - console.log('clearooooooooooooooooo') // 将series设置为空数组,可以清空图表内容 chart.setOption({ series:[] diff --git a/src/layout/components/CoreVideo/index.vue b/src/layout/components/CoreVideo/index.vue index 3870ddc..4ee9d1c 100644 --- a/src/layout/components/CoreVideo/index.vue +++ b/src/layout/components/CoreVideo/index.vue @@ -10,25 +10,14 @@ :key="index" @click="handleItem(item)" > - -
取消关注
- + > +
取消关注
@@ -50,6 +39,7 @@ import { useWebSocket } from '@/hooks/socket' import { mode, socketBaseUrl, proSocketBaseUrl } from '@/utils/config' + import mpegtsjs from "mpegts.js"; const { dataRes } = useWebSocket( `${mode == 'dev' ? socketBaseUrl : proSocketBaseUrl}/ws/securityAlerts` @@ -73,7 +63,6 @@ let isCollect = ref(0) let timer = null let isDiy = ref(0) const handleItem = (item) => { - console.log(item,'1111111111111111111111111') src.value = item.hlsUrl cameraIndexCode.value = item.cameraIndexCode isCollect.value = item.isCollect @@ -82,12 +71,12 @@ let isCollect = ref(0) } const postVideoRemain = () => { - timer = setInterval(() => { - if(!list.value.length) return false; - postVideoRemainApi({ - cameraIndexCode: list.value.map((item) => item.cameraIndexCode) - }) - }, 1500) + // timer = setInterval(() => { + // if(!list.value.length) return false; + // postVideoRemainApi({ + // cameraIndexCode: list.value.map((item) => item.cameraIndexCode) + // }) + // }, 1500) } const getPreviewUrl = async (code) => { @@ -104,28 +93,32 @@ let isCollect = ref(0) pageSize: 5 }) list.value = res.data - postVideoRemain() if (timer) clearInterval(timer) - // console.log(list.value,'list.valuelist.valuelist.valuelist.value') - // nextTick(() => { - // list.value.forEach(async (item, index) => { - // var video = document.getElementById(`video${index}`) - // const hls = new Hls({ - // enableWorker: false, // 禁用 Worker 来避免额外的线程 - // enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求 - // cache: true, // 启用缓存 - // maxBufferLength: 10, // 最大缓冲长度(秒) - // maxMaxBufferLength: 15, // 缓冲区长度的上限 - // maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节) - // }) - // hls.loadSource(item.hlsUrl) - // hls.attachMedia(video) - // hls.on(Hls.Events.MANIFEST_PARSED, () => { - // video.play() - // }) - // hlsRefs.push(hls) - // }) - // }) + nextTick(() => { + list.value.forEach(async (item, index) => { + var videoElement = document.getElementById(`video${index}`) + const player = mpegtsjs.createPlayer({ + url: item.hlsUrl, + type: 'flv', + isLive: true, + hasAudio: false + }) + player.attachMediaElement(videoElement) + player.load() + player.play() + + // 错误处理和重连机制 + player.on('error', (err) => { + console.error('播放器错误:', err) + // 3 秒后尝试重新加载 + setTimeout(() => { + player.load() + player.play() + }, 3000) + }) + hlsRefs.push(player) + }) + }) } watch( () => list.value, @@ -166,9 +159,9 @@ let isCollect = ref(0) pubSub.subscribe('videoIsDiy', (msg, data) => { console.log(data,'收藏 ++++++++++++++') getVideoList() - - - + + + }) }) diff --git a/src/stores/scenic.js b/src/stores/scenic.js index a42e50f..41ea54b 100644 --- a/src/stores/scenic.js +++ b/src/stores/scenic.js @@ -16,7 +16,7 @@ export const useScenicStore = defineStore('scenic', () => { infoList: [ { name: '游玩舒适度', type: 0, value: '空闲' }, // { name: '景区安全', type: 0, value: '安全' }, - { name: '通景交通', type: 0, value: '通畅' }, + { name: '交通拥堵度', type: 0, value: '通畅' }, { name: '停车场负荷', type: 0, value: '空闲' } ] }) diff --git a/src/views/collect/components/video-box.vue b/src/views/collect/components/video-box.vue index 9fbe430..ef73b76 100644 --- a/src/views/collect/components/video-box.vue +++ b/src/views/collect/components/video-box.vue @@ -7,19 +7,19 @@ -->
{{item.label}}
- - +
- + - - {{ item.dictLabel }} +
+
+
+ + + {{ item.dictLabel }} -
-
- 收藏夹 -
-
- - +
+
+ 收藏夹 +
+ + +
- +
{{ item.regions }}
-
-
- - {{resource.regions}} - -
-
-
- {{ res.cameraName || res.cameraIndexCode }} -
-
- -
- +
+
+ + {{ resource.regions }} + +
+
+
+ {{ res.cameraName || res.cameraIndexCode }} +
+
+ +
+
@@ -76,33 +76,33 @@
关注 + v-if="item.isCollect == 0" + class="video-item__unfollow" + @click.stop="handleCollect(item.cameraIndexCode, item.isCollect, index)" + >关注

{{ item.cameraName || item.cameraIndexCode }} @@ -112,12 +112,12 @@

@@ -125,64 +125,68 @@
-
- 关注 - 取消关注 -
- + 关注 + 取消关注 +
+
+ 聚焦 - +
- - + + - - + + +
+
+ 收藏 + 取消收藏
-
- 收藏 - 取消收藏 -
- +
- + 返回
  • {{ item.cameraName }}

  • @@ -190,159 +194,226 @@
- + diff --git a/src/views/scenic/components/jam.vue b/src/views/scenic/components/jam.vue index 4b44f7d..28ee6f3 100644 --- a/src/views/scenic/components/jam.vue +++ b/src/views/scenic/components/jam.vue @@ -151,12 +151,28 @@ params.series[0].label.formatter = formatLabel() params.series[0].data = getSeriesData() } - setOption(params) + const chart = setOption(params); + chart.on('legendselectchanged', function (e) { + var echartsArr = []; + for (let key in e.selected) { + if (e.selected[key]) { + echartsArr.push(key) + } + } + var echartsNum = 0; + props.list.forEach(item => { + if(echartsArr.includes(item.name)){ + echartsNum += parseInt(item.count) + } + }) + params.series[0].label.formatter = `{value|${echartsNum}}` + '\n' + `{name|${props.subTitle}}`; + setOption(params); + }); }