吕天方 1 year ago
commit 871c4466cc

@ -115,21 +115,21 @@
ref="file1"
class="file-content"
>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div>
<div
v-if="fileExtension === 'pdf'"
class="file-content"
style="height: 430px"
>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
<!-- <pdf
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
<pdf
v-for="i in numPages"
ref="pdf"
:key="i"
:src="pdfUrl"
:page="i"
></pdf> -->
></pdf>
</div>
</div>
<span slot="footer" class="dialog-footer">
@ -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) {

@ -214,13 +214,13 @@
ref="file1"
class="file-content"
>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div>
<div v-if="fileExtension === 'pdf'" class="file-content">
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
<!-- <div v-for="i in numPages" :key="i">
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
<div v-for="i in numPages" :key="i">
<pdf ref="pdf" :key="i" :src="pdfUrl" :page="i"></pdf>
</div> -->
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
@ -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)

@ -219,17 +219,17 @@
ref="file1"
class="file-content"
>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div>
<div v-if="fileExtension === 'pdf'" class="file-content">
<!-- <pdf
<pdf
v-for="i in numPages"
ref="pdf"
:key="i"
:src="pdfUrl"
:page="i"
></pdf> -->
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe>
></pdf>
<!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div>
</div>
<span slot="footer" class="dialog-footer">
@ -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); //
});
}
});
}
},

Loading…
Cancel
Save