Ver código fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	components/main/count/Item.vue
ouxq 8 anos atrás
pai
commit
a9d81589a1

+ 5 - 13
components/main/count/Box.vue

@@ -23,8 +23,8 @@
           autoplay: 5000,
           speed: 500,
           direction: 'vertical',
-          slidesPerView: 1,
-          slidesPerGroup: 1
+          slidesPerView: 2,
+          slidesPerGroup: 2
         }
       }
     },
@@ -52,19 +52,11 @@
 <style lang="scss" scoped>
   .count-box {
     position: relative;
-    top: 21px;
+    top: 15px;
     float: right;
-    width: 210px;
-    height: 40px;
-    margin-right: 60px;
+    width: 300px;
+    height: 60px;
     overflow: hidden;
-    border-radius: 3px;
-    background: #83c5f8;
-  .swiper-slide{
-    width: 100%;
-    /*background: #83c5f8;*/
-    border-radius: 3px;
-  }
 
   .swiper-container {
     height: 100%;

+ 11 - 73
components/main/count/Item.vue

@@ -1,13 +1,7 @@
 <template>
   <div class="count-item">
     <span class="title">{{ title }}</span>
-    <div class="count-content">
-      <span v-for="num in nums" :class="num == ',' ? 'separator' : num == 0 ? 'zero num' : 'num'">{{ num }}</span>
-     <!-- <span v-if="nums.length < 7">个</span>
-      <span v-if="nums.length > 7">万</span>-->
-      <span v-text="isMore?'万':'个'" v-if="!isShow"></span>
-      <span v-if="isShow">亿</span>
-    </div>
+    <span v-for="num in nums" :class="num == ',' ? 'separator' : 'num'">{{ num }}</span>
   </div>
 </template>
 <script>
@@ -22,38 +16,14 @@
         type: String
       }
     },
-    data () {
-      return {
-        isMore: false,
-        isShow: false
-      }
-    },
     methods: {
       formatNumber (num) {
         let re = /(\d+)(\d{3})/
-        if (num > 99999999) {
-          this.isShow = true
-          let str2 = num.toString()
-          num = Math.floor(num / 100000000)
-          if (parseInt(str2.charAt(str2.length - 8)) > 8) {
-            num = num + 1
-          }
-        }
-        if (num > 9999) {
-          this.isMore = true
-          let str = num.toString()
-          num = Math.floor(num / 10000)
-          if (parseInt(str.charAt(str.length - 4)) > 4) {
-            num = num + 1
-          }
-        }
-        num = (Array(7 - String(num).length).join(0) + num)
+        num = (Array(10 - String(num).length).join(0) + num)
         while (re.test(num)) {
-          num = num.replace(re, '$1$2')
+          num = num.replace(re, '$1,$2')
         }
-        num = num.split('')
-//        console.log(num)
-        return num
+        return num.split('')
       }
     },
     computed: {
@@ -72,58 +42,26 @@
 
     .title {
       display: inline-block;
-      width: 58px;
+      width: 60px;
       float: left;
       font-weight: bold;
-      line-height: 40px;
-      color: #fff;
-      font-size: 14px;
     }
     .separator, .num {
       display: inline-block;
     }
     .separator {
       font-size: 12px;
-      color: #6cb7f3;
-      line-height: 38px !important;
-      margin: 0 5px 0 -5px;
-      width: 3px;
-    }
-    .count-content{
-      width: 145px;
-      background: #fff;
-      float: right;
-      height: 30px;
-      margin-top: 5px;
-      margin-right: 5px;
-      span{
-        float: left;
-        line-height: 24px;
-        font-weight: bold;
-      }
-      span.zero{
-        color: #bbdffb;
-      }
-      span:first-child{
-        margin-left: 3px;
-      }
-      span:last-child{
-        line-height: 30px;
-        color: #6cb7f3;
-        margin-left: 2px;
-      }
+      color: $primary;
+      margin: 0 5px 0 -2px;
     }
     .num {
-      background: #9dd0f9;
-      width: 18px;
-      height: 24px;
-      margin-right: 2px;
-      line-height: 24px;
+      background: $primary;
+      width: 15px;
+      height: 20px;
+      margin-right: 10px;
       text-align: center;
       color: $white;
       font-weight: bold;
-      border-radius: 2px;
-      margin-top: 3px;
     }
   }
 </style>

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

@@ -86,6 +86,7 @@
       },
       async pageCmpGoods (params) {
 //      pageCmpGoods (params) {
+        params.filter.brandid = this.brand.id
         let { data } = await this.$http.get('/api/product/component/list', { params })
         this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
 //        this.$http.get('/api/product/component/list', { params }).then(response => {

+ 23 - 9
pages/help/home.vue

@@ -31,13 +31,25 @@
   </div>
 </template>
 <script>
-  // 升序
-  function compare (property) {
-    return function (a, b) {
-      var value1 = a[property]
-      var value2 = b[property]
-      return value1 - value2
+//   升序
+//  function compare (property) {
+//    return function (a, b) {
+//      var value1 = a[property]
+//      var value2 = b[property]
+//      return value1 - value2
+//    }
+//  }
+  function sortBy (arr, property) {
+    for (let i = 0; i < arr.length; i++) {
+      for (let j = i; j < arr.length; j++) {
+        if (arr[i][property] > arr[j][property]) {
+          let tmp = arr[i]
+          arr[i] = arr[j]
+          arr[j] = tmp
+        }
+      }
     }
+    return arr
   }
   import { left, helpHeader } from '~components/help'
   export default {
@@ -53,10 +65,12 @@
     },
     computed: {
       helpNav () {
-        let list = this.$store.state.help.snapsho.data.sort(compare('detno'))
-        if (list) {
+        let list = this.$store.state.help.snapsho.data || []
+        if (list.length > 0) {
+          list = sortBy(list, 'detno')
           for (let i = 0; i < list.length; i++) {
-            list[i].children = list[i].children.sort(compare('detno'))
+            let tem = sortBy(list[i].children, 'detno')
+            list[i].children = tem
           }
         }
         return list

+ 0 - 2
run.sh

@@ -4,9 +4,7 @@ echo "NODE_ENV: $NODE_ENV"
 echo "BASE_URL: $BASE_URL"
 
 if [ "$NODE_ENV" == 'production' ]; then
-  npm run build
   npm run start
 else
-  npm run dev-build
   npm run dev-start
 fi