mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
fix: 修复嵌入工程组态固定账号导致父级菜单混乱
This commit is contained in:
parent
ae1219dea7
commit
6e11b2fcac
@ -14,6 +14,7 @@ import { computed, PropType, toRefs, onMounted, onUnmounted, ref, watch, defineE
|
|||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { useOriginStore } from '@/store/modules/originStore/originStore'
|
import { useOriginStore } from '@/store/modules/originStore/originStore'
|
||||||
import { postMessageToParent, isPreview } from '@/utils'
|
import { postMessageToParent, isPreview } from '@/utils'
|
||||||
|
import { useRouterStore } from '@/store/modules/routerStore/routerStore'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
chartConfig: {
|
chartConfig: {
|
||||||
@ -26,12 +27,14 @@ const { w, h } = toRefs(props.chartConfig.attr)
|
|||||||
|
|
||||||
const originStore = useOriginStore()
|
const originStore = useOriginStore()
|
||||||
|
|
||||||
|
const routerStore = useRouterStore()
|
||||||
let url = computed(() => {
|
let url = computed(() => {
|
||||||
// const account = originStore?.getOriginStore?.user?.user?.account
|
// const account = originStore?.getOriginStore?.user?.user?.account
|
||||||
const account = 'admin'
|
const account = 'admin'
|
||||||
const password = 'laimi@123'
|
const password = 'laimi@123'
|
||||||
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.42:9528'
|
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.55:9528'
|
||||||
let str = `${origin}/static/#/dynamicRing/schematicDiagram/${props.chartConfig.customData.mapId}?parentOrigin=${window.location.origin}&isScreenIframe=true&account=${account}&password=${password}`
|
// let str = `${origin}/static/#/dynamicRing/schematicDiagram/${props.chartConfig.customData.mapId}?parentOrigin=${window.location.origin}&isScreenIframe=true&account=${account}&password=${password}`
|
||||||
|
let str = `${origin}/static/#/dynamicRing/schematicDiagram/${props.chartConfig.customData.mapId}?parentOrigin=${window.location.origin}&isScreenIframe=true&access_token=${routerStore.token}`
|
||||||
return str
|
return str
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -43,7 +46,7 @@ const option = computed(() => {
|
|||||||
const emit = defineEmits(['changeZIndex', 'enableOuter'])
|
const emit = defineEmits(['changeZIndex', 'enableOuter'])
|
||||||
|
|
||||||
const handleMsg = (event: any) => {
|
const handleMsg = (event: any) => {
|
||||||
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.42:9528'
|
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.55:9528'
|
||||||
if (event.origin === origin) {
|
if (event.origin === origin) {
|
||||||
// 处理来自子级页面的消息
|
// 处理来自子级页面的消息
|
||||||
let obj = event.data
|
let obj = event.data
|
||||||
@ -113,7 +116,7 @@ watch(() => setIframeStr, () => {
|
|||||||
|
|
||||||
const postMsgToChild = (obj: Object) => {
|
const postMsgToChild = (obj: Object) => {
|
||||||
if(iframe.value) {
|
if(iframe.value) {
|
||||||
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.42:9528'
|
let origin = process.env.NODE_ENV === 'production' ? window.location.origin : 'http://192.168.0.55:9528'
|
||||||
iframe.value.contentWindow.postMessage(obj, origin);
|
iframe.value.contentWindow.postMessage(obj, origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user