This commit is contained in:
2021-09-18 11:15:16 +08:00
22 changed files with 136 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -362,7 +362,7 @@ export default {
pageJump(id) {
this.$router.push({
name: "policyInfo",
params: { ticket: this.ticket, id: id }
params: { ticket: this.ticket, id: id },
});
},
setZwUserAplus(Userid, userName) {
@@ -388,13 +388,15 @@ export default {
ZWJSBridge.onReady(() => {
console.log("初始化完成后执行bridge方法");
ZWJSBridge.getUserType()
.then(result1 => {
console.log(result1);
.then((result1) => {
console.log("getUserType():" + JSON.stringify(result1));
console.log("result1.userType:" + result1.userType);
//经纬度
ZWJSBridge.getLocation()
.then(result2 => {
console.log(result2);
debugger;
.then((result2) => {
console.log("getLocation():" + JSON.stringify(result2));
console.log("result2.longitude:" + result2.longitude);
console.log("result2.latitude:" + result2.latitude);
aplus_queue.push({
action: "aplus.sendPV",
arguments: [

View File

@@ -8,6 +8,9 @@
<el-button type="primary">保存到相册</el-button>
</a>
</div>
<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>
</template>
@@ -16,19 +19,29 @@
import pdf from "vue-pdf";
import $ from "jquery";
import html2canvas from "html2canvas";
import axios from "axios";
// import axios from "axios";
import request from "@/common/util";
import { mgop } from "@aligov/jssdk-mgop";
export default {
components: {
pdf
pdf,
},
data() {
return {
url: ""
url: "",
};
},
created() {
this.onInit();
console.log("pdf");
},
mounted() {
// 截图
html2canvas(this.$refs.PDF).then((canvas) => {
canvas.id = "mycanvas";
const base64 = canvas.toDataURL("image/png");
jquery("a").prop("href", base64);
});
},
methods: {
onInit() {
@@ -38,11 +51,11 @@ export default {
method: "post",
data: {
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" },
responseType: "arraybuffer" //一定要设置响应类型否则页面会是空白pdf
}).then(result => {
responseType: "arraybuffer", //一定要设置响应类型否则页面会是空白pdf
}).then((result) => {
const binaryData = [];
binaryData.push(result.data);
//获取blob链接
@@ -54,32 +67,38 @@ export default {
// this.handlePrint(pdfUrl);
// }
});
// axios({
// method: "post",
// url: "http://10.19.94.9:7099/api/agreement/info",
// responseType: "blob",
// data: {
// ticket: "8a1188557bda7894017bed584f803119-ticket",
// id: "C655515B-FD91-48F2-BD79-EAABAFB7077C",
// },
// }).then((res) => {
// debugger;
// console.log(res);
// if (!res) {
// return;
// }
// let blob = new Blob([res.data], {
// type: "application/octet-stream",
// });
// let url = window.URL.createObjectURL(blob);
// let link = document.createElement("a");
// link.style.display = "none";
// link.href = url;
// document.body.appendChild(link);
// link.click();
// });
mgop({
api: "mgop.kykj.houseexpropriat.getagreementinfo",
host: "https://mapi.zjzwfw.gov.cn/",
dataType: "JSON",
type: "POST",
data: {
ticket: "8a1189377bdad67c017bf66039d76376-ticket",
id: "C655515B-FD91-48F2-BD79-EAABAFB7077C",
},
appKey: "es4b8zmz+2001833218+dehllx",
onSuccess: (result) => {
console.log("pdf.vue页面请求pdf文件:", result);
if (result.data && result.data.success == true) {
console.log("result.data.data:", result.data.data);
this.url = result.data.data;
// const binaryData = [];
// binaryData.push(result.data);
// //获取blob链接
// this.url = window.URL.createObjectURL(
// new Blob(binaryData, { type: "application/pdf" })
// );
// if (pdfUrl) {
// this.handlePrint(pdfUrl);
// }
}
},
onFail: (err) => {
console.log("用户无数据,不展示");
},
});
},
handlePrint(pdf) {
handlePrint() {
if (document.getElementById("print-iframe")) {
document.body.removeChild(document.getElementById("print-iframe"));
}
@@ -88,7 +107,7 @@ export default {
if (!iframe) {
iframe = document.createElement("IFRAME");
let doc = null;
iframe.setAttribute("src", pdf);
iframe.setAttribute("src", this.url);
iframe.setAttribute("id", "print-iframe");
document.body.appendChild(iframe);
doc = iframe.contentWindow.document;
@@ -100,8 +119,37 @@ export default {
onLoadData() {
// console.log(this.$route.params);
// this.url = this.$route.params.url;
}
}
},
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>

View File

@@ -4,13 +4,13 @@
display: flex;
justify-content: space-around;
width: 97%;
width: 94%;
height: 220px;
margin: 10px;
background: url(../../assets/img/zspg.png);
background-repeat: no-repeat;
background-size: 100% 150px;
background-size: 100% 90px;
}
.proTopBoxxy {
position: absolute;
@@ -18,21 +18,18 @@
display: flex;
justify-content: space-around;
width: 97%;
width: 94%;
height: 220px;
margin: 10px;
background: url(../../assets/img/zsxy.png);
background-repeat: no-repeat;
background-size: 100% 150px;
background-size: 100% 90px;
}
.proCenterBox {
position: relative;
left: -5px;
overflow: hidden;
width: 92%;
width: 95%;
margin-top: 78px;
border-radius: 6px;