WechatOwnerService/pages/homemaking/homemaking.vue
2021-09-04 19:20:29 +08:00

58 lines
1.1 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="h5-html">
 <web-view ref="webview"  :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';
export default {
data() {
return {
url: '',
communityId: ''
}
},
onLoad(options) {
let _that = this;
let _url = options.url;
_url = decodeUrl(_url);
//刷新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 _goBackRefresh = getStorageSync('_go_back_refresh');
if(_goBackRefresh == 1){
let wv = this.$refs.webview
wv.reload(true);
}
setStorageSync('_go_back_refresh',0)
},
methods: {
onReciveMessage: function(event) {
reciveMessage(event);
}
}
}
</script>
<style>
.h5-html {
width: 100%;
height: 100%;
}
</style>