fix: 优化第三方应用菜单集成
This commit is contained in:
parent
506ac2702d
commit
4eedc5812c
|
@ -25,7 +25,7 @@
|
||||||
"event-source-polyfill": "^1.0.31",
|
"event-source-polyfill": "^1.0.31",
|
||||||
"global": "^4.4.0",
|
"global": "^4.4.0",
|
||||||
"jetlinks-store": "^0.0.3",
|
"jetlinks-store": "^0.0.3",
|
||||||
"jetlinks-ui-components": "^1.0.34-7",
|
"jetlinks-ui-components": "^1.0.34-12",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
|
|
12
src/App.vue
12
src/App.vue
|
@ -10,11 +10,23 @@ import zhCN from 'jetlinks-ui-components/es/locale/zh_CN';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useSystem } from './store/system';
|
import { useSystem } from './store/system';
|
||||||
import DefaultSetting from '../config/config'
|
import DefaultSetting from '../config/config'
|
||||||
|
import {LocalStore} from "@/utils/comm";
|
||||||
|
import {TOKEN_KEY} from "@/utils/variable";
|
||||||
|
|
||||||
const system = useSystem();
|
const system = useSystem();
|
||||||
const {configInfo} = storeToRefs(system);
|
const {configInfo} = storeToRefs(system);
|
||||||
|
|
||||||
system.setDocumentTitle()
|
system.setDocumentTitle()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
watch(() => JSON.stringify(route.query || {}), () => {
|
||||||
|
if (route.query.token) {
|
||||||
|
LocalStore.set(TOKEN_KEY, route.query.token);
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
|
||||||
ConfigProvider.config({
|
ConfigProvider.config({
|
||||||
theme: {
|
theme: {
|
||||||
primaryColor: "#315efb"
|
primaryColor: "#315efb"
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
v-model:collapsed="basicLayout.collapsed"
|
v-model:collapsed="basicLayout.collapsed"
|
||||||
v-model:openKeys="basicLayout.openKeys"
|
v-model:openKeys="basicLayout.openKeys"
|
||||||
:selectedKeys="basicLayout.selectedKeys"
|
:selectedKeys="basicLayout.selectedKeys"
|
||||||
:headerHeight='layout.headerHeight'
|
:breadcrumb="basicLayout.pure ? undefined : { routes: breadcrumbs }"
|
||||||
:breadcrumb="{ routes: breadcrumbs }"
|
:headerHeight='basicLayout.pure ? 1 : layout.headerHeight'
|
||||||
:pure="basicLayout.pure"
|
:pure="basicLayout.pure"
|
||||||
@backClick='routerBack'
|
@backClick='routerBack'
|
||||||
>
|
>
|
||||||
|
|
|
@ -159,11 +159,11 @@ const extraRouteObj = {
|
||||||
type Buttons = Array<{ id: string }>
|
type Buttons = Array<{ id: string }>
|
||||||
|
|
||||||
const hasAppID = (item: any): { isApp: boolean, appUrl: string } => {
|
const hasAppID = (item: any): { isApp: boolean, appUrl: string } => {
|
||||||
const isApp = !!item.appId
|
const isApp = !!item.appId || item.options?.owner
|
||||||
const isLowCode = !!item.options?.LowCode
|
const isLowCode = !!item.options?.LowCode
|
||||||
return {
|
return {
|
||||||
isApp: isApp || isLowCode,
|
isApp: isApp || isLowCode,
|
||||||
appUrl: isApp ? `/${item.appId}${item.url}` : item.url
|
appUrl: isApp ? `/${item.appId || item.options?.owner}${item.url}` : item.url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,17 +48,18 @@ const handle = async (appId: string, url: string) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _url = menuUrl.startsWith('/') ? menuUrl : `/${menuUrl}`;
|
||||||
|
|
||||||
if (result.provider === 'internal-standalone') {
|
if (result.provider === 'internal-standalone') {
|
||||||
const urlStandalone = `${result.page.baseUrl}/api/application/sso/${appId}/login?redirect=${menuUrl}?layout=false`;
|
const urlStandalone = `${result.page.baseUrl}/api/application/sso/${appId}/login?redirect=${menuUrl}?layout=false`;
|
||||||
iframeUrl.value = urlStandalone;
|
iframeUrl.value = urlStandalone;
|
||||||
} else if (result.provider === 'internal-integrated') {
|
} else if (result.provider === 'internal-integrated') {
|
||||||
const _url = menuUrl.startsWith('/') ? menuUrl : `/${menuUrl}`;
|
|
||||||
const tokenUrl = `${
|
const tokenUrl = `${
|
||||||
result.page.baseUrl
|
result.page.baseUrl
|
||||||
}${_url}?layout=false&X-Access-Token=${LocalStore.get(TOKEN_KEY)}`;
|
}${_url}?layout=false&X-Access-Token=${LocalStore.get(TOKEN_KEY)}`;
|
||||||
iframeUrl.value = tokenUrl;
|
iframeUrl.value = tokenUrl;
|
||||||
} else {
|
} else {
|
||||||
const urlOther = `${result.page.baseUrl}/${menuUrl}`;
|
const urlOther = `${result.page.baseUrl}${_url}`;
|
||||||
iframeUrl.value = urlOther;
|
iframeUrl.value = urlOther;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,7 @@ watchEffect(() => {
|
||||||
} else {
|
} else {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const url = route.path.split('/').slice(2).join('/');
|
const url = route.path.split('/').slice(2).join('/');
|
||||||
|
console.log(route.path.split('/').slice(2))
|
||||||
handle(params, url);
|
handle(params, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3738,10 +3738,10 @@ jetlinks-store@^0.0.3:
|
||||||
resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz"
|
resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz"
|
||||||
integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q==
|
integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q==
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.34-7:
|
jetlinks-ui-components@^1.0.34-12:
|
||||||
version "1.0.34-7"
|
version "1.0.34-12"
|
||||||
resolved "https://registry.npmjs.org/jetlinks-ui-components/-/jetlinks-ui-components-1.0.34-7.tgz#3a14e85edb4c5d11427d30f3925dc5f498478940"
|
resolved "https://registry.npmjs.org/jetlinks-ui-components/-/jetlinks-ui-components-1.0.34-12.tgz#13e035bae1d16af957d81a175daaa3a2fe290406"
|
||||||
integrity sha512-Rgbjig3QYP8CDVHLbco20Cf7sArYralO8yWtH5E5zylYAN2lINLUsgOlIVf9aweszZR/Ps+z/NLP0CoRQf1Xtw==
|
integrity sha512-fxoncKov8IsScneXQYcaBwg+HnXrkJSaS7z9aV7uZK4/WxvTaAWozOPIOSkBwfDya+BuRpbJ9ZW3X9MtT6kLrQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
"@vueuse/router" "^9.13.0"
|
"@vueuse/router" "^9.13.0"
|
||||||
|
|
Loading…
Reference in New Issue