diff --git a/src/permission.ts b/src/permission.ts index c9cf7b0..ca35b04 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -9,7 +9,7 @@ import { useDictStoreWithOut } from '@/store/modules/dict' import { useUserStoreWithOut } from '@/store/modules/user' import { useLowStoreWithOut } from '@/store/modules/low' import { usePermissionStoreWithOut } from '@/store/modules/permission' - +import * as authUtil from '@/utils/auth' const { start, done } = useNProgress() const { loadStart, loadDone } = usePageLoading() @@ -63,7 +63,24 @@ router.beforeEach(async (to, from, next) => { loadStart() if (getAccessToken()) { if (to.path === '/login') { - next({ path: '/' }) + const queryParams = new URLSearchParams(window.location.search); + const ticketUrl = queryParams.get('url'); + const ssUrl = queryParams.get('ssUrl'); + + if(ticketUrl!=null&&ssUrl==null){ + next() + }else if(ticketUrl!=null&&ssUrl!==null){ + const accessToken =authUtil.getAccessToken(); + if(accessToken!=null){ + const urll=ticketUrl+"?ticket="+accessToken; + window.location.href = urll+(ssUrl?"&redirect="+ssUrl:''); + }else{ + next({ path: '/' }) + } + }else{ + next({ path: '/' }) + } + } else { // 获取所有字典 const dictStore = useDictStoreWithOut() diff --git a/src/views/Home/Index20.vue b/src/views/Home/Index20.vue index bc1c23b..8235508 100644 --- a/src/views/Home/Index20.vue +++ b/src/views/Home/Index20.vue @@ -89,9 +89,6 @@ export default { appsData: [] }; }, - mounted() { - this.fetchApps() - }, computed: { categorizedApps() { const result = {}; @@ -135,6 +132,9 @@ export default { return Object.keys(this.filteredCategories).length; } }, + mounted() { + this.fetchApps() + }, methods: { async fetchApps() { try { diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 0f98f7e..8591aef 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -141,7 +141,6 @@ const loginData = reactive({ } }) - // 获取验证码 const getCode = async () => { // 情况一,未开启:则直接登录 @@ -225,11 +224,12 @@ const handleLogin = async (params) => { debugger console.log(accessToken); if(ticketUrl!=null){ + var urll=ticketUrl+"?ticket="+accessToken; - window.location.href = urll + var ssUrl=queryParams.get('ssUrl') + window.location.href = urll+(ssUrl?"&redirect="+ssUrl:''); }else{ - - push({ path: redirect.value || permissionStore.addRouters[0].path }) + push({ path: redirect.value || permissionStore.addRouters[0].path }) }