Browse Source

产品详情页规格书判断,及定时计数器注释

yangc 8 years ago
parent
commit
fbf526d288
2 changed files with 20 additions and 9 deletions
  1. 8 8
      components/main/count/Box.vue
  2. 12 1
      components/store/CommodityInfo.vue

+ 8 - 8
components/main/count/Box.vue

@@ -33,14 +33,14 @@
         return this.$store.state.product.common.counts
       }
     },
-    mounted () {
-      this.$nextTick(() => {
-        // 刷新统计信息
-        setInterval(() => {
-          this.loadCounts()
-        }, 30000)
-      })
-    },
+//    mounted () {
+//      this.$nextTick(() => {
+//        // 刷新统计信息
+//        setInterval(() => {
+//          this.loadCounts()
+//        }, 30000)
+//      })
+//    },
     methods: {
       loadCounts () {
         this.$store.dispatch('loadProductCounts', { _status: 'actived' })

+ 12 - 1
components/store/CommodityInfo.vue

@@ -37,7 +37,7 @@
               <span class="name">类&nbsp;目</span>:<span v-text="commodity.kindNameCn"></span>
             </div>
             <div class="com-info">
-              <span class="name">下&nbsp;载</span>:<a target="_blank" :href="component.attach">{{component.attach ? '规格书' : '暂无信息'}}</a>
+              <span class="name">下&nbsp;载</span>:<a @click="toAttach(component.attach)" v-if="component.attach">规格书</a><span v-if="!component.attach">暂无信息</span>
             </div>
             <div class="com-info">
               <span class="name">包&nbsp;装</span>:<span v-text="commodity.packaging || '无包装信息'"></span>
@@ -456,6 +456,17 @@ export default {
         }
         return encryptStr
       }
+    },
+    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)
+      }
     }
   }
 }