zhaojs
2023-07-06 cf1973556ff35a0798436aa63d90f2cc8a2f53ba
uniapp/pages/rankinglist/common_act.vue
@@ -1,16 +1,24 @@
<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>
    import empowerModel from '../../components/empowerModel.vue'
   var wv;
   export default {
      components: {
        empowerModel
      },
      data() {
         return {
            webshow:true,
            empowerModel: false,
            webviewUrl: '',
            user:'',
@@ -32,7 +40,6 @@
             this.user = value;
            if(options.t_url)
            {
               console.log(encodeURI(decodeURIComponent(options.t_url)+"?token="+value.token+"&userid="+value.id));
               this.webviewUrl = encodeURI(decodeURIComponent(options.t_url)+"?token="+value.token+"&userid="+value.id);
            }
         }
@@ -46,17 +53,63 @@
         
         received(e) {
            var res=e.detail.data[0];
             if(res.action=='back')
            console.log(res);
            switch(res.action)
            {
               this.backLast();
               case "back"://返回
                  this.backLast();
                  break;
               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.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