Jelajahi Sumber

品牌中心规格书跳转判断

yangc 8 tahun lalu
induk
melakukan
7dd9a25b1c
1 mengubah file dengan 12 tambahan dan 1 penghapusan
  1. 12 1
      components/product/brand/BrandComponent.vue

+ 12 - 1
components/product/brand/BrandComponent.vue

@@ -19,7 +19,7 @@
       <tbody>
         <tr class="text-center" v-for="item in list.content">
           <td><a :href="'/product/component/' + item.uuid"><span>{{item.code}}</span></a></td>
-          <td><a :href="item.attach" target="_blank"><button class="btn btn-default"  :disabled="!item.attach" :class="{'disabledbtn':!item.attach}">Datasheet手册</button></a></td>
+          <td><a @click="toAttach(item.attach)"><button class="btn btn-default"  :disabled="!item.attach" :class="{'disabledbtn':!item.attach}">Datasheet手册</button></a></td>
           <td>
             <button class="btn btn-default disabledbtn" :disabled="true">申请样片</button>
           </td>
@@ -97,6 +97,17 @@
         this.pageParams.page = page
         this.pageParams.filter.brandid = this.brand.id
         this.pageCmpGoods(this.pageParams)
+      },
+      toAttach: function (url) {
+        if (url === '1') {
+          this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
+            if (response.data) {
+              window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
+            }
+          })
+        } else {
+          window.open(url)
+        }
       }
     }
   }