吕天方 1 year ago
commit 871c4466cc

@ -115,21 +115,21 @@
ref="file1" ref="file1"
class="file-content" class="file-content"
> >
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div> </div>
<div <div
v-if="fileExtension === 'pdf'" v-if="fileExtension === 'pdf'"
class="file-content" class="file-content"
style="height: 430px" style="height: 430px"
> >
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
<!-- <pdf <pdf
v-for="i in numPages" v-for="i in numPages"
ref="pdf" ref="pdf"
:key="i" :key="i"
:src="pdfUrl" :src="pdfUrl"
:page="i" :page="i"
></pdf> --> ></pdf>
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -305,30 +305,30 @@ export default {
let str = row.fileUrl.split(","); let str = row.fileUrl.split(",");
let str1 = str[0].split("."); let str1 = str[0].split(".");
this.fileExtension = str1[str1.length - 1]; this.fileExtension = str1[str1.length - 1];
// let newarr = str[0].split("/"); let newarr = str[0].split("/");
// let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length);
if (this.fileExtension == "pdf") { if (this.fileExtension == "pdf") {
// this.getNumPages("/demo" + "/" + lastArr.join("/")); this.getNumPages("/demo" + "/" + lastArr.join("/"));
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogStatus2 = true; this.dialogStatus2 = true;
} else if ( } else if (
this.fileExtension === "docx" || this.fileExtension === "docx" ||
this.fileExtension === "doc" this.fileExtension === "doc"
) { ) {
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogStatus2 = true; // this.dialogStatus2 = true;
// axios({ axios({
// method: "get", method: "get",
// responseType: "blob", // responseType: "blob", //
// url: "/demo" + "/" + lastArr.join("/"), url: "/demo" + "/" + lastArr.join("/"),
// }).then(({ data }) => { }).then(({ data }) => {
// if (data) { if (data) {
// this.dialogStatus2 = true; this.dialogStatus2 = true;
// this.$nextTick(() => { this.$nextTick(() => {
// docx.renderAsync(data, this.$refs.file1); // docx.renderAsync(data, this.$refs.file1); //
// }); });
// } }
// }); });
} }
}, },
getNumPages(url) { getNumPages(url) {

@ -214,13 +214,13 @@
ref="file1" ref="file1"
class="file-content" class="file-content"
> >
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div> </div>
<div v-if="fileExtension === 'pdf'" class="file-content"> <div v-if="fileExtension === 'pdf'" class="file-content">
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
<!-- <div v-for="i in numPages" :key="i"> <div v-for="i in numPages" :key="i">
<pdf ref="pdf" :key="i" :src="pdfUrl" :page="i"></pdf> <pdf ref="pdf" :key="i" :src="pdfUrl" :page="i"></pdf>
</div> --> </div>
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -555,35 +555,35 @@ export default {
let str1 = str[0].split("."); let str1 = str[0].split(".");
this.fileExtension = str1[str1.length - 1]; this.fileExtension = str1[str1.length - 1];
console.log(this.fileExtension); console.log(this.fileExtension);
// let newarr = str[0].split("/"); let newarr = str[0].split("/");
// let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length);
if (this.fileExtension == "pdf") { if (this.fileExtension == "pdf") {
// this.pdfUrl = process.env.VUE_APP_BASE_API2 + e.target.dataset.url; // this.pdfUrl = process.env.VUE_APP_BASE_API2 + e.target.dataset.url;
// this.getNumPages("/demo" + "/" + lastArr.join("/")); this.getNumPages("/demo" + "/" + lastArr.join("/"));
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogDetails = true; this.dialogDetails = true;
} else if ( } else if (
this.fileExtension === "docx" || this.fileExtension === "docx" ||
this.fileExtension === "doc" this.fileExtension === "doc"
) { ) {
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogDetails = true; // this.dialogDetails = true;
// axios({ axios({
// method: "get", method: "get",
// responseType: "blob", // responseType: "blob", //
// url: "/demo" + "/" + lastArr.join("/"), url: "/demo" + "/" + lastArr.join("/"),
// }) })
// .then(({ data }) => { .then(({ data }) => {
// if (data) { if (data) {
// this.dialogDetails = true; this.dialogDetails = true;
// this.$nextTick(() => { this.$nextTick(() => {
// docx.renderAsync(data, this.$refs.file1); // docx.renderAsync(data, this.$refs.file1); //
// }); });
// } }
// }) })
// .catch((error) => { .catch((error) => {
// this.$message.error(error); this.$message.error(error);
// }); });
} }
// const row = JSON.parse(e.target.dataset.obj) // const row = JSON.parse(e.target.dataset.obj)

@ -219,17 +219,17 @@
ref="file1" ref="file1"
class="file-content" class="file-content"
> >
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div> </div>
<div v-if="fileExtension === 'pdf'" class="file-content"> <div v-if="fileExtension === 'pdf'" class="file-content">
<!-- <pdf <pdf
v-for="i in numPages" v-for="i in numPages"
ref="pdf" ref="pdf"
:key="i" :key="i"
:src="pdfUrl" :src="pdfUrl"
:page="i" :page="i"
></pdf> --> ></pdf>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -536,30 +536,30 @@ export default {
let str = row.fileUrl.split(","); let str = row.fileUrl.split(",");
let str1 = str[0].split("."); let str1 = str[0].split(".");
this.fileExtension = str1[str1.length - 1]; this.fileExtension = str1[str1.length - 1];
// let newarr = str[0].split("/"); let newarr = str[0].split("/");
// let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length); let lastArr = newarr.slice(newarr.indexOf("demo") + 1, newarr.length);
if (this.fileExtension == "pdf") { if (this.fileExtension == "pdf") {
// this.getNumPages("/demo" + "/" + lastArr.join("/")); this.getNumPages("/demo" + "/" + lastArr.join("/"));
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogDetails = true; this.dialogDetails = true;
} else if ( } else if (
this.fileExtension === "docx" || this.fileExtension === "docx" ||
this.fileExtension === "doc" this.fileExtension === "doc"
) { ) {
this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0]; // this.pdfUrl = "https://api.idocv.com/view/url?url=" + str[0];
this.dialogDetails = true; // this.dialogDetails = true;
// axios({ axios({
// method: "get", method: "get",
// responseType: "blob", // responseType: "blob", //
// url: "/demo" + "/" + lastArr.join("/"), url: "/demo" + "/" + lastArr.join("/"),
// }).then(({ data }) => { }).then(({ data }) => {
// if (data) { if (data) {
// this.dialogDetails = true; this.dialogDetails = true;
// this.$nextTick(() => { this.$nextTick(() => {
// docx.renderAsync(data, this.$refs.file1); // docx.renderAsync(data, this.$refs.file1); //
// }); });
// } }
// }); });
} }
}, },

Loading…
Cancel
Save