diff --git a/src/views/realTimeMonitor/components/carouselChart.vue b/src/views/realTimeMonitor/components/carouselChart.vue index 98d2196..d1225a1 100644 --- a/src/views/realTimeMonitor/components/carouselChart.vue +++ b/src/views/realTimeMonitor/components/carouselChart.vue @@ -277,8 +277,12 @@ export default { }, mounted() { console.log("我是图片列表", this.terminalPhoto); - this.changeBigPic(this.terminalPhoto[0], 0); - // console.log(this.terminalPhoto[0].path); + if (this.terminalPhoto) { + this.changeBigPic(this.terminalPhoto[0], 0); + // 进行其他操作 + } + + //console.log(this.terminalPhoto[0]); }, watch: { terminalPhoto: { @@ -421,56 +425,62 @@ export default { }, //获取第一张大图 changeBigPic(data, i) { - this.picDataAlarm = data; - this.srcList = []; - this.localPoints = []; - this.activeSmall = i; - this.mediaType = data.mediaType; - this.currentPicPath = data.path; - this.srcList.push(data.path); - if (data.width != undefined) { - this.radioPx = data.width + "x" + data.height; - } else { - this.radioPx = ""; - } - if (data.fileSize !== undefined) { - const sizeInBytes = data.fileSize; - const sizeInMB = sizeInBytes / (1024 * 1024); - const sizeInKB = sizeInBytes / 1024; + if (data) { + console.log("aaaaaaaaaaaaaaaaaaaaa", data.mediaType); + this.mediaType = data.mediaType !== null ? data.mediaType : 0; - if (sizeInMB >= 1) { - this.fileSize = `${sizeInMB.toFixed(2)}M`; // 大于等于1MB,以MB为单位,保留两位小数 + this.picDataAlarm = data; + this.srcList = []; + this.localPoints = []; + this.activeSmall = i; + + this.currentPicPath = data.path; + this.srcList.push(data.path); + + if (data.width != undefined) { + this.radioPx = data.width + "x" + data.height; } else { - this.fileSize = `${sizeInKB.toFixed(0)}K`; // 小于1MB,以KB为单位,保留两位小数 + this.radioPx = ""; } - } else { - this.fileSize = ""; // 如果data.fileSize未定义,则设置为空字符串 - } + if (data.fileSize !== undefined) { + const sizeInBytes = data.fileSize; + const sizeInMB = sizeInBytes / (1024 * 1024); + const sizeInKB = sizeInBytes / 1024; - // console.log(data.channelId); - if (data.channelId) { - this.getPointList(data); - } - const items = this.$refs.scrollBox.querySelectorAll(".smallPic"); - const selectedItem = items[i]; - const selectedItemLeft = selectedItem.offsetLeft; - const scrollContainer = this.$refs.scrollBox; - const scrollContainerWidth = scrollContainer.offsetWidth; - const selectedItemWidth = selectedItem.offsetWidth; + if (sizeInMB >= 1) { + this.fileSize = `${sizeInMB.toFixed(2)}M`; // 大于等于1MB,以MB为单位,保留两位小数 + } else { + this.fileSize = `${sizeInKB.toFixed(0)}K`; // 小于1MB,以KB为单位,保留两位小数 + } + } else { + this.fileSize = ""; // 如果data.fileSize未定义,则设置为空字符串 + } + + // console.log(data.channelId); + if (data.channelId) { + this.getPointList(data); + } + const items = this.$refs.scrollBox.querySelectorAll(".smallPic"); + const selectedItem = items[i]; + const selectedItemLeft = selectedItem.offsetLeft; + const scrollContainer = this.$refs.scrollBox; + const scrollContainerWidth = scrollContainer.offsetWidth; + const selectedItemWidth = selectedItem.offsetWidth; - // 计算滚动距离,确保选中的元素在滚动容器内完整显示 - let scrollDistance = - selectedItemLeft - (scrollContainerWidth - selectedItemWidth) / 2; - if (scrollDistance < 0) { - scrollDistance = 0; - } else if ( - scrollDistance + scrollContainerWidth > - scrollContainer.scrollWidth - ) { - scrollDistance = scrollContainer.scrollWidth - scrollContainerWidth; + // 计算滚动距离,确保选中的元素在滚动容器内完整显示 + let scrollDistance = + selectedItemLeft - (scrollContainerWidth - selectedItemWidth) / 2; + if (scrollDistance < 0) { + scrollDistance = 0; + } else if ( + scrollDistance + scrollContainerWidth > + scrollContainer.scrollWidth + ) { + scrollDistance = scrollContainer.scrollWidth - scrollContainerWidth; + } + // 调整滚动容器的scrollLeft + scrollContainer.scrollLeft = scrollDistance; } - // 调整滚动容器的scrollLeft - scrollContainer.scrollLeft = scrollDistance; }, loadImage() { console.log("loading"); diff --git a/src/views/realTimeMonitor/components/takePicButton.vue b/src/views/realTimeMonitor/components/takePicButton.vue index 43a9c1a..08d77b7 100644 --- a/src/views/realTimeMonitor/components/takePicButton.vue +++ b/src/views/realTimeMonitor/components/takePicButton.vue @@ -111,6 +111,7 @@ export default { setTermFn(val) { setTermCamera({ termId: this.termId, + channelId: this.pzchannelId, list: val, }) .then((res) => { @@ -239,7 +240,7 @@ export default { }).then((res) => { console.log(res.data); console.log(this.picNum); - console.log(this.pzchannelId) + console.log(this.pzchannelId); if (res.data == true && this.picNum < 10) { // console.log(this.$parent.$parent); this.$parent.$parent.getPhotoList( @@ -266,15 +267,15 @@ export default { }); }, clearFn() { - console.log("我要取消了轮巡") + console.log("我要取消了轮巡"); clearInterval(this.statusTimer); this.statusTimer = null; this.statusNum = 0; this.picLoading = false; - console.log("我要取消了轮巡1111111111111111111111111111111") + console.log("我要取消了轮巡1111111111111111111111111111111"); clearInterval(this.picPimer); - this.picPimer = null; - this.picNum = 0; + this.picPimer = null; + this.picNum = 0; }, }, destroyed() {