huanggang 7 年 前
コミット
bf69ccd80c

+ 4 - 0
pages/components/blockItem/blockItem.js

@@ -13,6 +13,10 @@ Component({
     special_datas:{
       type:Object,
       value:{}
+    },
+    block_type:{
+      type:String,
+      value:""
     } 
   },
 

+ 5 - 1
pages/components/blockItem/blockItem.wxml

@@ -1,5 +1,5 @@
 <block wx:if="{{item_data.show_type == 'image' || item_data.type == 'image'}}">
-  <image bindtap="navigator" data-title="{{item_data.title}}" data-target="{{item_data.data}}" data-type="{{item_data.type}}" mode="scaleToFill" src="{{item_data.image}}" style="width:{{(item_data.width/1080*750)+'rpx'}}; height:{{(item_data.height/1080*750)+'rpx'}}" lazy-load="true" class='{{imgShow? "show" : "hide"}}' bindload='load'></image>
+  <image bindtap="navigator" data-title="{{item_data.title}}" data-target="{{item_data.data}}" data-type="{{item_data.type}}" mode="{{block_type == 'home3'?'scaleToFill':'widthFix'}}" src="{{item_data.image}}" style="width:{{block_type == 'home3'?(item_data.width/1080*750)+'rpx':''}}; height:{{block_type == 'home3'?(item_data.height/1080*750)+'rpx':''}};flex:1;" lazy-load="true" class='{{imgShow? "show" : "hide"}}' bindload='load'></image>
 </block>
 
 <block wx:elif="{{item_data.show_type == 'brand'|| item_data.type == 'brand'}}">
@@ -33,4 +33,8 @@
         </view>
       </view>
     </view>
+</block>
+
+<block wx:elif="{{item_data.show_type == 'video'|| item_data.type == 'video'}}">
+   <video id="myVideo" src="{{item_data.data}}" style="width:100%;height:{{(item_data.height/1080*750)+'rpx'}}"  controls></video>
 </block>

+ 1 - 1
pages/components/blockList/blockList.wxml

@@ -5,7 +5,7 @@
     <homeOne wx:if="{{item.item_type == 'home1'}}" special_datas="{{special_datas}}"  items="{{item.items}}" summery="{{summery}}"></homeOne>
     <homeOne wx:if="{{item.item_type == 'home5'}}" items="{{item.items}}"></homeOne>
     <homeTwo wx:if="{{item.item_type == 'home2'}}" items="{{item.items}}"></homeTwo>
-    <horizon wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" items="{{item.items}}"></horizon>
+    <horizon wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" specialData="{{item}}" items="{{item.items}}"></horizon>
     <home_goods wx:if="{{item.item_type == 'home_goods'}}" specialData="{{item.item_title}}" summery="{{summery}}" goods_items="{{item.items}}"></home_goods>
     <homeGrid wx:if="{{item.item_type == 'home_grid'}}" items="{{item.items}}"></homeGrid>
     <homeWords wx:if="{{item.item_type == 'homewords'}}" specialData="{{item.item_title}}" items="{{item.items}}"></homeWords>    

+ 1 - 1
pages/components/blocks/carousel/carousel.wxml

@@ -2,7 +2,7 @@
 <swiper autoplay indicator-dots style="height:{{(750 / scale)+'rpx'}}">
   <block wx:key="item" wx:for="{{image_list}}">
     <swiper-item>
-        <blockItem item_data="{{item}}"></blockItem>   
+        <blockItem block_type="adv_list" item_data="{{item}}"></blockItem>   
     </swiper-item>
   </block> 
 </swiper> 

+ 1 - 1
pages/components/blocks/goods_item/goods_item.js

@@ -19,7 +19,7 @@ Component({
     let getSummeryGoods = proxy.getSummeryGoods(goods_id, summery);
     this.setData({
         goods: getSummeryGoods
-    }) 
+    })
   },
 
   /**

+ 2 - 1
pages/components/blocks/goods_item/goods_item.wxml

@@ -2,6 +2,7 @@
 <navigator url="/pages/details/details?goods_id={{goods.goods_id}}" hover-class="navigator-hover"> 
   <view class='goods_thumbnail'>
       <image class='img'  mode='scaleToFill' src="{{goods.goods_image_url}}"></image>
+      <view class='opgoods' wx:if="{{goods.is_opgoods}}">{{goods.opgoods_shortdesc}}</view>
   </view>
   <view class='goods_box'>
     <view class="goods_msg">
@@ -18,7 +19,7 @@
       </view>
       <view class='deduction'>
         <view class="original_price">天猫价{{goods.goods_price}}</view>
-        <text class="discount">红包抵{{(((goods.goods_price)*100 - (goods.bonus_price)*100))/100}}元</text>
+        <text class="discount">红包抵{{(((goods.goods_price)*1000 - (goods.bonus_price)*1000))/1000}}元</text>
       </view>
     </view>
     <view class="goods_price" wx:if="{{goods.act_type == 1}}">

+ 41 - 16
pages/components/blocks/goods_item/goods_item.wxss

@@ -1,45 +1,54 @@
 .goods_item {
-   background: #fff;
-   font-size: 22rpx;
-   width: 368rpx;
-   overflow: hidden;
-   margin-top: 6rpx;
-   margin-left: 6rpx;
+  background: #fff;
+  font-size: 22rpx;
+  width: 368rpx;
+  overflow: hidden;
+  margin-top: 6rpx;
+  margin-left: 6rpx;
 }
+
 .goods_item .img {
   width: 367rpx;
   height: 367rpx;
 }
+
 .goods_item .goods_name {
   color: #4a4a4a;
   overflow: hidden;
-  text-overflow:ellipsis;
+  text-overflow: ellipsis;
   white-space: nowrap;
 }
+
 .goods_item .goods_desc {
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-    -webkit-line-clamp: 2;
-    overflow: hidden;
-    color: #7e7e7e;
-    min-height: 64rpx;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 2;
+  overflow: hidden;
+  color: #7e7e7e;
+  min-height: 64rpx;
 }
+
 .goods_item .goods_box {
   padding: 12rpx;
 }
+
 .goods_item .goods_thumbnail {
   border-bottom: 1rpx solid #f9f9f9;
+  position: relative;
 }
+
 .goods_item .current_price {
   font-size: 28rpx;
   color: #ff4e4e;
 }
-.goods_item .original_price,.goods_item .discount {
+
+.goods_item .original_price, .goods_item .discount {
   display: inline-block;
   position: relative;
   font-size: 18rpx;
-  color:#7e7e7e;
+  color: #7e7e7e;
 }
+
 .goods_item .original_price::after {
   content: "";
   position: absolute;
@@ -50,12 +59,28 @@
   background: #7e7e7e;
   z-index: 5;
 }
+
 .goods_item .discount {
   float: right;
 }
+
 .goods_item .original_price {
   float: left;
 }
+
 .goods_item .deduction {
   overflow: hidden;
-}
+}
+
+.opgoods {
+  position: absolute;
+  bottom: 60rpx;
+  left: 0;
+  padding: 0 14rpx;
+  color: #fff;
+  font-size: 20rpx;
+  text-align: center;
+  background: #feacaa;
+  border-bottom-right-radius: 20rpx;
+  border-top-right-radius: 20rpx;
+}

+ 1 - 1
pages/components/blocks/home1/homeOne.wxml

@@ -1,5 +1,5 @@
 <!--components/blocks/home1/home_one.wxml-->
-<view style="overflow:hidden;height:{{(items[0].height/1080*750)+'rpx'}}">
+<view>
   <block wx:key="{{item}}" wx:for="{{items}}">
       <blockItem special_datas="{{special_datas}}" summery="{{summery}}" item_data="{{item}}"></blockItem>  
   </block>

+ 16 - 1
pages/components/blocks/home3/homeThree.js

@@ -12,11 +12,26 @@ Component({
     }
   },
 
+
+  attached(){
+    let has_margin = this.properties.specialData.has_margin;
+    let sub_items_length = this.properties.specialData.items.length;
+    let firstSubWidth = this.properties.specialData.items[0].width;
+    if (has_margin){
+      let scale = (1080 - (sub_items_length * firstSubWidth)) / (sub_items_length + 1);
+      let padding = Math.ceil(((750 / 1080) * scale)) + 'rpx';
+      this.setData({
+        has_margin: has_margin,
+        padding:padding
+      });
+    }
+  },
   /**
    * 组件的初始数据
    */
   data: {
-
+    has_margin:false,
+    padding:''
   },
 
   /**

+ 2 - 2
pages/components/blocks/home3/homeThree.wxml

@@ -1,6 +1,6 @@
 <!--components/blocks/home3/home3.wxml-->
- <view class="home_three_item" style="height:{{(items[0].height/1080*750)+'rpx'}};background-image:url('{{specialData.bg_data?specialData.bg_data:''}}');background-size:100% 100%;"> 
+ <view class="home_three_item" style="height:{{(items[0].height/1080*750)+'rpx'}};background-image:url('{{specialData.bg_data?specialData.bg_data:''}}');background-size:100% 100%;padding-left:{{has_margin?padding:0}};padding-right:{{has_margin?padding:0}};"> 
     <block wx:key="{{item}}" wx:for="{{items}}">
-      <blockItem item_data="{{item}}"></blockItem>
+      <blockItem block_type="home3" item_data="{{item}}"></blockItem>
     </block>
  </view> 

+ 5 - 1
pages/components/blocks/home3/homeThree.wxss

@@ -1 +1,5 @@
-/* pages/components/blocks/home3/home3.wxss */
+/* pages/components/blocks/home3/home3.wxss */
+.home_three_item {
+  display: flex;
+  justify-content:space-between;
+}

+ 19 - 1
pages/components/blocks/horizon/horizon.js

@@ -6,6 +6,23 @@ Component({
   properties: {
     items: {
       type: Array
+    },
+    specialData: {
+      type: Object
+    }
+  },
+
+  attached() {
+    let has_margin = this.properties.specialData.has_margin;
+    let sub_items_length = this.properties.specialData.items.length;
+    let firstSubWidth = this.properties.specialData.items[0].width;
+    if (has_margin) {
+      let scale = (1080 - (sub_items_length * firstSubWidth)) / (sub_items_length + 1);
+      let padding = Math.ceil(((750 / 1080) * scale)) + 'rpx';
+      this.setData({
+        has_margin: has_margin,
+        padding: padding
+      });
     }
   },
 
@@ -13,7 +30,8 @@ Component({
    * 组件的初始数据
    */
   data: {
-
+    has_margin: false,
+    padding: ''
   },
 
   /**

+ 2 - 2
pages/components/blocks/horizon/horizon.wxml

@@ -1,5 +1,5 @@
-<view>
-    <scroll-view scroll-x="true" style="white-space: nowrap;">
+<view style="background-image:url('{{specialData.bg_data?specialData.bg_data:''}}');background-size:100% 100%;">
+    <scroll-view scroll-x="true" style="white-space: nowrap; display: flex;justify-content:space-between;">
         <block wx:key="{{item}}" wx:for="{{items}}">
             <view style="display:inline-block;width:{{(item.width/1080*750)+'rpx'}}; height:{{(item.height/1080*750)+'rpx'}}">
               <blockItem item_data="{{item}}"></blockItem>

+ 1 - 0
pages/index/index.js

@@ -42,6 +42,7 @@ Page({
       page: 10,
       curpage: 1
     }, function (res) {
+      console.log(res);
       if (res.code == 200) {
         self.setData({
           special_datas: res.datas,

+ 2 - 1
pages/special/special.json

@@ -1,5 +1,6 @@
 {
   "usingComponents": {
     "blockList": "../components/blockList/blockList"
-  }
+  },
+  "navigationBarTitleText": "专题"
 }