主动拍照

menu1.0
fanluyan 9 months ago
parent 75a7740ab4
commit 0b954ced79

@ -277,8 +277,12 @@ export default {
}, },
mounted() { mounted() {
console.log("我是图片列表", this.terminalPhoto); console.log("我是图片列表", this.terminalPhoto);
this.changeBigPic(this.terminalPhoto[0], 0); if (this.terminalPhoto) {
// console.log(this.terminalPhoto[0].path); this.changeBigPic(this.terminalPhoto[0], 0);
//
}
//console.log(this.terminalPhoto[0]);
}, },
watch: { watch: {
terminalPhoto: { terminalPhoto: {
@ -421,56 +425,62 @@ export default {
}, },
// //
changeBigPic(data, i) { changeBigPic(data, i) {
this.picDataAlarm = data; if (data) {
this.srcList = []; console.log("aaaaaaaaaaaaaaaaaaaaa", data.mediaType);
this.localPoints = []; this.mediaType = data.mediaType !== null ? data.mediaType : 0;
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 (sizeInMB >= 1) { this.picDataAlarm = data;
this.fileSize = `${sizeInMB.toFixed(2)}M`; // 1MBMB 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 { } else {
this.fileSize = `${sizeInKB.toFixed(0)}K`; // 1MBKB this.radioPx = "";
} }
} else { if (data.fileSize !== undefined) {
this.fileSize = ""; // data.fileSize const sizeInBytes = data.fileSize;
} const sizeInMB = sizeInBytes / (1024 * 1024);
const sizeInKB = sizeInBytes / 1024;
// console.log(data.channelId); if (sizeInMB >= 1) {
if (data.channelId) { this.fileSize = `${sizeInMB.toFixed(2)}M`; // 1MBMB
this.getPointList(data); } else {
} this.fileSize = `${sizeInKB.toFixed(0)}K`; // 1MBKB
const items = this.$refs.scrollBox.querySelectorAll(".smallPic"); }
const selectedItem = items[i]; } else {
const selectedItemLeft = selectedItem.offsetLeft; this.fileSize = ""; // data.fileSize
const scrollContainer = this.$refs.scrollBox; }
const scrollContainerWidth = scrollContainer.offsetWidth;
const selectedItemWidth = selectedItem.offsetWidth; // 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 = let scrollDistance =
selectedItemLeft - (scrollContainerWidth - selectedItemWidth) / 2; selectedItemLeft - (scrollContainerWidth - selectedItemWidth) / 2;
if (scrollDistance < 0) { if (scrollDistance < 0) {
scrollDistance = 0; scrollDistance = 0;
} else if ( } else if (
scrollDistance + scrollContainerWidth > scrollDistance + scrollContainerWidth >
scrollContainer.scrollWidth scrollContainer.scrollWidth
) { ) {
scrollDistance = scrollContainer.scrollWidth - scrollContainerWidth; scrollDistance = scrollContainer.scrollWidth - scrollContainerWidth;
}
// scrollLeft
scrollContainer.scrollLeft = scrollDistance;
} }
// scrollLeft
scrollContainer.scrollLeft = scrollDistance;
}, },
loadImage() { loadImage() {
console.log("loading"); console.log("loading");

@ -111,6 +111,7 @@ export default {
setTermFn(val) { setTermFn(val) {
setTermCamera({ setTermCamera({
termId: this.termId, termId: this.termId,
channelId: this.pzchannelId,
list: val, list: val,
}) })
.then((res) => { .then((res) => {
@ -239,7 +240,7 @@ export default {
}).then((res) => { }).then((res) => {
console.log(res.data); console.log(res.data);
console.log(this.picNum); console.log(this.picNum);
console.log(this.pzchannelId) console.log(this.pzchannelId);
if (res.data == true && this.picNum < 10) { if (res.data == true && this.picNum < 10) {
// console.log(this.$parent.$parent); // console.log(this.$parent.$parent);
this.$parent.$parent.getPhotoList( this.$parent.$parent.getPhotoList(
@ -266,15 +267,15 @@ export default {
}); });
}, },
clearFn() { clearFn() {
console.log("我要取消了轮巡") console.log("我要取消了轮巡");
clearInterval(this.statusTimer); clearInterval(this.statusTimer);
this.statusTimer = null; this.statusTimer = null;
this.statusNum = 0; this.statusNum = 0;
this.picLoading = false; this.picLoading = false;
console.log("我要取消了轮巡1111111111111111111111111111111") console.log("我要取消了轮巡1111111111111111111111111111111");
clearInterval(this.picPimer); clearInterval(this.picPimer);
this.picPimer = null; this.picPimer = null;
this.picNum = 0; this.picNum = 0;
}, },
}, },
destroyed() { destroyed() {

Loading…
Cancel
Save