mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
75 lines
1.5 KiB
Vue
75 lines
1.5 KiB
Vue
<template>
|
||
<view class="h5-html">
|
||
<web-view ref="webview" id="homemarkingWebView" class="wuixw" :src="url" @onPostMessage="onReciveMessage">
|
||
</web-view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import conf from '../../conf/config.js'
|
||
import {
|
||
reciveMessage,
|
||
getHcCode
|
||
} from '../../api/webView/webViewApi.js'
|
||
|
||
import {
|
||
decodeUrl
|
||
} from '../../utils/UrlUtil.js';
|
||
import {
|
||
getStorageSync,
|
||
setStorageSync
|
||
} from '../../utils/StorageUtil.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
url: '',
|
||
communityId: ''
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
let _that = this;
|
||
let _url = options.url;
|
||
_url = decodeUrl(_url);
|
||
setStorageSync('_go_back_refresh', 0);
|
||
//刷新hcCode
|
||
this.vc.getCurCommunity()
|
||
.then(function(_communityInfo) {
|
||
_that.communityId = _communityInfo.communityId;
|
||
})
|
||
.then(function() {
|
||
_that.url = conf.mallUrl + "#/pages/homemaking/index?mallFrom=HC&hcCommunityId=" + _that
|
||
.communityId;
|
||
})
|
||
|
||
},
|
||
onShow() {
|
||
let that = this;
|
||
let _goBackRefresh = getStorageSync('_go_back_refresh');
|
||
if (_goBackRefresh == 1) {
|
||
// #ifdef H5
|
||
document.getElementsByTagName('iframe').forEach(item => {
|
||
console.log(item.id);
|
||
if('homemarkingWebView' == item.id){
|
||
item.contentWindow.location.href = that.url;
|
||
}
|
||
})
|
||
// #endif
|
||
}
|
||
setStorageSync('_go_back_refresh', 0);
|
||
|
||
},
|
||
methods: {
|
||
onReciveMessage: function(event) {
|
||
reciveMessage(event);
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.h5-html {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
</style>
|