Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

hangb 8 tahun lalu
induk
melakukan
e3bece6999

+ 1 - 1
components/search/GoodList.vue

@@ -230,7 +230,7 @@
       },
       sortBy: function (param) {
         if (param === 'normal1') {
-          this.sorting = {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}
+          this.sorting = {'GO_SEARCH': 'DESC', 'GO_RESERVE': 'DESC'}
           this.activeTag = 'normal1'
         } else if (param === 'normal2') {
           this.sorting = {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}

+ 20 - 3
components/search/ResultTitle.vue

@@ -1,17 +1,34 @@
 <template>
   <div class="result-title text-muted">
-    搜索"<span class="text-inverse" >{{keyword}}</span>",为您找到
-    <span class="text-num" v-text="good_list.total"></span> 个相关产品:
+    搜索"<span class="text-inverse" >{{keyword}}</span>"<span v-if="status != 1">暂无结果</span>
+    <span v-if="status != 3">,为您找到
+    <span class="text-num" v-text="good_list.total"></span> 个<span v-if="status == 2">相关</span>产品</span>:
   </div>
 </template>
 <script>
   export default{
-    props: ['keyword'],
+    props: ['keyword', 'page'],
+    data () {
+      return {
+        status: 1
+      }
+    },
     computed: {
       good_lists () {
         return this.$store.state.searchData.searchList.lists
       },
       good_list () {
+        if (this.page === 1) {
+          if (this.good_lists.data.components && this.good_lists.data.components.length > 0) {
+            if (this.keyword === this.good_lists.data.components[0].code) {
+              this.status = 1
+            } else {
+              this.status = 2
+            }
+          } else {
+            this.status = 3
+          }
+        }
         return this.good_lists.data
       }
     }

+ 1 - 1
pages/search/_keyword.vue

@@ -1,7 +1,7 @@
 <template>
 <div class="container" id="searchResult">
   <detail-brand></detail-brand>
-  <result-title :keyword="key"></result-title>
+  <result-title :keyword="key" :page="nowPage"></result-title>
     <kind @kindFilterEvent="listenKindFilter"
           @brandFilterEvent="listenBrandFilter"
           @typeFilterEvent="listenTypeFilter"