diff --git a/core/core-frontend/src/pages/panel/DashboardPreview.vue b/core/core-frontend/src/pages/panel/DashboardPreview.vue index 06e8d9c10f..1bd4fd15fb 100644 --- a/core/core-frontend/src/pages/panel/DashboardPreview.vue +++ b/core/core-frontend/src/pages/panel/DashboardPreview.vue @@ -13,6 +13,7 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { useI18n } from '@/hooks/web/useI18n' import VanSticky from 'vant/es/sticky' import VanNavBar from 'vant/es/nav-bar' +import request from '@/config/axios' import 'vant/es/nav-bar/style' import 'vant/es/sticky/style' const { wsCache } = useCache() @@ -44,6 +45,12 @@ onBeforeMount(async () => { if (!checkResult) { return } + let tokenInfo = null + if (embeddedStore.getToken && !Object.keys((tokenInfo = embeddedStore.getTokenInfo)).length) { + const res = await request.get({ url: '/embedded/getTokenArgs' }) + embeddedStore.setTokenInfo(res.data) + tokenInfo = embeddedStore.getTokenInfo + } // 添加外部参数 let attachParams await getOuterParamsInfo(embeddedStore.dvId).then(rsp => { @@ -61,6 +68,9 @@ onBeforeMount(async () => { ElMessage.error(t('visualization.outer_param_decode_error')) } } + if (tokenInfo && Object.keys(tokenInfo).length) { + attachParams = Object.assign({}, attachParams, tokenInfo) + } isPc.value = !isMobile() const req = isPc.value ? initCanvasData : initCanvasDataMobile diff --git a/core/core-frontend/src/store/modules/embedded.ts b/core/core-frontend/src/store/modules/embedded.ts index 90acccdb70..716851a06f 100644 --- a/core/core-frontend/src/store/modules/embedded.ts +++ b/core/core-frontend/src/store/modules/embedded.ts @@ -20,6 +20,7 @@ interface AppState { datasetId: string datasetCopyId: string datasetPid: string + tokenInfo?: Map } export const userStore = defineStore('embedded', { @@ -43,7 +44,8 @@ export const userStore = defineStore('embedded', { tableName: '', datasetId: '', datasetCopyId: '', - datasetPid: '' + datasetPid: '', + tokenInfo: new Map() } }, getters: { @@ -89,6 +91,9 @@ export const userStore = defineStore('embedded', { getOpt(): string { return this.opt }, + getTokenInfo(): Map { + return this.tokenInfo + }, getIframeData(): any { return { embeddedToken: this.token, @@ -160,7 +165,7 @@ export const userStore = defineStore('embedded', { setOpt(opt: string) { this.opt = opt }, - setIframeData(data: any) { + async setIframeData(data: any) { this.type = data['type'] this.token = data['embeddedToken'] this.busiFlag = data['busiFlag'] @@ -170,6 +175,9 @@ export const userStore = defineStore('embedded', { this.pid = data['pid'] this.resourceId = data['resourceId'] }, + async setTokenInfo(tokenInfo: Map) { + this.tokenInfo = tokenInfo + }, clearState() { this.setPid('') this.setOpt('') diff --git a/de-xpack b/de-xpack index 38c32d17ac..11b651cfa7 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 38c32d17acda1963abb19ecc0afd926caefa375d +Subproject commit 11b651cfa73e22195c36887672539a6a7ee0dddc diff --git a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/embedded/api/EmbeddedApi.java b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/embedded/api/EmbeddedApi.java index 29710e01dc..eed9c62b48 100644 --- a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/embedded/api/EmbeddedApi.java +++ b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/embedded/api/EmbeddedApi.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +import java.util.Map; @Tag(name = "嵌入式") @ApiSupport(order = 883, author = "fit2cloud-someone") @@ -57,4 +58,7 @@ public interface EmbeddedApi { @Hidden @PostMapping("/initIframe") void initIframe(@RequestBody EmbeddedOrigin origin); + + @GetMapping("/getTokenArgs") + Map getTokenArgs(); }