更新后退bug问题

This commit is contained in:
2021-09-18 16:51:37 +08:00
parent 61e6a198f1
commit 3f1c64f9d4
12 changed files with 196 additions and 41 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 B

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

View File

@@ -299,7 +299,7 @@ export default {
totalCount: 0 totalCount: 0
} }
}, },
ticket: "8a1189377bdad67c017bf66039d76376-ticket" ticket: "8a11885a7bda783f017bf73e5e095219-ticket"
}; };
}, },
async created() { async created() {
@@ -362,7 +362,7 @@ export default {
pageJump(id) { pageJump(id) {
this.$router.push({ this.$router.push({
name: "policyInfo", name: "policyInfo",
params: { ticket: this.ticket, id: id }, params: { ticket: this.ticket, id: id }
}); });
}, },
setZwUserAplus(Userid, userName) { setZwUserAplus(Userid, userName) {
@@ -388,12 +388,12 @@ export default {
ZWJSBridge.onReady(() => { ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法"); console.log("初始化完成后执行bridge方法");
ZWJSBridge.getUserType() ZWJSBridge.getUserType()
.then((result1) => { .then(result1 => {
console.log("getUserType():" + JSON.stringify(result1)); console.log("getUserType():" + JSON.stringify(result1));
console.log("result1.userType:" + result1.userType); console.log("result1.userType:" + result1.userType);
//经纬度 //经纬度
ZWJSBridge.getLocation() ZWJSBridge.getLocation()
.then((result2) => { .then(result2 => {
console.log("getLocation():" + JSON.stringify(result2)); console.log("getLocation():" + JSON.stringify(result2));
console.log("result2.longitude:" + result2.longitude); console.log("result2.longitude:" + result2.longitude);
console.log("result2.latitude:" + result2.latitude); console.log("result2.latitude:" + result2.latitude);

View File

@@ -0,0 +1,137 @@
<template>
<div>
<div ref="content" class="content">
<!-- <pdf :src="url" class="PDF"></pdf> -->
</div>
<div class="bottom">
<a href="" download="">
<el-button type="primary">保存到相册</el-button>
</a>
</div>
<iframe
src="https://zsxt.nbzs.org.cn/Files/UploadFiles/e85a13ef-431c-46a5-85cd-9dd1b4f50fc6/80616f98-da17-49bc-92d0-b87199963787.pdf"
frameborder="0"
></iframe>
<!-- <el-button type="primary" @click="this.savePdf()">测试2</el-button>
<el-button type="primary" @click="this.handlePrint()">测试3</el-button>
<el-button type="primary" @click="testdownload4()">测试4</el-button>
<div id="nav">222</div> -->
</div>
</template>
<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.js"></script>
<script>
import pdf from "vue-pdf";
import $ from "jquery";
import html2canvas from "html2canvas";
// import axios from "axios";
import request from "@/common/util";
import { mgop } from "@aligov/jssdk-mgop";
export default {
components: {
pdf
},
data() {
return {
url: ""
};
},
created() {
this.onInit();
},
mounted() {
// 截图
// html2canvas(this.$refs.PDF).then(canvas => {
// canvas.id = "mycanvas";
// const base64 = canvas.toDataURL("image/png");
// jquery("a").prop("href", base64);
// });
},
methods: {
onInit() {
this.onLoadData();
request({
url: "http://10.19.94.9:7099/api/agreement/info",
method: "post",
data: {
ticket: window.sessionStorage.getItem("ticket"),
id: "C655515B-FD91-48F2-BD79-EAABAFB7077C"
},
headers: { "Content-Type": "application/json; charset=UTF-8" },
responseType: "arraybuffer" //一定要设置响应类型否则页面会是空白pdf
}).then(result => {
console.log("请求成功了", result);
const binaryData = [];
binaryData.push(result.data);
//获取blob链接
this.url = window.URL.createObjectURL(
new Blob(binaryData, { type: "application/pdf" })
);
$("a").prop("href", this.url);
// if (pdfUrl) {
// this.handlePrint(pdfUrl);
// }
});
},
handlePrint() {
if (document.getElementById("print-iframe")) {
document.body.removeChild(document.getElementById("print-iframe"));
}
//判断iframe是否存在不存在则创建iframe
let iframe = document.getElementById("print-iframe");
if (!iframe) {
iframe = document.createElement("IFRAME");
let doc = null;
iframe.setAttribute("src", this.url);
iframe.setAttribute("id", "print-iframe");
document.body.appendChild(iframe);
doc = iframe.contentWindow.document;
doc.close();
iframe.contentWindow.focus();
}
iframe.contentWindow.print();
},
savePdf() {
ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法-savePdf");
ZWJSBridge.saveImage({
url: this.url
})
.then(result => {
console.log("saveImage()成功:" + JSON.stringify(result));
})
.catch(error => {
console.log("saveImage()失败:" + JSON.stringify(result));
console.log(error);
});
});
},
testdownload4() {
ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法-testdownload4");
ZWJSBridge.openLink({
url: this.url
})
.then(result => {
console.log("testdownload4():" + result);
})
.catch(error => {
console.log(error);
});
});
}
}
};
</script>
<style lang="less" scoped>
.content {
text-align: center;
line-height: 200px;
font-size: 30px;
margin-bottom: 20px;
}
.bottom {
text-align: center;
margin-bottom: 20px;
}
</style>

View File

@@ -8,9 +8,10 @@
<el-button type="primary">保存到相册</el-button> <el-button type="primary">保存到相册</el-button>
</a> </a>
</div> </div>
<el-button type="primary" @click="this.savePdf()">测试2</el-button> <iframe :src="url" frameborder="0"></iframe>
<!-- <el-button type="primary" @click="this.savePdf()">测试2</el-button>
<el-button type="primary" @click="this.handlePrint()">测试3</el-button> <el-button type="primary" @click="this.handlePrint()">测试3</el-button>
<el-button type="primary" @click="testdownload4()">测试4</el-button> <el-button type="primary" @click="testdownload4()">测试4</el-button> -->
</div> </div>
</template> </template>
@@ -24,44 +25,47 @@ import request from "@/common/util";
import { mgop } from "@aligov/jssdk-mgop"; import { mgop } from "@aligov/jssdk-mgop";
export default { export default {
components: { components: {
pdf, pdf
}, },
data() { data() {
return { return {
url: "", url:
"https://zsxt.nbzs.org.cn/Files/UploadFiles/e85a13ef-431c-46a5-85cd-9dd1b4f50fc6/80616f98-da17-49bc-92d0-b87199963787.pdf"
}; };
}, },
created() { created() {
this.onInit(); this.onInit();
console.log("pdf");
}, },
mounted() { mounted() {
// 截图 // 截图
html2canvas(this.$refs.PDF).then((canvas) => { // html2canvas(this.$refs.PDF).then(canvas => {
canvas.id = "mycanvas"; // canvas.id = "mycanvas";
const base64 = canvas.toDataURL("image/png"); // const base64 = canvas.toDataURL("image/png");
jquery("a").prop("href", base64); // jquery("a").prop("href", base64);
}); // });
}, },
methods: { methods: {
onInit() { onInit() {
this.onLoadData(); // this.onLoadData();
request({ request({
url: "http://10.19.94.9:7099/api/agreement/info", url: "http://10.19.94.9:7099/api/agreement/info",
method: "post", method: "post",
data: { data: {
ticket: window.sessionStorage.getItem("ticket"), ticket: window.sessionStorage.getItem("ticket"),
id: "C655515B-FD91-48F2-BD79-EAABAFB7077C", id: "C655515B-FD91-48F2-BD79-EAABAFB7077C"
}, },
headers: { "Content-Type": "application/json; charset=UTF-8" }, headers: { "Content-Type": "application/json; charset=UTF-8" },
responseType: "arraybuffer", //一定要设置响应类型否则页面会是空白pdf responseType: "blob" //一定要设置响应类型否则页面会是空白pdf
}).then((result) => { }).then(result => {
console.log("结果", result);
const binaryData = []; const binaryData = [];
binaryData.push(result.data); binaryData.push(result.data);
//获取blob链接 //获取blob链接
this.url = window.URL.createObjectURL( const gan = window.URL.createObjectURL(
new Blob(binaryData, { type: "application/pdf" }) new Blob(binaryData, { type: "application/pdf" })
); );
this.url = this.getObjectURL(result.data);
console.log("aaa", this.url);
$("a").prop("href", this.url); $("a").prop("href", this.url);
// if (pdfUrl) { // if (pdfUrl) {
// this.handlePrint(pdfUrl); // this.handlePrint(pdfUrl);
@@ -73,31 +77,34 @@ export default {
dataType: "JSON", dataType: "JSON",
type: "POST", type: "POST",
data: { data: {
ticket: "8a1189377bdad67c017bf66039d76376-ticket", ticket: window.sessionStorage.getItem("ticket"),
id: "C655515B-FD91-48F2-BD79-EAABAFB7077C", id: "C655515B-FD91-48F2-BD79-EAABAFB7077C"
}, },
appKey: "es4b8zmz+2001833218+dehllx", appKey: "es4b8zmz+2001833218+dehllx",
onSuccess: (result) => { onSuccess: result => {
console.log("pdf.vue页面请求pdf文件:", result); console.log("pdf.vue页面请求pdf文件:", result);
if (result.data && result.data.success == true) { if (result.data && result.data.success == true) {
console.log("result.data.data:", result.data.data); console.log("result.data.data:", result.data.data);
this.url = result.data.data; // this.url = result.data.data;
// const binaryData = []; const binaryData = [];
// binaryData.push(result.data); binaryData.push(result.data.data);
// //获取blob链接 //获取blob链接
// this.url = window.URL.createObjectURL( const gan = window.URL.createObjectURL(
// new Blob(binaryData, { type: "application/pdf" }) new Blob(binaryData, { type: "application/pdf" })
// ); );
this.url = this.getObjectURL(gan);
console.log("aaa", this.url);
// if (pdfUrl) { // if (pdfUrl) {
// this.handlePrint(pdfUrl); // this.handlePrint(pdfUrl);
// } // }
} }
}, },
onFail: (err) => { onFail: err => {
console.log("用户无数据,不展示"); console.log("用户无数据,不展示");
}, }
}); });
}, },
handlePrint() { handlePrint() {
if (document.getElementById("print-iframe")) { if (document.getElementById("print-iframe")) {
document.body.removeChild(document.getElementById("print-iframe")); document.body.removeChild(document.getElementById("print-iframe"));
@@ -124,12 +131,12 @@ export default {
ZWJSBridge.onReady(() => { ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法-savePdf"); console.log("初始化完成后执行bridge方法-savePdf");
ZWJSBridge.saveImage({ ZWJSBridge.saveImage({
url: this.url, url: this.url
}) })
.then((result) => { .then(result => {
console.log("saveImage()成功:" + JSON.stringify(result)); console.log("saveImage()成功:" + JSON.stringify(result));
}) })
.catch((error) => { .catch(error => {
console.log("saveImage()失败:" + JSON.stringify(result)); console.log("saveImage()失败:" + JSON.stringify(result));
console.log(error); console.log(error);
}); });
@@ -139,17 +146,17 @@ export default {
ZWJSBridge.onReady(() => { ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法-testdownload4"); console.log("初始化完成后执行bridge方法-testdownload4");
ZWJSBridge.openLink({ ZWJSBridge.openLink({
url: this.url, url: this.url
}) })
.then((result) => { .then(result => {
console.log("testdownload4():" + result); console.log("testdownload4():" + result);
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error);
}); });
}); });
}, }
}, }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@@ -158,6 +165,7 @@ export default {
line-height: 200px; line-height: 200px;
font-size: 30px; font-size: 30px;
margin-bottom: 20px; margin-bottom: 20px;
height: 200px;
} }
.bottom { .bottom {
text-align: center; text-align: center;

View File

@@ -93,6 +93,9 @@ export default {
// 获取数据 // 获取数据
onInit() { onInit() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (this.$route.params.type) {
window.sessionStorage.setItem("type", this.$route.params.type);
}
this.ticket = this.$route.params.ticket; this.ticket = this.$route.params.ticket;
mgop({ mgop({
api: "mgop.kykj.houseexpropriat.getprjlist", api: "mgop.kykj.houseexpropriat.getprjlist",
@@ -115,7 +118,8 @@ export default {
}, },
// 页面跳转 // 页面跳转
gotoDetail(id) { gotoDetail(id) {
if (this.type == "pg") { console.log("跳转了");
if (window.sessionStorage.getItem("type") == "pg") {
// 评估结果页面 // 评估结果页面
this.$router.push({ this.$router.push({
name: "evaluteResult", name: "evaluteResult",
@@ -124,7 +128,7 @@ export default {
ticket: this.$route.params.ticket ticket: this.$route.params.ticket
} }
}); });
} else if (this.type == "xy") { } else if (window.sessionStorage.getItem("type") == "xy") {
// 协议结果页面 // 协议结果页面
this.$router.push({ this.$router.push({
name: "reportAgreement", name: "reportAgreement",

View File

@@ -147,19 +147,25 @@ export default {
margin: 14px 0; margin: 14px 0;
display: flex; display: flex;
align-items: center; align-items: center;
height: 20px;
b { b {
font-size: 14px; font-size: 14px;
} }
img { img {
margin-right: 6px; margin-right: 6px;
height: 100%;
} }
} }
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
> div {
height: 100%;
}
img { img {
margin-right: 10px; margin-right: 10px;
height: 100%;
} }
} }
.line { .line {