|
@@ -21,7 +21,7 @@ export default {
|
|
|
return {
|
|
|
ifr: null,
|
|
|
srcHost: '/case/caseList/zhihui/',
|
|
|
- loading: false,
|
|
|
+ loading: true,
|
|
|
path: '/useCase',
|
|
|
eventHandlers: '',
|
|
|
fullScreen: false // 是否全屏
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- window.addEventListener('message', this.setRouterPath, false)
|
|
|
+ window.addEventListener('message', this.onEventListener, false)
|
|
|
|
|
|
// window.addEventListener(
|
|
|
// 'message',
|
|
@@ -72,14 +72,12 @@ export default {
|
|
|
destroyed() {
|
|
|
window.removeEventListener(
|
|
|
'message',
|
|
|
- e => {
|
|
|
- // console.log('销毁')
|
|
|
- },
|
|
|
+ this.onEventListener,
|
|
|
false
|
|
|
)
|
|
|
},
|
|
|
methods: {
|
|
|
- setRouterPath(e) {
|
|
|
+ onEventListener(e) {
|
|
|
console.log(e.data)
|
|
|
const { event, route } = e.data
|
|
|
const { href } = window.location
|
|
@@ -87,35 +85,9 @@ export default {
|
|
|
const params = getUrlSearch(['caseRoute'], [{ key: 'caseRoute', value: route }])
|
|
|
window.open(`${href.split('?')[0]}?${params}`, '_self')
|
|
|
}
|
|
|
- // console.log(e.nativeEvent.data)
|
|
|
- // console.log(desDecryptId(this.$route.query.bizId))
|
|
|
- // console.log(this.$route.query)
|
|
|
- // this.path = msg.nativeEvent.data.path
|
|
|
- /* const { event, payload } = e.data
|
|
|
- const { href, hash } = window.location
|
|
|
- // 链接跳转时发送message的data
|
|
|
- if (event === 'case-link') {
|
|
|
- // const detailCaseUrl = payload.url.replace(/http.*zhihui\//, '') // 截取 iframe 传递过来的页面地址
|
|
|
- const detailCaseUrl = payload // 截取 iframe 传递过来的页面地址
|
|
|
- if (detailCaseUrl.search(/http/) > -1) return // 字符串截取失败终止
|
|
|
- let websiteUrl = `${href}&detailCaseUrl=${encodeURIComponent(
|
|
|
- detailCaseUrl
|
|
|
- )}` // 新的页面地址
|
|
|
- // 如果当前打开页面地址是已分享地址,则将原有的 detailCaseUrl 值替换
|
|
|
- console.log(hash, href)
|
|
|
- if (hash.search(/detailCaseUrl/) > -1) {
|
|
|
- websiteUrl = href.replace(
|
|
|
- /detailCaseUrl=.*!/,
|
|
|
- `detailCaseUrl=${encodeURIComponent(detailCaseUrl)}`
|
|
|
- )
|
|
|
- }
|
|
|
- // 改变浏览器历史URL
|
|
|
- window.history.pushState(
|
|
|
- { url: websiteUrl, title: document.title },
|
|
|
- document.title,
|
|
|
- websiteUrl
|
|
|
- )
|
|
|
- }*/
|
|
|
+ if (event === 'done') {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|