Merge branch 'dev-zhao' into 'dev'
feat:权限管理-登出,前台打印登出的原因(提示用户因权限修改而登出) See merge request itc-framework/ma/2024/front!30
This commit is contained in:
@ -80,22 +80,31 @@ const transform: AxiosTransform = {
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case ResultEnum.UNAUTHRAZATION:
|
case ResultEnum.UNAUTHRAZATION:
|
||||||
timeoutMsg = t('登录超时,请重新登录!');
|
timeoutMsg = t('登录超时,请重新登录!');
|
||||||
|
|
||||||
const userStore = useUserStoreWithOut();
|
const userStore = useUserStoreWithOut();
|
||||||
userStore.setToken(undefined);
|
userStore.setToken(undefined);
|
||||||
if (!window.location.hash.includes('login')&&!window.location.pathname.includes('login')
|
if (!window.location.hash.includes('login')&&!window.location.pathname.includes('login')
|
||||||
&&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')) {
|
&&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')) {
|
||||||
userStore.logout(true);
|
userStore.logout(true);
|
||||||
}
|
}
|
||||||
if(data.urlToRedirectTo){
|
if (data) {
|
||||||
//登录页面不跳转
|
if(data.urlToRedirectTo){
|
||||||
if(!window.location.hash.includes('login')&&!window.location.pathname.includes('login')
|
//登录页面不跳转
|
||||||
&&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')){
|
if(!window.location.hash.includes('login')&&!window.location.pathname.includes('login')
|
||||||
window.location.href=data.urlToRedirectTo;
|
&&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')){
|
||||||
|
window.location.href=data.urlToRedirectTo;
|
||||||
|
}
|
||||||
|
options.errorMessageMode="none";
|
||||||
|
}else{
|
||||||
|
// data 有logout 信息 ,存sessionStorage 给login page 弹框显示
|
||||||
|
if (data.logoutMessage) {
|
||||||
|
sessionStorage.setItem('logoutInfoData', JSON.stringify({
|
||||||
|
logoutMessage: data.logoutMessage,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
const go = useGo();
|
||||||
|
go('/login');
|
||||||
}
|
}
|
||||||
options.errorMessageMode="none";
|
|
||||||
}else{
|
|
||||||
const go = useGo();
|
|
||||||
go('/login');
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -42,9 +42,20 @@
|
|||||||
import logopng from '/@/assets/images/logo-dark.png';
|
import logopng from '/@/assets/images/logo-dark.png';
|
||||||
import logobg from '/@/assets/images/login-left.gif';
|
import logobg from '/@/assets/images/login-left.gif';
|
||||||
import { getLogoInfo } from '/@/api/system/login';
|
import { getLogoInfo } from '/@/api/system/login';
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { LogoConfig } from '/#/config';
|
import { LogoConfig } from '/#/config';
|
||||||
|
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
const { createErrorModal } = useMessage();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
let logoutInfoData = JSON.parse(sessionStorage.getItem('logoutInfoData') as string);
|
||||||
|
if (logoutInfoData) {
|
||||||
|
createErrorModal({ title: t('错误提示'), content: logoutInfoData.logoutMessage });
|
||||||
|
sessionStorage.removeItem('logoutInfoData');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
defineProps({
|
defineProps({
|
||||||
sessionTimeout: {
|
sessionTimeout: {
|
||||||
|
|||||||
Reference in New Issue
Block a user