diff --git a/src/views/privateOrder/security/components/ReportingStatistics.vue b/src/views/privateOrder/security/components/ReportingStatistics.vue index 1eaf524..312179a 100644 --- a/src/views/privateOrder/security/components/ReportingStatistics.vue +++ b/src/views/privateOrder/security/components/ReportingStatistics.vue @@ -115,21 +115,21 @@ ref="file1" class="file-content" > - +
- - + --> + >
@@ -305,30 +305,30 @@ export default { let str = row.fileUrl.split(","); let str1 = str[0].split("."); this.fileExtension = str1[str1.length - 1]; - // let newarr = str[0].split("/"); - // let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); + let newarr = str[0].split("/"); + let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); if (this.fileExtension == "pdf") { - // this.getNumPages("/demo" + "/" + lastArr.join("/")); - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + this.getNumPages("/demo" + "/" + lastArr.join("/")); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; this.dialogStatus2 = true; } else if ( this.fileExtension === "docx" || this.fileExtension === "doc" ) { - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; - this.dialogStatus2 = true; - // axios({ - // method: "get", - // responseType: "blob", // 设置响应文件格式 - // url: "/demo" + "/" + lastArr.join("/"), - // }).then(({ data }) => { - // if (data) { - // this.dialogStatus2 = true; - // this.$nextTick(() => { - // docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 - // }); - // } - // }); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + // this.dialogStatus2 = true; + axios({ + method: "get", + responseType: "blob", // 设置响应文件格式 + url: "/demo" + "/" + lastArr.join("/"), + }).then(({ data }) => { + if (data) { + this.dialogStatus2 = true; + this.$nextTick(() => { + docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 + }); + } + }); } }, getNumPages(url) { diff --git a/src/views/privateOrder/security/components/componentRight.vue b/src/views/privateOrder/security/components/componentRight.vue index d80b582..8b94ad0 100644 --- a/src/views/privateOrder/security/components/componentRight.vue +++ b/src/views/privateOrder/security/components/componentRight.vue @@ -214,13 +214,13 @@ ref="file1" class="file-content" > - +
- - +
-
--> +
@@ -555,35 +555,35 @@ export default { let str1 = str[0].split("."); this.fileExtension = str1[str1.length - 1]; console.log(this.fileExtension); - // let newarr = str[0].split("/"); - // let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); + let newarr = str[0].split("/"); + let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); if (this.fileExtension == "pdf") { // this.pdfUrl = process.env.VUE_APP_BASE_API2 + e.target.dataset.url; - // this.getNumPages("/demo" + "/" + lastArr.join("/")); - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + this.getNumPages("/demo" + "/" + lastArr.join("/")); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; this.dialogDetails = true; } else if ( this.fileExtension === "docx" || this.fileExtension === "doc" ) { - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; - this.dialogDetails = true; - // axios({ - // method: "get", - // responseType: "blob", // 设置响应文件格式 - // url: "/demo" + "/" + lastArr.join("/"), - // }) - // .then(({ data }) => { - // if (data) { - // this.dialogDetails = true; - // this.$nextTick(() => { - // docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 - // }); - // } - // }) - // .catch((error) => { - // this.$message.error(error); - // }); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + // this.dialogDetails = true; + axios({ + method: "get", + responseType: "blob", // 设置响应文件格式 + url: "/demo" + "/" + lastArr.join("/"), + }) + .then(({ data }) => { + if (data) { + this.dialogDetails = true; + this.$nextTick(() => { + docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 + }); + } + }) + .catch((error) => { + this.$message.error(error); + }); } // const row = JSON.parse(e.target.dataset.obj) diff --git a/src/views/privateOrder/sentiment/components/componentRight.vue b/src/views/privateOrder/sentiment/components/componentRight.vue index 4338dc3..4dd1c09 100644 --- a/src/views/privateOrder/sentiment/components/componentRight.vue +++ b/src/views/privateOrder/sentiment/components/componentRight.vue @@ -219,17 +219,17 @@ ref="file1" class="file-content" > - +
- - + > +
@@ -536,30 +536,30 @@ export default { let str = row.fileUrl.split(","); let str1 = str[0].split("."); this.fileExtension = str1[str1.length - 1]; - // let newarr = str[0].split("/"); - // let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); + let newarr = str[0].split("/"); + let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); if (this.fileExtension == "pdf") { - // this.getNumPages("/demo" + "/" + lastArr.join("/")); - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + this.getNumPages("/demo" + "/" + lastArr.join("/")); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; this.dialogDetails = true; } else if ( this.fileExtension === "docx" || this.fileExtension === "doc" ) { - this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; - this.dialogDetails = true; - // axios({ - // method: "get", - // responseType: "blob", // 设置响应文件格式 - // url: "/demo" + "/" + lastArr.join("/"), - // }).then(({ data }) => { - // if (data) { - // this.dialogDetails = true; - // this.$nextTick(() => { - // docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 - // }); - // } - // }); + // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; + // this.dialogDetails = true; + axios({ + method: "get", + responseType: "blob", // 设置响应文件格式 + url: "/demo" + "/" + lastArr.join("/"), + }).then(({ data }) => { + if (data) { + this.dialogDetails = true; + this.$nextTick(() => { + docx.renderAsync(data, this.$refs.file1); // 渲染到页面预览 + }); + } + }); } },