From 155dbc01da52ccee7a968bfe7297b5fc0357e6bb Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 20 三月 2026 16:12:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/show-demo' into show_demo
---
src/views/dashboard/Analysis.vue | 77 ++++++++++++++++++++++++++++----------
1 files changed, 56 insertions(+), 21 deletions(-)
diff --git a/src/views/dashboard/Analysis.vue b/src/views/dashboard/Analysis.vue
index 8233f34..4f60f26 100644
--- a/src/views/dashboard/Analysis.vue
+++ b/src/views/dashboard/Analysis.vue
@@ -17,7 +17,7 @@
placeholder="璇烽�夋嫨缁堢璁惧"
style="width: 200px"
v-model="selectCameraCode"
- @change="alarmLogInit"
+ @change="onCameraChange"
>
<a-select-option :value="''" :key="''">鍏ㄩ儴</a-select-option>
<a-select-option :value="item.code" v-for="item in cameraList" :key="item.code">
@@ -111,7 +111,7 @@
AnalysisDetailModal,
},
- data() {
+ data() {
return {
selectOrg: '',
show: false,
@@ -122,16 +122,14 @@
cameraList: [],
selectCameraCode: '',
videoConfig: {
- variable: 'player', //鎾斁鍑芥暟鍚嶇О锛岃灞炴�у繀闇�璁剧疆锛屽�肩瓑浜庝笅闈㈢殑new ckplayer()鐨勫璞�
- // live: true,
+ variable: 'player',
backLive: false,
- track: null, //瀛楀箷
+ track: null,
crossorigin: '',
playbackrateOpen: true,
autoplay: true,
- loop: true, //鏄惁闇�瑕佸惊鐜挱鏀�
- video: 'https://ckplayer-video.oss-cn-shanghai.aliyuncs.com/mp4/1_640x480.mp4', //瑙嗛鍦板潃,
- // loaded: "loadedHandler", //鎾斁鍣ㄥ姞杞藉畬鎴愬悗璋冪敤璇ュ嚱鏁�
+ loop: true,
+ video: '',
},
categoryOptions: [
{
@@ -160,6 +158,8 @@
url: {
list: '/jyz/oilEvent/eventList',
eventPopup: '/jyz/oilEvent/eventPopup',
+ localVideoRandom: '/jyz/video/random',
+ randomImages: '/jyz/video/random-images',
},
}
},
@@ -176,25 +176,56 @@
mounted() {
// this.one_video_ckplayera()
this.getCameraList()
-
+ this.getLocalVideo()
this.timer = setInterval(this.playAudio, 30000)
},
methods: {
+ // 鑾峰彇鏈湴闅忔満瑙嗛
+ getLocalVideo() {
+ getAction(this.url.localVideoRandom).then((res) => {
+ if (res.code === 200 && res.result) {
+ this.hasVideo = true
+ this.eventVideoPlay(res.result)
+ }
+ })
+ },
+ assignRandomImages(recordList) {
+ if (!recordList || !recordList.length) {
+ return Promise.resolve([])
+ }
+ return getAction(this.url.randomImages, { count: recordList.length })
+ .then((imageRes) => {
+ if (imageRes.code === 200 && Array.isArray(imageRes.result) && imageRes.result.length) {
+ return recordList.map((item, index) => {
+ return {
+ ...item,
+ imgPath: imageRes.result[index % imageRes.result.length],
+ }
+ })
+ }
+ return recordList
+ })
+ .catch(() => recordList)
+ },
+
// Alarm Log 鍛婅璁板綍
alarmLogInit(isFirst) {
getAction(this.url.list, { limit: 20, cameraCode: this.selectCameraCode }).then((res) => {
if (res.code === 200) {
- this.takeList = res.result
- if (res.result.length > 0 && isFirst) {
- if (res.result[0].videoPath) {
- this.hasVideo = true
- this.eventVideoPlay(res.result[0].videoPath)
- } else {
- this.hasVideo = false
- this.player && this.player.remove()
+ const sourceList = Array.isArray(res.result) ? res.result : []
+ this.assignRandomImages(sourceList).then((finalList) => {
+ this.takeList = finalList
+ if (finalList.length > 0 && isFirst) {
+ if (finalList[0].videoPath) {
+ this.hasVideo = true
+ this.eventVideoPlay(finalList[0].videoPath)
+ } else {
+ this.hasVideo = false
+ this.player && this.player.remove()
+ }
}
- }
+ })
} else {
this.$message.error('鑾峰彇澶辫触!')
}
@@ -230,12 +261,16 @@
this.videoConfig.video = video
this.player && this.player.remove()
var videoObject = {
- ...this.videoConfig, // 閫氱敤閰嶇疆
- container: '.one_video', //鈥�#鈥濅唬琛ㄥ鍣ㄧ殑ID锛屸��.鈥濇垨鈥溾�濅唬琛ㄥ鍣ㄧ殑class
+ ...this.videoConfig,
+ container: '.one_video',
}
- this.player = new ckplayer(videoObject) //鍒濆鍖栨挱鏀惧櫒
+ this.player = new ckplayer(videoObject)
},
handleScroll() {},
+ onCameraChange() {
+ this.alarmLogInit(false)
+ this.getLocalVideo()
+ },
onTreeNodeSelect(id, node) {
this.selectOrg = node.selectedNodes[0].data.props.orgCode
console.log(id, this.selectOrg)
--
Gitblit v1.8.0