|
@@ -36,7 +36,8 @@ export default {
|
|
|
return {
|
|
|
oss_url: '',
|
|
|
dataObj: {},
|
|
|
- aliosstoken: ''
|
|
|
+ aliosstoken: '',
|
|
|
+ flag: false
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -72,12 +73,17 @@ export default {
|
|
|
const fileSuffix = name.substring(name.lastIndexOf('.') + 1)
|
|
|
return `${date}${uuid}.${fileSuffix}`
|
|
|
},
|
|
|
+
|
|
|
handleRemove(file, fileList) {
|
|
|
+ if (!this.flag) {
|
|
|
+ fileList.pop()
|
|
|
+ this.fileList.pop()
|
|
|
+ }
|
|
|
+ this.flag = false
|
|
|
+
|
|
|
// this.fileList = [{ name: '', url: '' }];
|
|
|
- this.fileList.pop()
|
|
|
},
|
|
|
beforeUpload(file) {
|
|
|
- console.log(file)
|
|
|
const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1)
|
|
|
const imgList = ['jpg', 'jpeg', 'png']
|
|
|
const videoList = ['mp4']
|
|
@@ -105,19 +111,23 @@ export default {
|
|
|
if (this.fileType.includes('pdf')) {
|
|
|
whiteList = whiteList.concat(pdfList)
|
|
|
}
|
|
|
-
|
|
|
+ console.log(whiteList.indexOf(fileSuffix))
|
|
|
if (whiteList.indexOf(fileSuffix) === -1) {
|
|
|
- return this.$errorMsg('只支持上传' + this.fileType.join(',') + '文件!')
|
|
|
- }
|
|
|
- const fileName = this.createName(file.name)
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: 'Loading',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- })
|
|
|
+ this.$errorMsg('只支持上传' + this.fileType.join(',') + '文件!')
|
|
|
+ this.flag = true
|
|
|
+
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ const fileName = this.createName(file.name)
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ })
|
|
|
|
|
|
- this.dataObj.key = this.dataObj.dir + fileName
|
|
|
+ this.dataObj.key = this.dataObj.dir + fileName
|
|
|
+ }
|
|
|
},
|
|
|
handleUploadSuccess(res, file, fileList) {
|
|
|
const loading = this.$loading({
|
|
@@ -129,6 +139,7 @@ export default {
|
|
|
if (!this.multiple) {
|
|
|
this.fileList.pop()
|
|
|
}
|
|
|
+ console.log(4747)
|
|
|
this.fileList.push({
|
|
|
name: file.name,
|
|
|
status: 'success',
|