This commit is contained in:
duanxiaohai 2024-11-13 17:27:51 +08:00
commit c923174d85
3 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,3 @@
<template>
<router-view />
</template>
</template>

View File

@ -37,6 +37,7 @@ axios.interceptors.response.use(
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
}
let backurl=window.location.href;
tools.data.set("backUrl",backurl);
router.replace({

View File

@ -137,6 +137,8 @@ const getCookie = (cname) => {
};
//
const login = () => {
console.log(111111111);
let backurl = tools.data.get("backUrl");
dd.getAuthCode()
.then((res) => {
@ -153,6 +155,8 @@ const login = () => {
tools.data.set("type", 1);
getMenu();
if (backurl) {
console.log(222222);
window.location.href = backurl;
tools.data.remove("backUrl");
}
@ -210,7 +214,10 @@ const login = () => {
tools.data.set("token", token);
tools.data.set("type", 2);
getMenu();
window.addEventListener("mousemove", resetTimer);
window.addEventListener("keydown", resetTimer);
if (backurl) {
console.log(33333333333);
window.location.href = backurl;
tools.data.remove("backUrl");
}
@ -226,6 +233,7 @@ const login = () => {
}
});
};
//
const getMenu = () => {
http.get(`/api/ggfwyth/account/roleMenu`).then((res) => {
@ -244,6 +252,34 @@ const reset_font = () => {
document.querySelector("#m").style.transform =
"scale(" + width / 1920 + "," + height / 1080 + ")";
};
//退
const inactivityTimer = ref(null);
const resetTimer = () => {
clearTimeout(inactivityTimer.value);
inactivityTimer.value = setTimeout(() => {
//
// ElMessage.error("!");
// cook
ElMessage.error("长时间未操作,请重新登录");
window.removeEventListener("mousemove", resetTimer);
window.removeEventListener("keydown", resetTimer);
const cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i];
const eqPos = cookie.indexOf("=");
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie =
name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
}
let backurl = window.location.href;
tools.data.set("backUrl", backurl);
router.replace({
path: "/guide",
});
window.location.href =
"http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
}, 30 * 60 * 1000); // 30
};
onMounted(() => {
login();