完善其他iframe跳转页面token传输
This commit is contained in:
parent
fd37640245
commit
c3269ee876
|
|
@ -1,8 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<iframe :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
<iframe ref="rentFrame" :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RentManage',
|
name: 'RentManage',
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -17,6 +19,22 @@ export default {
|
||||||
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=rent-manage'
|
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=rent-manage'
|
||||||
: 'http://localhost:8102/iws/mall-view/home?redirect=rent-manage'
|
: 'http://localhost:8102/iws/mall-view/home?redirect=rent-manage'
|
||||||
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
||||||
|
|
||||||
|
// 等 iframe 加载完成再传 token
|
||||||
|
this.$refs.rentFrame.onload = () => {
|
||||||
|
const token = getToken() // 从 Cookie 中获取正确的 token
|
||||||
|
console.log('A项目token:' + token)
|
||||||
|
if (token) {
|
||||||
|
// 使用 postMessage 发送给 B
|
||||||
|
this.$refs.rentFrame.contentWindow.postMessage(
|
||||||
|
{
|
||||||
|
type: 'SET_TOKEN',
|
||||||
|
token: token,
|
||||||
|
},
|
||||||
|
window.location.origin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<iframe :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
<iframe ref="requirementFrame" :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RequirementIframe',
|
name: 'RequirementIframe',
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -17,6 +19,22 @@ export default {
|
||||||
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=parity'
|
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=parity'
|
||||||
: 'http://localhost:8102/iws/mall-view/home?redirect=parity'
|
: 'http://localhost:8102/iws/mall-view/home?redirect=parity'
|
||||||
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
||||||
|
|
||||||
|
// 等 iframe 加载完成再传 token
|
||||||
|
this.$refs.requirementFrame.onload = () => {
|
||||||
|
const token = getToken() // 从 Cookie 中获取正确的 token
|
||||||
|
console.log('A项目token:' + token)
|
||||||
|
if (token) {
|
||||||
|
// 使用 postMessage 发送给 B
|
||||||
|
this.$refs.requirementFrame.contentWindow.postMessage(
|
||||||
|
{
|
||||||
|
type: 'SET_TOKEN',
|
||||||
|
token: token,
|
||||||
|
},
|
||||||
|
window.location.origin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<iframe :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
<iframe ref="requirementListFrame" :src="iframeSrc" style="width: 100%; height: 100vh; border: none"></iframe>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'requirementListIframe',
|
name: 'requirementListIframe',
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -17,6 +19,22 @@ export default {
|
||||||
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=sourcingNeed'
|
? 'http://36.33.26.201:21999/iws/mall-view/home?redirect=sourcingNeed'
|
||||||
: 'http://localhost:8102/iws/mall-view/home?redirect=sourcingNeed'
|
: 'http://localhost:8102/iws/mall-view/home?redirect=sourcingNeed'
|
||||||
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
console.log('🚀 ~ this.iframeSrc:', this.iframeSrc)
|
||||||
|
|
||||||
|
// 等 iframe 加载完成再传 token
|
||||||
|
this.$refs.requirementListFrame.onload = () => {
|
||||||
|
const token = getToken() // 从 Cookie 中获取正确的 token
|
||||||
|
console.log('A项目token:' + token)
|
||||||
|
if (token) {
|
||||||
|
// 使用 postMessage 发送给 B
|
||||||
|
this.$refs.requirementListFrame.contentWindow.postMessage(
|
||||||
|
{
|
||||||
|
type: 'SET_TOKEN',
|
||||||
|
token: token,
|
||||||
|
},
|
||||||
|
window.location.origin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue