<template>
|
<view v-if="isshowtype">
|
<matherPage></matherPage>
|
</view>
|
<view v-else>
|
<web-view :webview-styles="webviewStyles" :src="webviewUrl" @message='received'></web-view>
|
</view>
|
</template>
|
|
<script>
|
import matherPage from '@/components/sh_page/matherPage.vue';
|
var wv
|
export default {
|
components:{
|
matherPage
|
},
|
data() {
|
return {
|
webviewUrl: '',
|
isshowtype:false,
|
webviewStyles: {
|
progress: {
|
color: '#EE1B14'
|
}
|
},
|
}
|
},
|
onShow()
|
{
|
// #ifdef APP-PLUS
|
var showtar = getApp().globalData.ifwt == 1 ? false : true;
|
var platform = plus.os.name;
|
//showtar&&platform=='iOS'
|
if(showtar&&platform=='iOS')
|
{//跳转new
|
this.isshowtype=true;
|
|
return;
|
}
|
// #endif
|
},
|
onLoad(options) {
|
if(!this.hasLogin){
|
uni.reLaunch({
|
url:"/pages/login/wxlogin"
|
})
|
}
|
else{
|
const value = uni.getStorageSync('userInfo');
|
console.log(value);
|
//this.webviewUrl = encodeURI('http://appapitest.ushopvip.com/html/fengqiangbang.html?token='+value.token);
|
this.webviewUrl = encodeURI('http://dfgapp.ushopvip.com/html/fengqiangbang.html?token='+value.token);
|
}
|
|
},
|
onReady() {
|
this.clearMuiBack();
|
},
|
methods: {
|
received(e) {
|
var res=e.detail.data[0];
|
console.log(res);
|
switch(res.action)
|
{
|
case "back"://返回
|
this.backLast();
|
break;
|
}
|
},
|
backLast()
|
{
|
console.log("返回")
|
uni.navigateBack({
|
delta: 1
|
});
|
},
|
// 关闭mui返回
|
clearMuiBack() {
|
// #ifdef APP-PLUS
|
var currentWebview = this.$scope.$getAppWebview().children()[0];
|
//监听注入的js
|
currentWebview.addEventListener("loaded", function() {
|
currentWebview.evalJS("mui.init({keyEventBind: {backbutton: false }});");
|
});
|
// #endif
|
},
|
|
},
|
onNavigationBarButtonTap(e) {
|
// #ifdef APP-PLUS
|
const currentWebview = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
|
var wv = currentWebview.children()[0]
|
wv.reload();
|
// #endif
|
console.log(JSON.stringify(e))
|
},
|
}
|
</script>
|
|
<style>
|
|
</style>
|