Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-06-03 11:43:40 +08:00
commit e6eadb54fd
2 changed files with 16 additions and 0 deletions

View File

@ -31,6 +31,7 @@
break; break;
case "logout": case "logout":
this.$get("/signout", function () { this.$get("/signout", function () {
alert("signout");
localStorage.clear(); localStorage.clear();
window.location.href = "/login"; window.location.href = "/login";
}); });

View File

@ -31,6 +31,7 @@ import TestPlanView from "../../track/plan/view/TestPlanView";
import TestCase from "../../track/case/TestCase"; import TestCase from "../../track/case/TestCase";
import TestTrack from "../../track/TestTrack"; import TestTrack from "../../track/TestTrack";
import ApiReportList from "../../api/report/ApiReportList"; import ApiReportList from "../../api/report/ApiReportList";
import axios from "axios";
Vue.use(VueRouter); Vue.use(VueRouter);
@ -244,4 +245,18 @@ const router = new VueRouter({
] ]
}); });
router.beforeEach((to, from, next) => {
//解决localStorage清空cookie没失效导致的卡死问题
if (!localStorage.getItem('Admin-Token')) {
axios.get("/signout");
console.log("signout");
localStorage.setItem('Admin-Token', "{}");
window.location.href = "/login";
next();
} else {
next();
}
});
export default router export default router