| | |
| | | <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> |
| | | </u-popup> |
| | | </view> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | var wv |
| | | import empowerModel from '../../components/empowerModel.vue' |
| | | var wv; |
| | | export default { |
| | | components: { |
| | | empowerModel |
| | | }, |
| | | data() { |
| | | return { |
| | | webshow:true, |
| | | empowerModel: false, |
| | | webviewUrl: '', |
| | | user:'', |
| | | webviewStyles: { |
| | | progress: { |
| | | color: '#EE1B14' |
| | |
| | | } |
| | | else{ |
| | | const value = uni.getStorageSync('userInfo'); |
| | | console.log(value); |
| | | this.user = value; |
| | | if(options.t_url) |
| | | { |
| | | this.webviewUrl = encodeURI(decodeURIComponent(options.t_url)+"?token="+value.token+"&userid="+value.id); |
| | |
| | | onReady() { |
| | | this.clearMuiBack(); |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | received(e) { |
| | | console.log(e); |
| | | var res=e.detail.data[0]; |
| | | if(res.action=='target_tb') |
| | | console.log(res); |
| | | switch(res.action) |
| | | { |
| | | this.getTbsrc(res.data.goodsId); |
| | | case "back": |
| | | this.backLast(); |
| | | break; |
| | | case "tbauth": |
| | | this.openTbMd(); |
| | | break; |
| | | } |
| | | }, |
| | | //跳转淘宝 |
| | | getTbsrc(goodsid) { |
| | | backLast() |
| | | { |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, |
| | | closeMdl() { |
| | | this.empowerModel = false; |
| | | this.webshow=true; |
| | | }, |
| | | openTbMd() |
| | | { |
| | | this.webshow=false; |
| | | this.empowerModel = true |
| | | }, |
| | | updataUser() { |
| | | var that = this; |
| | | this.$u.api.getPrivilegeLink({ |
| | | goodsId: goodsid, |
| | | type: 0 |
| | | }).then(e => { |
| | | console.log(e); |
| | | if (e.code != 0) return that.$alert(e.msg) |
| | | var res = e.data.info; |
| | | var tburl = res.shortUrl |
| | | // #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 => { |
| | | // console.log(result); |
| | | }); |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: '../webView/webView?url=' + tburl |
| | | }) |
| | | } |
| | | // #endif |
| | | this.$u.api.getUserInfo({}).then(e => { |
| | | utils.setCache('userInfo', e.data.userinfo) |
| | | that.user = e.data.userinfo; |
| | | }).catch(function(err) {}) |
| | | }, |
| | | // 关闭mui返回 |