| | |
| | | <template> |
| | | <view> |
| | | <web-view :webview-styles="webviewStyles" :src="webviewUrl" @message='received'></web-view> |
| | | <web-view v-if="webshow" :webview-styles="webviewStyles" :src="webviewUrl" @message='received'></web-view> |
| | | <!-- taobao --> |
| | | <u-popup v-model="empowerModel" mode="center" border-radius="12"> |
| | | <empowerModel @closemodel='closeMdl' @updataInfo='updataUser'></empowerModel> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | webshow:true, |
| | | empowerModel: false, |
| | | webviewUrl: '', |
| | | user:'', |
| | |
| | | |
| | | received(e) { |
| | | var res=e.detail.data[0]; |
| | | console.log(res); |
| | | switch(res.action) |
| | | { |
| | | case "back": |
| | | case "back"://返回 |
| | | this.backLast(); |
| | | break; |
| | | case "tbauth": |
| | | case "tbauth"://淘宝授权 |
| | | this.openTbMd(); |
| | | break; |
| | | case "totb": |
| | | this.targetTb(res.tburl); |
| | | break; |
| | | } |
| | | }, |
| | | targetTb(tburl) |
| | | { |
| | | // #ifdef APP-PLUS |
| | | if (plus.runtime.isApplicationExist({ |
| | | pname: 'com.taobao.taobao', |
| | | action: 'taobao://' |
| | | })) { |
| | | const plug = uni.requireNativePlugin('xiguazhu-baichuan') |
| | | plug.detailPage({ |
| | | url: tburl, |
| | | "openType": 0 |
| | | }, result => { |
| | | }); |
| | | } else { |
| | | uni.navigateTo({ |
| | | url:'@/webView/webView?url=' + tburl |
| | | }) |
| | | } |
| | | // #endif |
| | | }, |
| | | backLast() |
| | | { |
| | | console.log("返回") |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, |
| | | closeMdl() { |
| | | this.empowerModel = false |
| | | this.empowerModel = false; |
| | | this.webshow=true; |
| | | }, |
| | | openTbMd() |
| | | { |
| | | this.webshow=false; |
| | | this.empowerModel = true |
| | | }, |
| | | updataUser() { |
| | | var that = this; |
| | | this.$u.api.getUserInfo({}).then(e => { |
| | | utils.setCache('userInfo', e.data.userinfo) |
| | | that.user = e.data.userinfo; |
| | | }).catch(function(err) {}) |
| | | }, |
| | | // 关闭mui返回 |
| | | clearMuiBack() { |
| | | // #ifdef APP-PLUS |