单点修改
This commit is contained in:
@@ -9,7 +9,7 @@ import { useDictStoreWithOut } from '@/store/modules/dict'
|
|||||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
import { useLowStoreWithOut } from '@/store/modules/low'
|
import { useLowStoreWithOut } from '@/store/modules/low'
|
||||||
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
||||||
|
import * as authUtil from '@/utils/auth'
|
||||||
const { start, done } = useNProgress()
|
const { start, done } = useNProgress()
|
||||||
|
|
||||||
const { loadStart, loadDone } = usePageLoading()
|
const { loadStart, loadDone } = usePageLoading()
|
||||||
@@ -63,7 +63,24 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
loadStart()
|
loadStart()
|
||||||
if (getAccessToken()) {
|
if (getAccessToken()) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
|
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: '/' })
|
next({ path: '/' })
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
next({ path: '/' })
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 获取所有字典
|
// 获取所有字典
|
||||||
const dictStore = useDictStoreWithOut()
|
const dictStore = useDictStoreWithOut()
|
||||||
|
|||||||
@@ -89,9 +89,6 @@ export default {
|
|||||||
appsData: []
|
appsData: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.fetchApps()
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
categorizedApps() {
|
categorizedApps() {
|
||||||
const result = {};
|
const result = {};
|
||||||
@@ -135,6 +132,9 @@ export default {
|
|||||||
return Object.keys(this.filteredCategories).length;
|
return Object.keys(this.filteredCategories).length;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchApps()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchApps() {
|
async fetchApps() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ const loginData = reactive({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const getCode = async () => {
|
const getCode = async () => {
|
||||||
// 情况一,未开启:则直接登录
|
// 情况一,未开启:则直接登录
|
||||||
@@ -225,10 +224,11 @@ const handleLogin = async (params) => {
|
|||||||
debugger
|
debugger
|
||||||
console.log(accessToken);
|
console.log(accessToken);
|
||||||
if(ticketUrl!=null){
|
if(ticketUrl!=null){
|
||||||
var urll=ticketUrl+"?ticket="+accessToken;
|
|
||||||
window.location.href = urll
|
|
||||||
}else{
|
|
||||||
|
|
||||||
|
var urll=ticketUrl+"?ticket="+accessToken;
|
||||||
|
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 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user