xiabin修改登录逻辑

This commit is contained in:
13713575202 2025-06-26 14:14:30 +08:00
parent f91e7e0f13
commit 794918ba09
4 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ onMounted(() => {
if (localStorage.getItem('source')) {
router.push('/sub-government-affairs-service/home');
} else {
if (JSON.parse(localStorage.getItem('daimp-front-main_userStore')).token) {
if (localStorage.getItem('daimp-front-main_userStore') && JSON.parse(localStorage.getItem('daimp-front-main_userStore')).token) {
router.push('/sub-government-affairs-service/home');
} else {
router.push('/sub-government-affairs-service/login');

View File

@ -53,7 +53,7 @@ const logOut = async () => {
type: 'success',
message: '退出登录成功!',
});
localStorage.removeItem('daimp-front-main_user_store');
localStorage.removeItem('daimp-front-main_userStore');
} else {
console.log('退出到门户页');
}

View File

@ -22,7 +22,7 @@ onMounted(() => {
if (localStorage.getItem('source')) {
router.push('/sub-operation-service/dashboard/home');
} else {
if (JSON.parse(localStorage.getItem('daimp-front-main_userStore')).token) {
if (localStorage.getItem('daimp-front-main_userStore') && JSON.parse(localStorage.getItem('daimp-front-main_userStore')).token) {
router.push('/sub-operation-service/dashboard/home');
} else {
router.push('/sub-operation-service/login');

View File

@ -146,12 +146,12 @@ const loginOut = () => {
Logout().then((res) => {
if (res.code === 200) {
if (res.data.source !== 'main') {
localStorage.removeItem('daimp-front-main_userStore');
router.push({ path: '/sub-operation-service/login' });
ElMessage({
type: 'success',
message: '退出登录成功!',
});
localStorage.removeItem('daimp-front-main_user_store');
} else {
console.log('退出到门户页');
}