|
@@ -21,6 +21,7 @@
|
|
|
<img v-if="checkFileType(item.url) == 'excel'" class="file" src="@/assets/common/excel.png">
|
|
|
<img v-if="checkFileType(item.url) == 'ppt'" class="file" src="@/assets/common/ppt.png">
|
|
|
<img v-if="checkFileType(item.url) == 'pdf'" class="file" src="@/assets/common/pdf.png">
|
|
|
+ <img v-if="checkFileType(item.url) == 'file'" class="file" src="@/assets/common/zip.jpeg">
|
|
|
</div>
|
|
|
</el-image>
|
|
|
<div v-show="item.hover" class="mask">
|
|
@@ -47,7 +48,7 @@ export default {
|
|
|
// 接受上传的文件类型
|
|
|
fileType: {
|
|
|
type: Array,
|
|
|
- default: () => ['image', 'word', 'excel', 'ppt', 'pdf']
|
|
|
+ default: () => ['image', 'word', 'excel', 'ppt', 'pdf', 'file']
|
|
|
},
|
|
|
|
|
|
// 是否支持多选文件
|
|
@@ -61,8 +62,8 @@ export default {
|
|
|
},
|
|
|
restrictFilename: {
|
|
|
type: Array,
|
|
|
- default:()=>{
|
|
|
- return []
|
|
|
+ default: () => {
|
|
|
+ return []
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -94,7 +95,7 @@ export default {
|
|
|
const excelList = ['.xls', '.xlsx', '.xlt', '.et', '.ett']
|
|
|
const pptList = ['.ppt', '.pptx', '.dps', '.dpt', '.pot', '.pps']
|
|
|
const pdfList = ['.pdf']
|
|
|
-
|
|
|
+ const fileList = ['.zip', '.rar', '.gz', '.apk']
|
|
|
let whiteList = []
|
|
|
this.fileType.includes('image') && (whiteList = whiteList.concat(imageList))
|
|
|
this.fileType.includes('video') && (whiteList = whiteList.concat(videoList))
|
|
@@ -102,6 +103,7 @@ export default {
|
|
|
this.fileType.includes('excel') && (whiteList = whiteList.concat(excelList))
|
|
|
this.fileType.includes('ppt') && (whiteList = whiteList.concat(pptList))
|
|
|
this.fileType.includes('pdf') && (whiteList = whiteList.concat(pdfList))
|
|
|
+ this.fileType.includes('file') && (whiteList = whiteList.concat(fileList))
|
|
|
return whiteList.join(',')
|
|
|
},
|
|
|
previewImages() {
|
|
@@ -149,8 +151,10 @@ export default {
|
|
|
return 'ppt'
|
|
|
} else if (['pdf'].includes(fileSuffix)) {
|
|
|
return 'pdf'
|
|
|
- } else {
|
|
|
- return ''
|
|
|
+ } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
|
|
|
+ return 'file'
|
|
|
+ } {
|
|
|
+ return 'pdf'
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -195,10 +199,11 @@ export default {
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
})
|
|
|
+ console.log(file)
|
|
|
this.$emit('handleIsFileName', file.name)
|
|
|
this.dataObj = await this.getOssConfig(file.name)
|
|
|
this.waitUploadList.push(this.dataObj)
|
|
|
- if (this.startRestricting) {
|
|
|
+ if (this.startRestricting && !['zip', 'rar', 'gz', 'apk'].includes(file.name.split('.')[1])) {
|
|
|
if (!this.restrictFilename.includes(file.name.split('.')[0])) {
|
|
|
this.$errorMsg('请根据固定文件名称上传:' + this.restrictFilename.join())
|
|
|
loading.close()
|
|
@@ -228,7 +233,7 @@ export default {
|
|
|
|
|
|
if (this.startRestricting) {
|
|
|
if (this.fileList.length) {
|
|
|
- for (let i = 0; i <this.fileList.length ; i++) {
|
|
|
+ for (let i = 0; i < this.fileList.length; i++) {
|
|
|
if (this.fileList[i].name.split('.')[0] === file.name.split('.')[0]) {
|
|
|
this.fileList[i].name = this.waitUploadList[index].name
|
|
|
this.fileList[i].url = this.waitUploadList[index].key
|