This commit is contained in:
parent
d7495e8fa5
commit
538e32fc7e
|
@ -30,6 +30,7 @@ axios.interceptors.response.use(
|
|||
if (error.response) {
|
||||
if (error.response.status == 401) {
|
||||
ElMessage.error("请重新登录!");
|
||||
// 清空cook
|
||||
const cookies = document.cookie.split(";");
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = cookies[i];
|
||||
|
@ -37,6 +38,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=/;";
|
||||
}
|
||||
|
||||
router.replace({
|
||||
path: "/guide",
|
||||
});
|
||||
|
|
|
@ -138,40 +138,53 @@ const getCookie = (cname) => {
|
|||
const login = () => {
|
||||
dd.getAuthCode()
|
||||
.then((res) => {
|
||||
// let auth__code = env == "pc" ? res.auth_code : res.code;
|
||||
// console.log( 555,res, auth__code);
|
||||
if (res.auth_code) {
|
||||
http
|
||||
.post(`/api/ggfwyth/ding/one_click_login/${res.auth_code}`)
|
||||
.then((response) => {
|
||||
if (response.code == 200) {
|
||||
console.log("response", response);
|
||||
// var token = getCookie("lytoken");
|
||||
tools.data.set("token", response.data);
|
||||
tools.data.set("type", 1);
|
||||
} else {
|
||||
// 跳转未绑定页面
|
||||
router.push({
|
||||
path: `/error/403`,
|
||||
// let auth__code = env == "pc" ? res.auth_code : res.code;
|
||||
// console.log( 555,res, auth__code);
|
||||
if (res.auth_code) {
|
||||
http
|
||||
.post(`/api/ggfwyth/ding/one_click_login/${res.auth_code}`)
|
||||
.then((response) => {
|
||||
if (response.code == 200) {
|
||||
console.log("response", response);
|
||||
// var token = getCookie("lytoken");
|
||||
tools.data.set("token", response.data);
|
||||
tools.data.set("type", 1);
|
||||
} else {
|
||||
// 跳转未绑定页面
|
||||
router.push({
|
||||
path: `/error/403`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
var tokenU = routers.query.token;
|
||||
// tokenU = "6b0e380b4a8f46baae4923f83faf670d";
|
||||
if (tokenU) {
|
||||
document.cookie = `lytoken=${tokenU}`;
|
||||
var token = getCookie("lytoken");
|
||||
if (!token) {
|
||||
window.location.href =
|
||||
"http://220.191.238.50:996/api/login?returnURL=" +
|
||||
window.location.href;
|
||||
} else {
|
||||
tools.data.set("token", token);
|
||||
tools.data.set("type", 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
// var token = getCookie("lytoken");
|
||||
var token = "6b0e380b4a8f46baae4923f83faf670d";
|
||||
// console.log('token', token)
|
||||
if (!token) {
|
||||
window.location.href =
|
||||
"http://220.191.238.50:996/api/login?returnURL=" +
|
||||
window.location.href;
|
||||
} else {
|
||||
tools.data.set("token", token);
|
||||
tools.data.set("type", 2);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
window.location.href =
|
||||
"http://220.191.238.50:996/api/login?returnURL=" +
|
||||
window.location.href;
|
||||
}
|
||||
|
||||
// var token = getCookie("lytoken");
|
||||
console.log(routers.query.token);
|
||||
|
||||
// console.log('token', token)
|
||||
});
|
||||
};
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -189,7 +202,7 @@ const reset_font = () => {
|
|||
|
||||
onMounted(() => {
|
||||
console.log("页面初始化");
|
||||
|
||||
|
||||
login();
|
||||
reset_font();
|
||||
reset_font();
|
||||
|
|
Loading…
Reference in New Issue