mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 06:19:51 +00:00
perf: 修改切换组织时的 url 替换
This commit is contained in:
@@ -36,13 +36,12 @@ export default [
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/assets/Cloud/'),
|
||||
name: 'AccountList',
|
||||
hidden: true,
|
||||
redirect: '/console/assets/cloud',
|
||||
meta: {
|
||||
title: i18n.t('xpack.Cloud.AccountList'),
|
||||
permissions: ['xpack.view_account'],
|
||||
hidden: true
|
||||
permissions: ['xpack.view_account']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@@ -395,4 +395,9 @@ export const copy = _.throttle(function(value) {
|
||||
document.body.removeChild(inputDom)
|
||||
}, 1400)
|
||||
|
||||
export function getQueryFromPath(path) {
|
||||
const url = new URL(path, location.origin)
|
||||
return Object.fromEntries(url.searchParams)
|
||||
}
|
||||
|
||||
export { BASE_URL }
|
||||
|
@@ -27,19 +27,19 @@ async function changeOrg(org, reload = true, vm = null) {
|
||||
if (index !== -1) {
|
||||
path = path.slice(0, index)
|
||||
}
|
||||
const idRegex = /\/(-?\d+(\.\d+)?|[a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12})\//
|
||||
const i = path.search(idRegex)
|
||||
if (i !== -1) {
|
||||
path = path.slice(0, i + 1)
|
||||
}
|
||||
const idRegex = /\/?(-?\d+(\.\d+)?|([a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}))\/?/
|
||||
path = path.replace(idRegex, '')
|
||||
|
||||
if (vm) {
|
||||
const result = vm.$router.resolve({ path })
|
||||
console.log('path: ', path)
|
||||
if (result.resolved.name === '404') {
|
||||
path = '/'
|
||||
}
|
||||
console.log('route', result)
|
||||
}
|
||||
location.hash = '#' + path
|
||||
setTimeout(() => location.reload(), 400)
|
||||
// location.hash = '#' + path
|
||||
// setTimeout(() => location.reload(), 400)
|
||||
}
|
||||
|
||||
function hasCurrentOrgPermission() {
|
||||
|
Reference in New Issue
Block a user