bugfix
前端二次进入页面和二次回退问题解决
This commit is contained in:
@@ -3,8 +3,28 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0" />
|
||||
<title>宁波房屋征收</title>
|
||||
<script>
|
||||
function getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]); return null;
|
||||
}
|
||||
//debugger
|
||||
var ticket = getQueryString('ticket');
|
||||
console.log('1201-ticket' + ticket)
|
||||
if (ticket)
|
||||
window.sessionStorage.setItem('ticket', ticket)
|
||||
else {
|
||||
if (window.sessionStorage.getItem('ticket') == null) {
|
||||
setTimeout(function () { window.close() }, 10);
|
||||
//window.open('https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs')
|
||||
location.replace('https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="https://d.alicdn.com/alilog/mlog/aplus.js?id=202951085"></script>
|
||||
<script type="text/javascript" src="//jssdk.yyhj.zjzwfw.gov.cn/jsbridge/v2.0.0/bridge.min.js"></script>
|
||||
<!-- 引入ZWJSBridge -->
|
||||
@@ -15,7 +35,7 @@
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
<script>
|
||||
(function(w, d, s, q, i) {
|
||||
(function (w, d, s, q, i) {
|
||||
w[q] = w[q] || [];
|
||||
var f = d.getElementsByTagName(s)[0];
|
||||
var j = d.createElement(s);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
export function SetTicket(data) {
|
||||
window.sessionStorage.setItem("ticket", data);
|
||||
}
|
||||
export function GetTicket() {
|
||||
window.sessionStorage.getItem("ticket");
|
||||
}
|
||||
|
||||
// 设置项目id
|
||||
export function SetProjectId(data) {
|
||||
|
||||
@@ -6,76 +6,103 @@ Vue.use(Router);
|
||||
const router = new Router({
|
||||
mode: "hash",
|
||||
routes: [{
|
||||
path: "/",
|
||||
name: "index",
|
||||
meta: { index: 1, title: "宁波房屋征收" },
|
||||
component: () =>
|
||||
import ("../views")
|
||||
},
|
||||
// 选择项目页面
|
||||
{
|
||||
path: "/project-select",
|
||||
name: "projectSelect",
|
||||
meta: { index: 2, title: "征收信息查询" },
|
||||
component: () =>
|
||||
import ("../views/project")
|
||||
},
|
||||
// 评估结果一级页面
|
||||
{
|
||||
path: "/report/evalute",
|
||||
name: "evalute",
|
||||
meta: { index: 3, title: "评估结果" },
|
||||
component: () =>
|
||||
import ("../views/report/evalute")
|
||||
},
|
||||
// 协议结果页面
|
||||
{
|
||||
path: "/report/agreement",
|
||||
name: "reportAgreement",
|
||||
meta: { index: 4, title: "协议结果" },
|
||||
component: () =>
|
||||
import ("../views/report/agreement")
|
||||
},
|
||||
// 补偿协议pdf
|
||||
{
|
||||
path: "/showPdf",
|
||||
name: "showPdf",
|
||||
meta: { index: 5, title: "协议详情" },
|
||||
component: () =>
|
||||
import ("../views/pdf/pdf")
|
||||
},
|
||||
// 评估结果二级页面(表格页面)
|
||||
{
|
||||
path: "/evaluatePage",
|
||||
name: "evaluatePage",
|
||||
meta: { index: 6, title: "评估报告" },
|
||||
component: () =>
|
||||
import ("../views/report/evaluatePage")
|
||||
},
|
||||
// 评估结果二级页面(pdf页面)
|
||||
{
|
||||
path: "/evaluateResultPdf",
|
||||
name: "evaluateResultPdf",
|
||||
meta: { index: 7, title: "评估报告" },
|
||||
component: () =>
|
||||
import ("../views/pdf/evaluateResultPdf")
|
||||
},
|
||||
// 政策详情页面
|
||||
{
|
||||
path: "/policyInfo",
|
||||
name: "policyInfo",
|
||||
meta: { index: 8, title: "政策详情" },
|
||||
component: () =>
|
||||
import ("../views/policyInfo/policyInfo")
|
||||
}
|
||||
path: "/",
|
||||
name: "index",
|
||||
meta: { index: 1, title: "宁波房屋征收" },
|
||||
component: () =>
|
||||
import("../views/transit")
|
||||
},
|
||||
// 选择项目页面
|
||||
{
|
||||
path: "/project-select",
|
||||
name: "projectSelect",
|
||||
meta: { index: 2, title: "征收信息查询" },
|
||||
component: () =>
|
||||
import("../views/project")
|
||||
},
|
||||
// 评估结果一级页面
|
||||
{
|
||||
path: "/report/evalute",
|
||||
name: "evalute",
|
||||
meta: { index: 3, title: "评估结果" },
|
||||
component: () =>
|
||||
import("../views/report/evalute")
|
||||
},
|
||||
// 协议结果页面
|
||||
{
|
||||
path: "/report/agreement",
|
||||
name: "reportAgreement",
|
||||
meta: { index: 4, title: "协议结果" },
|
||||
component: () =>
|
||||
import("../views/report/agreement")
|
||||
},
|
||||
// 补偿协议pdf
|
||||
{
|
||||
path: "/showPdf",
|
||||
name: "showPdf",
|
||||
meta: { index: 5, title: "协议详情" },
|
||||
component: () =>
|
||||
import("../views/pdf/pdf")
|
||||
},
|
||||
// 评估结果二级页面(表格页面)
|
||||
{
|
||||
path: "/evaluatePage",
|
||||
name: "evaluatePage",
|
||||
meta: { index: 6, title: "评估报告" },
|
||||
component: () =>
|
||||
import("../views/report/evaluatePage")
|
||||
},
|
||||
// 评估结果二级页面(pdf页面)
|
||||
{
|
||||
path: "/evaluateResultPdf",
|
||||
name: "evaluateResultPdf",
|
||||
meta: { index: 7, title: "评估报告" },
|
||||
component: () =>
|
||||
import("../views/pdf/evaluateResultPdf")
|
||||
},
|
||||
// 政策详情页面
|
||||
{
|
||||
path: "/policyInfo",
|
||||
name: "policyInfo",
|
||||
meta: { index: 8, title: "政策详情" },
|
||||
component: () =>
|
||||
import("../views/policyInfo/policyInfo")
|
||||
}, {
|
||||
path: "/final",
|
||||
name: "final",
|
||||
meta: { index: 9, title: "宁波房屋征收" },
|
||||
component: () =>
|
||||
import("../views")
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
//debugger
|
||||
console.log('1201-进入路由1--form-to:' + from.name + "->" + to.name);
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title;
|
||||
}
|
||||
next();
|
||||
// if (from.name == null && to.name == 'index') {
|
||||
// router.push('/transit');
|
||||
// next();
|
||||
// } else {
|
||||
if (from.name == 'final' && to.name == 'index') {
|
||||
console.log('1201-进入判断2--form-to:' + from.name + "->" + to.name);
|
||||
ZWJSBridge.close().then((result) => {
|
||||
console.log('1201-进入close回调3--form-to:' + from.name + "->" + to.name);
|
||||
console.log(result);
|
||||
}).catch((error) => {
|
||||
console.log('1201-进入close回调异常4--form-to:' + from.name + "->" + to.name);
|
||||
console.log(error);
|
||||
});
|
||||
console.log('1201-退出之前5--form-to:' + from.name + "->" + to.name);
|
||||
}
|
||||
else {
|
||||
console.log('1201-next之前6--form-to:' + from.name + "->" + to.name);
|
||||
next();
|
||||
}
|
||||
// }
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -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) => {
|
||||
|
||||
16
FrontCode2/sunshine_levy/src/views/transit/index.vue
Normal file
16
FrontCode2/sunshine_levy/src/views/transit/index.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="container"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() {
|
||||
//debugger;
|
||||
this.$router.push("final");
|
||||
},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user