Browse Source

预览下载优化

master
xuhuajiao 2 weeks ago
parent
commit
12f4bf20c3
  1. 6
      src/views/preview/index.vue

6
src/views/preview/index.vue

@ -42,7 +42,7 @@
<li>尺寸{{ (!(fileCurrent && fileCurrent.file_dpi) || (fileCurrent && fileCurrent.file_dpi === 'null')) ? '-' : fileCurrent.file_dpi }}</li>
</ul>
<div class="preview-btn">
<el-button class="iconfont icon-xiazai" @click="downloadFile(fileCurrent)">下载</el-button>
<el-button :loading="downloading" class="iconfont icon-xiazai" @click="downloadFile(fileCurrent)">下载</el-button>
<el-button v-print="printObj" class="iconfont icon-dayin">打印</el-button>
</div>
</div>
@ -78,6 +78,7 @@ export default {
},
data() {
return {
downloading: false,
src: '',
logo: require('../../assets/images/logo.png'),
//
@ -169,6 +170,7 @@ export default {
downloadFile(row) {
// filePath
// bucketType 1 2
this.downloading = true
let bucketType = null
if (this.documentId) {
bucketType = 1
@ -184,8 +186,10 @@ export default {
}
fetch(url, fetchOptions).then(res => res.blob()).then(blob => {
downloadFile(blob, row.file_name.split('.')[0], row.file_type)
this.downloading = false
}).catch(() => {
this.$message({ message: '下载文件失败', type: 'error', offset: 8 })
this.downloading = false
})
},
selectFile(item) {

Loading…
Cancel
Save