|
@@ -35,7 +35,7 @@
|
|
<!--复位按钮-->
|
|
<!--复位按钮-->
|
|
<p class="position-refresh-p el-icon-refresh" @click="clickLookImg(lookIndex)"></p>
|
|
<p class="position-refresh-p el-icon-refresh" @click="clickLookImg(lookIndex)"></p>
|
|
<!--下载按钮-->
|
|
<!--下载按钮-->
|
|
- <p class="position-download-p el-icon-download" @click="downloadImage" v-if="!imgNullType"></p>
|
|
|
|
|
|
+ <p class="position-download-p el-icon-download" @click="downloadImageUrl" v-if="!imgNullType"></p>
|
|
<!--关闭按钮-->
|
|
<!--关闭按钮-->
|
|
<p class="position-off-p el-icon-circle-close" @click="outButton"></p>
|
|
<p class="position-off-p el-icon-circle-close" @click="outButton"></p>
|
|
<div class="max-img-box" ref="viewBox">
|
|
<div class="max-img-box" ref="viewBox">
|
|
@@ -97,6 +97,8 @@
|
|
//预览图片组坐标
|
|
//预览图片组坐标
|
|
listClientX:null,
|
|
listClientX:null,
|
|
listClientY:null,
|
|
listClientY:null,
|
|
|
|
+ //文件服务地址
|
|
|
|
+ fileBrowseEnvironment:localStorage.getItem('fileBrowseEnvironment'),
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
@@ -346,6 +348,24 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/*************滚动条拖拽事件*************/
|
|
/*************滚动条拖拽事件*************/
|
|
|
|
+ downloadImageUrl(){
|
|
|
|
+ if(!this.lookImg){
|
|
|
|
+ this.msgError('加载失败,无法下载.')
|
|
|
|
+ }else{
|
|
|
|
+ let fileName = this.lookImg.split('/');
|
|
|
|
+ const x = new window.XMLHttpRequest();
|
|
|
|
+ x.open('GET', this.fileBrowseEnvironment+this.lookImg, true);
|
|
|
|
+ x.responseType = 'blob';
|
|
|
|
+ x.onload = () => {
|
|
|
|
+ const url = window.URL.createObjectURL(x.response);
|
|
|
|
+ const a = document.createElement('a');
|
|
|
|
+ a.href = url;
|
|
|
|
+ a.download = fileName[fileName.length-1];
|
|
|
|
+ a.click();
|
|
|
|
+ };
|
|
|
|
+ x.send();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async downloadImage() {
|
|
async downloadImage() {
|
|
let currentDate = this.getCurrentTime()
|
|
let currentDate = this.getCurrentTime()
|
|
// 获取图片对象和画布对象
|
|
// 获取图片对象和画布对象
|