前端二次进入页面和二次回退问题解决
This commit is contained in:
路 范
2021-12-02 11:18:07 +08:00
parent 184504d23e
commit b9e0f54b4d
25 changed files with 205 additions and 91 deletions

View File

@@ -29,7 +29,7 @@
</div>
<div @click="gotoProject('pg')" style="background: #f1ae4b">
<img src="@/assets/img/evaluation.png" />
<span>查评估结果</span>
<span>查评估报告</span>
</div>
<div @click="gotoProject('xy')" style="background: #16d7ed">
<img src="@/assets/img/compensation.png" />
@@ -286,25 +286,35 @@ export default {
};
},
created() {
if (!this.$route.query.ticket) {
// window.location.replace(
// "https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs"
// );
ZWJSBridge.openLink({
url: "https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs",
})
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error);
});
} else {
this.onInit();
}
// this.onInit();
// SetTicket(this.$route.query.ticket);
// if (!this.$route.query.ticket) {
// // //this.$router.push('https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs');
// // ZWJSBridge.openLink({
// // url: "https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs",
// // })
// // .then((result) => {
// // console.log('1130-1'+result)
// // window.parent.location.reload();
// // ZWJSBridge.close();
// // })
// // .catch((error) => {
// // console.log(error);
// // });
// // ZWJSBridge.close()
// // .then((result) => {
// // window.location.replace(
// // "https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs&goto=https://mapi.zjzwfw.gov.cn/web/mgop/gov-open/zj/2001833218/reserved/index.html"
// // );
// // })
// // .catch((error) => {
// // console.log(error);
// // });
// } else {
// this.onInit();
// }
this.onInit();
this.setLocationAplus();
SetTicket(this.$route.query.ticket);
// SetTicket(this.$route.query.ticket);
$(".logout").css("display", "none");
if (sessionStorage.getItem("mode") == "older") {
changeStyle();
@@ -313,6 +323,24 @@ export default {
$("#app").addClass("old_app3");
}
},
beforeRouteLeave(to, from, next) {
//debugger;
if (from.name == "final" && to.name == "index") {
ZWJSBridge.close()
.then((result) => {
console.log(
"1201-index页面的close回调3--form-to:" + from.name + "->" + to.name
);
console.log(result);
})
.catch((error) => {
console.log(
"1201-index页面的close回调异常4--form-to:" + from.name + "->" + to.name
);
console.log(error);
});
} else next();
},
mounted() {
if (sessionStorage.getItem("mode") == "older") {
$(".container").addClass("old_container");
@@ -327,7 +355,8 @@ export default {
dataType: "JSON",
type: "POST",
data: {
ticket: this.$route.query.ticket,
ticket:
this.$route.query.ticket || window.sessionStorage.getItem("ticket"),
},
appKey: "es4b8zmz+2001833218+dehllx",
onSuccess: (data) => {
@@ -501,6 +530,7 @@ export default {
});
},
scan() {
//this.$router.push("http://localhost:8080/#/");
//扫一扫
ZWJSBridge.scan({ type: "qrCode" })
.then((data) => {

View File

@@ -0,0 +1,16 @@
<template>
<div class="container"></div>
</template>
<script>
export default {
data() {
return {};
},
created() {
//debugger;
this.$router.push("final");
},
methods: {},
};
</script>