|
@@ -244,16 +244,16 @@
|
|
}
|
|
}
|
|
return isLt2M
|
|
return isLt2M
|
|
},
|
|
},
|
|
- httpRequest (file) {//阿里云OSS上传
|
|
|
|
- //判断扩展名
|
|
|
|
- const tmpcnt = file.file.name.lastIndexOf(".") // 获取.的下标
|
|
|
|
|
|
+ httpRequest (file) { // 阿里云OSS上传
|
|
|
|
+ // 判断扩展名
|
|
|
|
+ const tmpcnt = file.file.name.lastIndexOf('.') // 获取.的下标
|
|
const uploadFileName = file.file.name.substring(0, tmpcnt) // 获取文件名
|
|
const uploadFileName = file.file.name.substring(0, tmpcnt) // 获取文件名
|
|
console.log(uploadFileName, '文件名——uploadFileName')
|
|
console.log(uploadFileName, '文件名——uploadFileName')
|
|
const exname = file.file.name.substring(tmpcnt + 1) // 获取后缀名
|
|
const exname = file.file.name.substring(tmpcnt + 1) // 获取后缀名
|
|
- console.log(exname, '后缀名');
|
|
|
|
|
|
+ console.log(exname, '后缀名')
|
|
const names = ['jpg', 'jpeg', 'webp', 'png', 'bmp', 'exe', 'yml', 'txt']
|
|
const names = ['jpg', 'jpeg', 'webp', 'png', 'bmp', 'exe', 'yml', 'txt']
|
|
if (names.indexOf(exname) < 0) {
|
|
if (names.indexOf(exname) < 0) {
|
|
- this.$message.error("不支持的格式!")
|
|
|
|
|
|
+ this.$message.error('不支持的格式!')
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
const fileName = uploadFileName
|
|
const fileName = uploadFileName
|
|
@@ -263,7 +263,7 @@
|
|
file.file,
|
|
file.file,
|
|
{
|
|
{
|
|
headers
|
|
headers
|
|
- },
|
|
|
|
|
|
+ }
|
|
).then(res => {
|
|
).then(res => {
|
|
console.log(res, 'res---header ')
|
|
console.log(res, 'res---header ')
|
|
// this.handleUploadSuccess()
|
|
// this.handleUploadSuccess()
|