|
@@ -1,13 +1,15 @@
|
|
|
<template>
|
|
<template>
|
|
|
<popup v-if="ifShow">
|
|
<popup v-if="ifShow">
|
|
|
- <div class="preview-wrapper">
|
|
|
|
|
|
|
+ <div class="preview-wrapper" ref="preview-wrapper">
|
|
|
<div class="title">{{imageTitleList[currentIndex]}}</div>
|
|
<div class="title">{{imageTitleList[currentIndex]}}</div>
|
|
|
<img class="close-btn" :src="require('@/assets/images/icons/material_preview_close@2x.png')" @click=onClickClose />
|
|
<img class="close-btn" :src="require('@/assets/images/icons/material_preview_close@2x.png')" @click=onClickClose />
|
|
|
- <img
|
|
|
|
|
- class="image"
|
|
|
|
|
- :src="imageList[currentIndex]"
|
|
|
|
|
- :style="imageStyle"
|
|
|
|
|
- @wheel.prevent="onImageWheel"
|
|
|
|
|
|
|
+ <iframe
|
|
|
|
|
+ ref="iframe"
|
|
|
|
|
+ class="iframe"
|
|
|
|
|
+ allowfullscreen="true"
|
|
|
|
|
+ :src="'./vr.html?hideScale=true&vr='+ sceneCodeList[currentIndex]"
|
|
|
|
|
+ frameborder="0"
|
|
|
|
|
+ :style="{width: imageWidth, height: imageHeight}"
|
|
|
/>
|
|
/>
|
|
|
<div class="toolbar">
|
|
<div class="toolbar">
|
|
|
<i
|
|
<i
|
|
@@ -21,27 +23,17 @@
|
|
|
<div class="remark">下一张</div>
|
|
<div class="remark">下一张</div>
|
|
|
</div>
|
|
</div>
|
|
|
</i>
|
|
</i>
|
|
|
- <i v-if="canScale" class="iconfont icon-material_preview_enlarge hover-tips" @click="onClickZoomIn()">
|
|
|
|
|
- <div>
|
|
|
|
|
- <div class="remark">放大</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </i>
|
|
|
|
|
- <i v-if="canScale" class="iconfont icon-material_preview_narrow hover-tips" @click="onClickZoomOut()">
|
|
|
|
|
- <div>
|
|
|
|
|
- <div class="remark">缩小</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </i>
|
|
|
|
|
<i class="iconfont icon-material_preview_next hover-tips-warn" @click="onClickDelete()">
|
|
<i class="iconfont icon-material_preview_next hover-tips-warn" @click="onClickDelete()">
|
|
|
<div>
|
|
<div>
|
|
|
<div class="remark">删除</div>
|
|
<div class="remark">删除</div>
|
|
|
</div>
|
|
</div>
|
|
|
</i>
|
|
</i>
|
|
|
- <i v-if="canFullScreen && objectFit === 'scale-down'" class="iconfont icon-material_preview_full_screen hover-tips" @click="onClickFullScreen()">
|
|
|
|
|
|
|
+ <i v-if="!isFullscreen" class="iconfont icon-material_preview_full_screen hover-tips" @click="onClickFullScreen()">
|
|
|
<div>
|
|
<div>
|
|
|
<div class="remark">全屏</div>
|
|
<div class="remark">全屏</div>
|
|
|
</div>
|
|
</div>
|
|
|
</i>
|
|
</i>
|
|
|
- <i v-if="canFullScreen && objectFit === 'contain'" class="iconfont icon-material_preview_drop_out hover-tips" @click="onClickCancelFullScreen()">
|
|
|
|
|
|
|
+ <i v-if="isFullscreen" class="iconfont icon-material_preview_drop_out hover-tips" @click="onClickCancelFullScreen()">
|
|
|
<div>
|
|
<div>
|
|
|
<div class="remark">取消全屏</div>
|
|
<div class="remark">取消全屏</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -60,24 +52,20 @@ export default {
|
|
|
type: Array,
|
|
type: Array,
|
|
|
default: () => {
|
|
default: () => {
|
|
|
return [
|
|
return [
|
|
|
- 'aaa',
|
|
|
|
|
- 'bbb'
|
|
|
|
|
|
|
+ // 'aaa',
|
|
|
|
|
+ // 'bbb'
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- imageList: {
|
|
|
|
|
|
|
+ sceneCodeList: {
|
|
|
type: Array,
|
|
type: Array,
|
|
|
default: () => {
|
|
default: () => {
|
|
|
return [
|
|
return [
|
|
|
- 'https://oss-xiaoan.oss-cn-shenzhen.aliyuncs.com/720yun_fd_manage/fodder/20220125_114634855.jpg',
|
|
|
|
|
- 'https://oss-xiaoan.oss-cn-shenzhen.aliyuncs.com/720yun_fd_manage/fodder/20220125_142545584.jpg',
|
|
|
|
|
|
|
+ // 'fd720_jWlTO6FIr',
|
|
|
|
|
+ // 'fd720_egHPArS4K',
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- canScale: {
|
|
|
|
|
- type: Boolean,
|
|
|
|
|
- default: true
|
|
|
|
|
- },
|
|
|
|
|
canFullScreen: {
|
|
canFullScreen: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
default: true
|
|
default: true
|
|
@@ -90,20 +78,19 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
ifShow: false,
|
|
ifShow: false,
|
|
|
currentIndex: 0,
|
|
currentIndex: 0,
|
|
|
- scaleRate: 1,
|
|
|
|
|
- objectFit: 'scale-down',
|
|
|
|
|
|
|
+ isFullscreen: false,
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
- imageStyle() {
|
|
|
|
|
- return {
|
|
|
|
|
- transform: `scale(${this.scaleRate})`,
|
|
|
|
|
- objectFit: this.objectFit,
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ imageWidth() {
|
|
|
|
|
+ return this.isFullscreen ? '100%' : '960px'
|
|
|
|
|
+ },
|
|
|
|
|
+ imageHeight() {
|
|
|
|
|
+ return this.isFullscreen ? '100%': '540px'
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- imageList: {
|
|
|
|
|
|
|
+ sceneCodeList: {
|
|
|
handler: function (newList) {
|
|
handler: function (newList) {
|
|
|
if (newList.length - 1 < this.currentIndex) {
|
|
if (newList.length - 1 < this.currentIndex) {
|
|
|
this.currentIndex = newList.length - 1
|
|
this.currentIndex = newList.length - 1
|
|
@@ -116,39 +103,43 @@ export default {
|
|
|
Number.isSafeInteger(index) && (this.currentIndex = index)
|
|
Number.isSafeInteger(index) && (this.currentIndex = index)
|
|
|
this.ifShow = true
|
|
this.ifShow = true
|
|
|
},
|
|
},
|
|
|
- onImageWheel(e) {
|
|
|
|
|
- if (e.deltaY > 0) {
|
|
|
|
|
- this.scaleRate = this.scaleRate * 1.1
|
|
|
|
|
- } else {
|
|
|
|
|
- this.scaleRate = this.scaleRate * 0.9
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
onClickPrevious() {
|
|
onClickPrevious() {
|
|
|
if (this.currentIndex > 0) {
|
|
if (this.currentIndex > 0) {
|
|
|
this.currentIndex--
|
|
this.currentIndex--
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onClickNext() {
|
|
onClickNext() {
|
|
|
- if (this.currentIndex < this.imageList.length - 1) {
|
|
|
|
|
|
|
+ if (this.currentIndex < this.sceneCodeList.length - 1) {
|
|
|
this.currentIndex++
|
|
this.currentIndex++
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- onClickZoomIn() {
|
|
|
|
|
- this.scaleRate = this.scaleRate * 1.1
|
|
|
|
|
- },
|
|
|
|
|
- onClickZoomOut() {
|
|
|
|
|
- this.scaleRate *= 0.9
|
|
|
|
|
- },
|
|
|
|
|
onClickDelete() {
|
|
onClickDelete() {
|
|
|
this.$emit('click-delete', this.currentIndex)
|
|
this.$emit('click-delete', this.currentIndex)
|
|
|
},
|
|
},
|
|
|
onClickFullScreen() {
|
|
onClickFullScreen() {
|
|
|
- this.scaleRate = 1
|
|
|
|
|
- this.objectFit = 'contain'
|
|
|
|
|
|
|
+ const element = this.$refs['preview-wrapper']
|
|
|
|
|
+ if (element.requestFullscreen) {
|
|
|
|
|
+ element.requestFullscreen();
|
|
|
|
|
+ } else if (element.webkitRequestFullScreen) {
|
|
|
|
|
+ element.webkitRequestFullScreen();
|
|
|
|
|
+ } else if (element.mozRequestFullScreen) {
|
|
|
|
|
+ element.mozRequestFullScreen();
|
|
|
|
|
+ } else if (element.msRequestFullscreen) {
|
|
|
|
|
+ element.msRequestFullscreen();
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isFullscreen = true
|
|
|
},
|
|
},
|
|
|
onClickCancelFullScreen() {
|
|
onClickCancelFullScreen() {
|
|
|
- this.scaleRate = 1
|
|
|
|
|
- this.objectFit = 'scale-down'
|
|
|
|
|
|
|
+ if (document.exitFullscreen) {
|
|
|
|
|
+ document.exitFullscreen();
|
|
|
|
|
+ } else if (document.webkitCancelFullScreen) {
|
|
|
|
|
+ document.webkitCancelFullScreen();
|
|
|
|
|
+ } else if (document.mozCancelFullScreen) {
|
|
|
|
|
+ document.mozCancelFullScreen();
|
|
|
|
|
+ } else if (document.msExitFullscreen) {
|
|
|
|
|
+ document.msExitFullscreen();
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isFullscreen = false
|
|
|
},
|
|
},
|
|
|
onClickClose() {
|
|
onClickClose() {
|
|
|
this.ifShow = false
|
|
this.ifShow = false
|
|
@@ -191,7 +182,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
.toolbar {
|
|
.toolbar {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- bottom: 147px;
|
|
|
|
|
|
|
+ bottom: 110px;
|
|
|
left: 50%;
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
transform: translateX(-50%);
|
|
|
height: 60px;
|
|
height: 60px;
|
|
@@ -222,12 +213,11 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .image {
|
|
|
|
|
- top: 0;
|
|
|
|
|
- left: 0;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
|
|
+ .iframe {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ top: 50%;
|
|
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
z-index: 1;
|
|
z-index: 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|