提交:
-- 固件版本管理 功能 文件上传 文件类型判定 application/octet-stream (.bin)文件
This commit is contained in:
parent
06e26dabb5
commit
e4b1b2553f
|
@ -247,6 +247,7 @@
|
|||
<el-upload
|
||||
ref="upload"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:http-request="uploud"
|
||||
action
|
||||
drag
|
||||
|
@ -443,6 +444,14 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
beforeAvatarUpload(file) {
|
||||
console.log('oat-upload-file--', file, file.type === 'application/octet-stream');
|
||||
const isBin = file.type === 'application/octet-stream';
|
||||
if (!isBin) {
|
||||
this.$message.error('上传文件类型错误,只能上传.bin文件!');
|
||||
}
|
||||
return isBin;
|
||||
},
|
||||
copyOnClick(val) {
|
||||
let self = this;
|
||||
this.$copyText(val).then(
|
||||
|
@ -490,18 +499,6 @@ export default {
|
|||
console.log(e);
|
||||
});
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
const isJPG = this.fileType.indexOf(file.type) >= 0;
|
||||
const isLt2M = file.size < this.fileSize;
|
||||
|
||||
if (!isJPG) {
|
||||
this.$message.error("上传头像图片只能是 JPG 格式!");
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.error("上传头像图片大小不能超过 2MB!");
|
||||
}
|
||||
return isLt2M;
|
||||
},
|
||||
// 打开厂商选择窗口 ——表格
|
||||
openModelTableSelectDialog() {
|
||||
this.selectResult = {};
|
||||
|
|
Loading…
Reference in New Issue