|
@@ -45,6 +45,13 @@
|
|
|
</div>
|
|
|
<!-- <ui-icon v-show="loading" class="loading-icon" type="_loading_"></ui-icon> -->
|
|
|
</div>
|
|
|
+ <div class="continue" v-if="imageList.length > 1">
|
|
|
+ <span class="pic-num">
|
|
|
+ <span class="cur">{{ imageNum + 1 }}</span>
|
|
|
+ <span><span> </span>/<span> </span></span>
|
|
|
+ <span>{{ imageList.length }}</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -52,10 +59,12 @@
|
|
|
import { onMounted, nextTick, ref, computed, defineProps, defineEmits } from 'vue';
|
|
|
import { tagType } from '/@/store/modules/scene';
|
|
|
import { changeUrl } from '../common';
|
|
|
- import { useApp } from '/@/hooks/userApp';
|
|
|
+ // import { useApp } from '/@/hooks/userApp';
|
|
|
+ import browser from '/@/utils/browser';
|
|
|
const isMobile = ref(false);
|
|
|
- const type = ref('image');
|
|
|
+ // const type = ref('image');
|
|
|
const emit = defineEmits(['close']);
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
data: {
|
|
|
type: Object,
|
|
@@ -106,8 +115,9 @@
|
|
|
if (list.length > 0) {
|
|
|
picLength = list.length;
|
|
|
}
|
|
|
+
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
- if (list.length < customer['image'].maxNum) {
|
|
|
+ if (list.length < 9) {
|
|
|
list.push('');
|
|
|
var index = i + picLength;
|
|
|
list[index] = { src: URL.createObjectURL(data[i]), file: data[i] };
|
|
@@ -163,7 +173,7 @@
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
- const containerRef = ref(null);
|
|
|
+ const containerRef = ref<HTMLElement | null>(null);
|
|
|
|
|
|
const zoomFun = (e) => {
|
|
|
let ratio = 1.1;
|
|
@@ -198,11 +208,11 @@
|
|
|
};
|
|
|
|
|
|
// 滚轮缩放
|
|
|
- const initWheelZoom = (imgEle) => {
|
|
|
- containerRef.value.addEventListener('wheel', zoomFun);
|
|
|
+ const initWheelZoom = () => {
|
|
|
+ containerRef.value?.addEventListener('wheel', zoomFun);
|
|
|
};
|
|
|
const removeWheelZoom = () => {
|
|
|
- containerRef.value.removeEventListener('wheel', zoomFun);
|
|
|
+ containerRef.value?.removeEventListener('wheel', zoomFun);
|
|
|
};
|
|
|
|
|
|
const resetScale = () => {
|
|
@@ -221,33 +231,35 @@
|
|
|
initScale();
|
|
|
});
|
|
|
};
|
|
|
- let imgEle = null;
|
|
|
+ let imgEle: HTMLImageElement;
|
|
|
const initScale = () => {
|
|
|
imgEle = document.getElementById(`domImg${imageNum.value}`);
|
|
|
|
|
|
x = 0;
|
|
|
y = 0;
|
|
|
- imgEle.style.transform = 'translate3d(' + x + 'px, ' + y + 'px, 0) scale(1)';
|
|
|
+ if (imgEle) {
|
|
|
+ imgEle.style.transform = 'translate3d(' + x + 'px, ' + y + 'px, 0) scale(1)';
|
|
|
|
|
|
- result.width = imgEle.width;
|
|
|
- result.height = imgEle.height;
|
|
|
+ result.width = imgEle.width;
|
|
|
+ result.height = imgEle.height;
|
|
|
+ }
|
|
|
|
|
|
nextTick(() => {
|
|
|
// 拖拽查看
|
|
|
drag(imgEle);
|
|
|
+
|
|
|
// 滚轮缩放
|
|
|
- initWheelZoom(imgEle);
|
|
|
+ initWheelZoom();
|
|
|
});
|
|
|
};
|
|
|
onMounted(async () => {
|
|
|
- const app = await useApp();
|
|
|
- isMobile.value = app.config.mobile;
|
|
|
+ // const app = await useApp();
|
|
|
+ isMobile.value = browser.isMobile();
|
|
|
|
|
|
nextTick(() => {
|
|
|
let img = new Image();
|
|
|
img.onload = () => {
|
|
|
loading.value = false;
|
|
|
-
|
|
|
if (props.viewer && !isMobile.value) {
|
|
|
//pc端缩放
|
|
|
nextTick(() => {
|
|
@@ -264,29 +276,17 @@
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- const filesError = (index) => {
|
|
|
- loading.value = false;
|
|
|
- };
|
|
|
+
|
|
|
const zoomInImg = ref(null);
|
|
|
|
|
|
-
|
|
|
- const closePhoto = () => {
|
|
|
- if (imageList.value.length == 1) {
|
|
|
- emit('close');
|
|
|
- } else {
|
|
|
- zoomInImg.value = null;
|
|
|
- }
|
|
|
- // $('#tag-billboards').css({ 'z-index': '101', 'pointer-events': 'none' });
|
|
|
- };
|
|
|
const openScale = (src) => {
|
|
|
if (isMobile.value) {
|
|
|
zoomInImg.value = changeUrl(src);
|
|
|
-
|
|
|
- let img = new Image();
|
|
|
+ let img: HTMLImageElement = new Image();
|
|
|
img.onload = () => {
|
|
|
loading.value = false;
|
|
|
};
|
|
|
- img.src = zoomInImg.value;
|
|
|
+ img.src = zoomInImg.value || '';
|
|
|
// nextTick(() => {
|
|
|
// zoomElement(topology.value)
|
|
|
// })
|