瀏覽代碼

店铺关注

ouxq 8 年之前
父節點
當前提交
76a7f87f0f
共有 3 個文件被更改,包括 17 次插入4 次删除
  1. 7 3
      components/store/common/StoreHeader.vue
  2. 6 1
      pages/store/_uuid/index.vue
  3. 4 0
      store/shop.js

+ 7 - 3
components/store/common/StoreHeader.vue

@@ -15,8 +15,8 @@
                 </div>
                 <div class="icon-style">
                   <!--<button class="btn btn-xs btn-danger btn-nav" v-if="!isFocus"><span class="watch">关注</span></button>-->
-                  <div v-if="!isFocus"></div><el-button type="text" @click="dialogVisible = true,focus(storeInfo.id, storeInfo.storeName)" class="btn btn-xs btn-danger btn-nav"><span class="watch">关注</span></el-button>
-                  <div v-if="isFocus" ><button class="btn btn-xs btn-default btn-nav" style="width:50px"><span>已关注</span></button></div>
+                  <span v-if="!isFocus"><el-button type="text" @click="dialogVisible = true,focus(storeInfo.id, storeInfo.storeName)" class="btn btn-xs btn-danger btn-nav"><span class="watch">关注</span></el-button></span>
+                  <span v-if="isFocus" ><button class="btn btn-xs btn-default btn-nav" style="width:50px"><span>已关注</span></button></span>
                   <span v-if="storeInfo.type == 'ORIGINAL_FACTORY'">&nbsp;<img src="/images/store/icon/icon-factory.png"/></span>
                   <span v-else-if="storeInfo.type == 'AGENCY'">&nbsp;<img src="/images/store/icon/icon-agent.png"/></span>
                   <span v-else-if="storeInfo.type == 'DISTRIBUTION'">&nbsp;<img src="/images/store/icon/icon-distribution.png"/></span>
@@ -72,7 +72,6 @@ export default {
   name: 'store-header',
   data () {
     return {
-      isFocus: false,
       isOpen: false,
       dialogVisible: false
     }
@@ -83,6 +82,10 @@ export default {
   computed: {
     storeInfo () {
       return this.$store.state.shop.storeInfo.store.data
+    },
+    isFocus () {
+      const foucusList = this.$store.state.shop.storeInfo.focusList.data
+      return foucusList === 'true'
     }
   },
   mounted () {
@@ -102,6 +105,7 @@ export default {
     },
     focus (id, name) {
       this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
+      this.isFocus = true
     }
   }
 }

+ 6 - 1
pages/store/_uuid/index.vue

@@ -33,5 +33,10 @@ export default {
 }
 </script>
 <style>
-
+  #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
+    width: 320px !important;
+  }
+  #nav_fragment .el-dialog__wrapper .el-dialog__body{
+    padding: 14px !important;
+  }
 </style>

+ 4 - 0
store/shop.js

@@ -75,6 +75,10 @@ export const actions = {
     return axios.post(`/trade/storeFocus/save`, storeName)
       .then(response => {
         commit('storeInfo/GET_FOCUS_SUCCESS', response.data)
+        console.log(response.data)
+        if (response.data === 'success') {
+          commit('storeInfo/GET_FOCUSLIST_SUCCESS', 'true')
+        }
       }, err => {
         commit('storeInfo/GET_FOCUS_FAILURE', err)
       })