|
@ -27,12 +27,18 @@ |
|
|
<use xlink:href="#icon-home"></use> |
|
|
<use xlink:href="#icon-home"></use> |
|
|
</svg> |
|
|
</svg> |
|
|
</template> |
|
|
</template> |
|
|
<iframe v-if="tabIsIframe(item.iframeURL)" |
|
|
<template v-if="tabIsIframe(item.iframeURL)"> |
|
|
:src="item.iframeURL" |
|
|
<iframe :src="item.iframeURL + '?token=' + token + '&customerId=' + customerId" |
|
|
|
|
|
ref="iframes" |
|
|
|
|
|
class="iframes" |
|
|
|
|
|
id="iframes" |
|
|
width="100%" |
|
|
width="100%" |
|
|
height="100%" |
|
|
height="100%" |
|
|
frameborder="0" |
|
|
frameborder="0" |
|
|
scrolling="yes"></iframe> |
|
|
scrolling="yes" |
|
|
|
|
|
></iframe> |
|
|
|
|
|
<!-- <div v-if="tabIsIframe(item.iframeURL)" id="addend-iframe" style="height: 100%;"> </div> --> |
|
|
|
|
|
</template> |
|
|
<keep-alive v-else> |
|
|
<keep-alive v-else> |
|
|
<router-view v-if="item.name === $store.state.contentTabsActiveName" |
|
|
<router-view v-if="item.name === $store.state.contentTabsActiveName" |
|
|
@changeCustomerName="changeCustomerName" /> |
|
|
@changeCustomerName="changeCustomerName" /> |
|
@ -51,17 +57,30 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { isURL } from '@/utils/validate' |
|
|
import { isURL } from '@/utils/validate' |
|
|
|
|
|
import Cookie from 'js-cookie' |
|
|
export default { |
|
|
export default { |
|
|
data () { |
|
|
data () { |
|
|
return { |
|
|
return { |
|
|
|
|
|
iframeUrl: '', |
|
|
|
|
|
token: '', |
|
|
|
|
|
customerId: '' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
created () { |
|
|
|
|
|
// this.$nextTick(() => { |
|
|
|
|
|
// this.sendMessage() |
|
|
|
|
|
// }) |
|
|
|
|
|
this.token = Cookie.get('token') |
|
|
|
|
|
this.customerId = localStorage.getItem('customerId') |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
changeCustomerName (customerName) { |
|
|
changeCustomerName (customerName) { |
|
|
this.$emit('changeCustomerName', customerName) |
|
|
this.$emit('changeCustomerName', customerName) |
|
|
}, |
|
|
}, |
|
|
// tabs, 是否通过iframe展示 |
|
|
// tabs, 是否通过iframe展示 |
|
|
tabIsIframe (url) { |
|
|
tabIsIframe (url) { |
|
|
|
|
|
// this.appendIframe(url) |
|
|
|
|
|
this.iframeUrl = url + '?token=' + Cookie.get('token') + '&customerId=' + localStorage.getItem('customerId') |
|
|
return isURL(url) |
|
|
return isURL(url) |
|
|
}, |
|
|
}, |
|
|
// tabs, 选中tab |
|
|
// tabs, 选中tab |
|
@ -105,7 +124,18 @@ export default { |
|
|
tabsCloseAllHandle () { |
|
|
tabsCloseAllHandle () { |
|
|
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name === 'home') |
|
|
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name === 'home') |
|
|
this.$router.push({ name: 'home' }) |
|
|
this.$router.push({ name: 'home' }) |
|
|
} |
|
|
}, |
|
|
|
|
|
sendMessage () { |
|
|
|
|
|
// const iframe = this.$refs.iframes.contentWindow |
|
|
|
|
|
const iframe = document.getElementsByClassName('iframes')[0].contentWindow |
|
|
|
|
|
|
|
|
|
|
|
console.log('iframe', iframe) |
|
|
|
|
|
// iframe.postMessage({ |
|
|
|
|
|
// token: Cookie.get('token'), |
|
|
|
|
|
// customerId: localStorage.getItem('customerId') |
|
|
|
|
|
// }, '*') |
|
|
|
|
|
iframe.postMessage({ name: 'lalalal' }, '*') |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|