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: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: () => import('@/views/assets/Cloud/'),
|
|
||||||
name: 'AccountList',
|
name: 'AccountList',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
redirect: '/console/assets/cloud',
|
||||||
meta: {
|
meta: {
|
||||||
title: i18n.t('xpack.Cloud.AccountList'),
|
title: i18n.t('xpack.Cloud.AccountList'),
|
||||||
permissions: ['xpack.view_account'],
|
permissions: ['xpack.view_account']
|
||||||
hidden: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -395,4 +395,9 @@ export const copy = _.throttle(function(value) {
|
|||||||
document.body.removeChild(inputDom)
|
document.body.removeChild(inputDom)
|
||||||
}, 1400)
|
}, 1400)
|
||||||
|
|
||||||
|
export function getQueryFromPath(path) {
|
||||||
|
const url = new URL(path, location.origin)
|
||||||
|
return Object.fromEntries(url.searchParams)
|
||||||
|
}
|
||||||
|
|
||||||
export { BASE_URL }
|
export { BASE_URL }
|
||||||
|
@@ -27,19 +27,19 @@ async function changeOrg(org, reload = true, vm = null) {
|
|||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
path = path.slice(0, index)
|
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 idRegex = /\/?(-?\d+(\.\d+)?|([a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}))\/?/
|
||||||
const i = path.search(idRegex)
|
path = path.replace(idRegex, '')
|
||||||
if (i !== -1) {
|
|
||||||
path = path.slice(0, i + 1)
|
|
||||||
}
|
|
||||||
if (vm) {
|
if (vm) {
|
||||||
const result = vm.$router.resolve({ path })
|
const result = vm.$router.resolve({ path })
|
||||||
|
console.log('path: ', path)
|
||||||
if (result.resolved.name === '404') {
|
if (result.resolved.name === '404') {
|
||||||
path = '/'
|
path = '/'
|
||||||
}
|
}
|
||||||
|
console.log('route', result)
|
||||||
}
|
}
|
||||||
location.hash = '#' + path
|
// location.hash = '#' + path
|
||||||
setTimeout(() => location.reload(), 400)
|
// setTimeout(() => location.reload(), 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasCurrentOrgPermission() {
|
function hasCurrentOrgPermission() {
|
||||||
|
Reference in New Issue
Block a user