xiabin修改登录逻辑
This commit is contained in:
parent
f91e7e0f13
commit
794918ba09
@ -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');
|
||||
|
@ -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('退出到门户页');
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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('退出到门户页');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user