|
@@ -144,7 +144,6 @@
|
|
|
<uploader-drop>
|
|
|
<i class="el-icon-upload"></i>
|
|
|
<div class="el-upload__text">将文件拖到此处,或 <uploader-btn :attrs="attrs">点击上传</uploader-btn></div>
|
|
|
-
|
|
|
</uploader-drop>
|
|
|
<!-- <uploader-list></uploader-list> -->
|
|
|
<uploader-files> </uploader-files>
|
|
@@ -588,6 +587,7 @@ export default {
|
|
|
this.richTextForm.cateId = event.id;
|
|
|
},
|
|
|
beforeAvatarUpload(file) {
|
|
|
+ console.log('file',file);
|
|
|
let type = false;
|
|
|
if (
|
|
|
//图片
|
|
@@ -601,7 +601,7 @@ export default {
|
|
|
) {
|
|
|
type = true;
|
|
|
}else{
|
|
|
- this.$message.error('只能上传png/jpeg/gif格式图片');
|
|
|
+ this.$message.error('只能上传png/jpeg/gif/mp4/doc/docx/pdf格式文件');
|
|
|
type = false;
|
|
|
}
|
|
|
return type;
|
|
@@ -992,10 +992,31 @@ export default {
|
|
|
// 上传完毕。
|
|
|
},
|
|
|
filesAdded(file, fileList, event) {
|
|
|
- file.forEach((e) => {
|
|
|
- this.fileList.push(e);
|
|
|
- this.computeMD5(e);
|
|
|
- });
|
|
|
+ console.log('file',file)
|
|
|
+ file.forEach((item)=>{
|
|
|
+ if(["image/png","image/jpeg","image/gif",
|
|
|
+ "application/pdf",
|
|
|
+ "video/mp4",
|
|
|
+ "application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].indexOf(item.fileType) === -1){
|
|
|
+ this.$message.error("文件格式不支持,请上传正确的文件.");
|
|
|
+ file.ignored = true;
|
|
|
+ }else{
|
|
|
+ this.fileList.push(item);
|
|
|
+ this.computeMD5(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // if (["image/png","image/jpeg","image/gif",
|
|
|
+ // "application/pdf",
|
|
|
+ // "video/mp4",
|
|
|
+ // "application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].indexOf(file[0].fileType) === -1){
|
|
|
+ // this.$message.error("请上传正确的格式");
|
|
|
+ // file.ignored = true;
|
|
|
+ // }else{
|
|
|
+ // file.forEach((e) => {
|
|
|
+ // this.fileList.push(e);
|
|
|
+ // this.computeMD5(e);
|
|
|
+ // });
|
|
|
+ // }
|
|
|
},
|
|
|
computeMD5(file) {
|
|
|
let fileReader = new FileReader();
|