|
@@ -6,7 +6,7 @@
|
|
|
:url-list="[url]"
|
|
:url-list="[url]"
|
|
|
:on-close="closeDialog"
|
|
:on-close="closeDialog"
|
|
|
/>
|
|
/>
|
|
|
- <!-- <template v-if="fileType !== 'image' && fileType">
|
|
|
|
|
|
|
+ <template v-if="fileType !== 'image' && fileType">
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
|
:title="title"
|
|
:title="title"
|
|
@@ -25,7 +25,7 @@
|
|
|
/>
|
|
/>
|
|
|
<div v-else class="lc-fixed-navbar">不支持预览的类型</div>
|
|
<div v-else class="lc-fixed-navbar">不支持预览的类型</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
- </template> -->
|
|
|
|
|
|
|
+ </template>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
@@ -44,6 +44,7 @@
|
|
|
// import AudioViewer from './audio' //xianyifan
|
|
// import AudioViewer from './audio' //xianyifan
|
|
|
// import VideoViewer from './video' //xianyifan
|
|
// import VideoViewer from './video' //xianyifan
|
|
|
// import TxtViewer from './txt'
|
|
// import TxtViewer from './txt'
|
|
|
|
|
+ import pdfViewer from './pdf/index'
|
|
|
import { officeType, pdfType, txtType, imageType, audioType, videoType } from './constants'
|
|
import { officeType, pdfType, txtType, imageType, audioType, videoType } from './constants'
|
|
|
import PopupManager from '@/utils/popup'
|
|
import PopupManager from '@/utils/popup'
|
|
|
import editor from '@/business/platform/file/attachment/editFile/editor.vue'
|
|
import editor from '@/business/platform/file/attachment/editFile/editor.vue'
|
|
@@ -54,7 +55,8 @@
|
|
|
// AudioViewer,
|
|
// AudioViewer,
|
|
|
// VideoViewer,
|
|
// VideoViewer,
|
|
|
// TxtViewer,
|
|
// TxtViewer,
|
|
|
- editor
|
|
|
|
|
|
|
+ editor,
|
|
|
|
|
+ pdfViewer
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
|
visible: {
|
|
visible: {
|
|
@@ -74,6 +76,10 @@
|
|
|
optionFile: {
|
|
optionFile: {
|
|
|
type: Object,
|
|
type: Object,
|
|
|
default: () => {}
|
|
default: () => {}
|
|
|
|
|
+ },
|
|
|
|
|
+ file:{
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ require: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
@@ -99,7 +105,7 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- visible: {
|
|
|
|
|
|
|
+ optionFile: {
|
|
|
handler: function (val, oldVal) {
|
|
handler: function (val, oldVal) {
|
|
|
this.dialogVisible = this.visible
|
|
this.dialogVisible = this.visible
|
|
|
this.loadViewer()
|
|
this.loadViewer()
|
|
@@ -120,17 +126,27 @@
|
|
|
return PopupManager.getZIndex()
|
|
return PopupManager.getZIndex()
|
|
|
},
|
|
},
|
|
|
loadViewer() {
|
|
loadViewer() {
|
|
|
|
|
+ var flag = true;
|
|
|
|
|
+ if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
|
|
|
|
|
+ flag = false
|
|
|
|
|
+ }
|
|
|
if (imageType.includes(this.fileExt)) {
|
|
if (imageType.includes(this.fileExt)) {
|
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
|
this.zIndex = this.fixZIndex()
|
|
this.zIndex = this.fixZIndex()
|
|
|
this.fileUrl = this.url
|
|
this.fileUrl = this.url
|
|
|
this.fileType = 'image'
|
|
this.fileType = 'image'
|
|
|
|
|
+ } else if(flag && pdfType.includes(this.fileExt)){
|
|
|
|
|
+ this.fileType = 'pdf'
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.viewer.load(this.url)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
this.openDialog() // 先初始化调用参数
|
|
this.openDialog() // 先初始化调用参数
|
|
|
this.openWindow() // 打开外部预览页面
|
|
this.openWindow() // 打开外部预览页面
|
|
|
this.closeDialog() // 关闭当前
|
|
this.closeDialog() // 关闭当前
|
|
|
// this.fileType = 'FILE'
|
|
// this.fileType = 'FILE'
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
// else if (
|
|
// else if (
|
|
|
// officeType.includes(this.fileExt) ||
|
|
// officeType.includes(this.fileExt) ||
|
|
|
// pdfType.includes(this.fileExt)
|
|
// pdfType.includes(this.fileExt)
|