|
@@ -47,9 +47,9 @@
|
|
|
]"
|
|
|
>
|
|
|
<singe-file-upload
|
|
|
- tips="仅支持上传 doc/docx 格式文件"
|
|
|
+ tips="仅支持上传 docx 格式文件"
|
|
|
buttonText="点击上传协议"
|
|
|
- accept=".doc, .docx"
|
|
|
+ accept=".docx"
|
|
|
@inputFile="readFileInputEventAsArrayBuffer"
|
|
|
v-model="form.origanalFileUrl"
|
|
|
/>
|
|
@@ -125,15 +125,19 @@ export default {
|
|
|
this.fileContent = newHTML
|
|
|
},
|
|
|
readFileInputEventAsArrayBuffer(file) {
|
|
|
+ console.log(file)
|
|
|
let reader = new FileReader();
|
|
|
let that = this
|
|
|
reader.onload = function(loadEvent) {
|
|
|
let arrayBuffer = loadEvent.target.result; //arrayBuffer
|
|
|
- mammoth
|
|
|
+ mammoth
|
|
|
.convertToHtml({ arrayBuffer: arrayBuffer })
|
|
|
.then(function(result) {
|
|
|
console.log(result)
|
|
|
that.displayResult(result)
|
|
|
+ }).catch(function(e) {
|
|
|
+ that.form.origanalFileUrl = null
|
|
|
+ that.$message.error('上传文件有误,请重新上传')
|
|
|
})
|
|
|
.done();
|
|
|
};
|