|
|
|
@ -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");
|
|
|
|
|