yangc 8 년 전
부모
커밋
b27ba53c03
4개의 변경된 파일55개의 추가작업 그리고 78개의 파일을 삭제
  1. 3 3
      components/home/floor/Floor.vue
  2. 25 38
      components/home/floor/FloorList.vue
  3. 26 36
      pages/index.vue
  4. 1 1
      store/index.js

+ 3 - 3
components/home/floor/Floor.vue

@@ -10,7 +10,7 @@
           <div class="floor-content">
             <p v-if="item.name" class="floor-item-name">{{ item.name }}</p>
             <p v-if="item.body" v-html="item.body" class="floor-item-body"></p>
-            <p class="floor-item-price">{{item.currency == 'RMB' ? '¥' : '$'}}&nbsp;{{item.price}}</p>
+            <p class="floor-item-price" v-if="item.size != 'large' && isDefault">{{item.currency == 'RMB' ? '¥' : '$'}}&nbsp;{{item.price}}</p>
           </div>
         </a>
       </li>
@@ -105,7 +105,7 @@
             bottom: 50px;
             right: 52px;
             width: 100px;
-            height: 100px;
+            height: 90px;
           }
         }
 
@@ -118,7 +118,7 @@
 
         .floor-item-name {
           color: #575757;
-          font-size: 24px;
+          font-size: 20px;
           margin-bottom: 30px;
           text-align: left;
           font-weight: 600;

+ 25 - 38
components/home/floor/FloorList.vue

@@ -6,6 +6,7 @@
       <floor :floor="defaultFloors[1]" :isDefault="true"></floor>
       <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
     </div>
+    <span v-text="expandFloors"></span>
   </div>
 </template>
 <script>
@@ -45,54 +46,40 @@
         ]
       }
     },
-//    mounted () {
-//      this.$http.get('/api/floors/home')
-//        .then(response => {
-//          this.floors = response
-//        })
-//    }
     computed: {
       floors () {
         return this.$store.state.floor.list
-      }
-    },
-    created () {
-      let arr = []
-      this.$http.post('api/commodity/detail', arr).then(response => {
-        let data = response.data
-//        {
-//          backGroundColor: '',
-//            body: 'Rohm<br>晶体管',
-//          hrefUrl: 'https://www.usoftmall.com/store/33069557578d44e69bd91ad12d28a8d4/BT2018012500000141',
-//          name: 'RHU002N06T106',
-//          pictureUrl: '/images/floor/RHU002N06T106.png',
-//          size: 'medium',
-//          price: 1.111111,
-//          currency: 'RMB'
-//        }
-        let obj = {
-          backGroundColor: '',
-          body: '',
-          hrefUrl: '',
-          name: '',
-          pictureUrl: '',
-          size: '',
-          price: '',
-          currency: 'RMB'
-        }
+      },
+      isProd () {
+        return this.$store.state.option.url === 'http://www.usoftmall.com'
+      },
+      expandFloors () {
+        let data = this.$store.state.floor.list_expand.data
+        let _this = this
         for (let i = 0; i < data.length; i++) {
+          let obj = {
+            backGroundColor: '',
+            body: '',
+            hrefUrl: '',
+            name: '',
+            pictureUrl: '',
+            size: '',
+            price: '',
+            currency: 'RMB'
+          }
           if (data[i]) {
             obj.name = data[i].code
-            obj.body = data[i].brandNameEn + '<br/>' + data[i].kindNameCn
-            obj.hrefUrl = 'https://www.usoftmall.com/store/productDetail/' + data[i].batchCode
-            obj.pictureUrl = '/images/floor/' + data[i].code + '.png'
+            obj.body = data[i].brandNameEn + '<br/>' + (data[i].kindNameCn || '其他')
+            obj.hrefUrl = '/store/productDetail/' + data[i].batchCode
+            obj.pictureUrl = '/images/floor/' + (this.isProd ? data[i].code : '2SD2704KT146') + '.png'
             obj.size = i % 3 === 0 ? 'medium' : 'small'
             obj.currency = data[i].currencyName
-            obj.price = this.getMinPrice(data[i].prices, data[i].currencyName)
-            this.defaultFloors.items[i < 6 ? 0 : 1].append(obj)
+            obj.price = _this.getMinPrice(data[i].prices, data[i].currencyName)
+            _this.defaultFloors[i < 6 ? 0 : 1].items.push(obj)
           }
         }
-      })
+        return data
+      }
     },
     methods: {
       getMinPrice: function (prices, currency) {

+ 26 - 36
pages/index.vue

@@ -74,44 +74,34 @@
         store.dispatch('loadBanners', {type: 'home'}),
         store.dispatch('loadProductKinds', { id: 0 }),
         store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 }),
-        store.dispatch('loadBatchCommodities', this.defaultFloorsData)
+        store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
+          'BT2018012500000141',
+          'BT2018012500000126',
+          'BT2018012500000131',
+          'BT2018012500000152',
+          'BT2018012500000124',
+          'BT2018012500000164',
+          'BT2018012500000167',
+          'BT2018012500000145',
+          'BT2018012500000151',
+          'BT2018012500000161',
+          'BT2018012500000149',
+          'BT2018012500000162'] : [
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056',
+            'BT2018012900002056']
+        })
       ]) : []
     },
-    mounted () {
-      let user = this.user.logged
-      let count = 1
-      let self = this
-      const nowDate = new Date()
-      const activeStartDate = new Date('2017/12/20 00:00:00')
-      const activeEndDate = new Date('2018/1/2 00:00:00')
-      const EndDate = new Date('2017/12/26 00:00:00')
-      this.hasNewYear = nowDate > EndDate
-      if (nowDate > activeStartDate && nowDate < activeEndDate) {
-        const endTime = window.localStorage.getItem('endTime')
-        if (!user) {
-          setInterval(function () {
-            count++
-            if (count >= 60 * 60 * 2) {
-              count = 1
-              self.isOpen = true
-            }
-          }, 1000)
-        }
-        if (endTime) {
-          if (nowDate.getTime() - endTime >= 1000 * 60 * 60 * 2) {
-            user ? this.isOpen = false : this.isOpen = true
-            window.localStorage.setItem('endTime', nowDate.getTime())
-          } else {
-            this.isOpen = false
-          }
-        } else {
-          user ? this.isOpen = false : this.isOpen = true
-          window.localStorage.setItem('endTime', nowDate.getTime())
-        }
-      } else {
-        this.isOpen = false
-      }
-    },
     computed: {
       user () {
         return this.$store.state.option.user

+ 1 - 1
store/index.js

@@ -77,7 +77,7 @@ export const actions = {
   // 批量获取产品信息
   loadBatchCommodities ({ commit }, params = {}) {
     commit('floor/REQUEST_EXPANDLIST')
-    return axios.get('/api/commodity/detail', params)
+    return axios.post('/api/commodity/detail', params.batchCodeList)
       .then(response => {
         commit('floor/GET_EXPANDLIST_SUCCESS', response.data)
       }, err => {