JImageupload,JUpload组件修改成kkFileView预览

This commit is contained in:
yaoyanan
2021-04-09 09:29:45 +08:00
parent fd67747c58
commit 5dd867091e
2 changed files with 22 additions and 158 deletions
@@ -25,9 +25,6 @@
<div class="ant-upload-text">{{ text }}</div>
</div>
</div>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel()">
<img alt="example" style="width: 100%" :src="previewImage"/>
</a-modal>
</a-upload>
</div>
</template>
@@ -36,6 +33,7 @@
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getFileAccessHttpUrl } from '@/api/manage'
const Base64 = require('js-base64').Base64
const uidGenerator=()=>{
return '-'+parseInt(Math.random()*10000+1,10);
@@ -50,7 +48,6 @@
headers:{},
fileList: [],
previewImage:"",
previewVisible: false,
}
},
props:{
@@ -109,12 +106,13 @@
},
methods:{
initFileList(paths){
debugger
if(!paths || paths.length === 0){
this.fileList = [];
return;
}
this.picUrl = true;
let arr = paths.join(",")
let arr = paths.split(",")
for(var a=0;a<arr.length;a++){
this.fileList.forEach((item)=>{
if (item.url === arr[a]){
@@ -161,9 +159,12 @@
}
},
// 预览
handlePreview (file) {
this.previewImage = file.url || file.thumbUrl
this.previewVisible = true
handlePreview(file) {
if (file && file.url) {
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
}
},
getAvatarView(){
if(this.fileList.length>0){