Commit d1e7586b7d5245a77d1b8e386abb79f1865b4b8f

Authored by 王强
1 parent 77790617

购好物,首页对接接口完成~

src/components/swiper/swiper.less
@@ -21,11 +21,14 @@ @@ -21,11 +21,14 @@
21 border-radius: 16px; 21 border-radius: 16px;
22 overflow: hidden; 22 overflow: hidden;
23 .img-box { 23 .img-box {
  24 + width: 100%;
  25 + height: auto;
24 .img { 26 .img {
25 display: block; 27 display: block;
26 width: 100%; 28 width: 100%;
27 height: auto; 29 height: auto;
28 border-radius: 16px; 30 border-radius: 16px;
  31 + object-fit: cover;
29 overflow: hidden; 32 overflow: hidden;
30 } 33 }
31 } 34 }
src/components/swiper/swiper.vue
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 <swipe-item class="swipe-item" v-for="(item, index) in swipers" :key="index"> 4 <swipe-item class="swipe-item" v-for="(item, index) in swipers" :key="index">
5 <div class="item" @click="$parent.$parent.gotoDetail(item)"> 5 <div class="item" @click="$parent.$parent.gotoDetail(item)">
6 <div class="img-box"> 6 <div class="img-box">
7 - <img v-if="isPointsMall" v-lazy="item + SIGN.BIG" class="img" mode="widthFix" />  
8 - <img v-else v-lazy="item.simg + SIGN.BIG" class="img" mode="widthFix" /> 7 + <img v-if="isPointsMall" v-lazy="item + SIGN.BIG" class="img" />
  8 + <img v-else v-lazy="item.simg + SIGN.BIG" class="img" />
9 </div> 9 </div>
10 </div> 10 </div>
11 11
src/pages/optimization2/optimization2.less
@@ -41,7 +41,16 @@ @@ -41,7 +41,16 @@
41 border-radius: 24px; 41 border-radius: 24px;
42 overflow: hidden; 42 overflow: hidden;
43 &.banner-box { 43 &.banner-box {
44 - 44 + .swiper-box {
  45 + width: 710px;
  46 + height: 280px;
  47 + /deep/ .swipe {
  48 + width: 710px;
  49 + .swipe-item {
  50 + width: 710px;
  51 + }
  52 + }
  53 + }
45 } 54 }
46 &.page-list { 55 &.page-list {
47 background-color: transparent; 56 background-color: transparent;
@@ -104,11 +113,12 @@ @@ -104,11 +113,12 @@
104 } 113 }
105 &.sub-banner-box { 114 &.sub-banner-box {
106 // width: 100%; 115 // width: 100%;
107 - height: auto; 116 + height: 160px;
108 .sub-banner-img { 117 .sub-banner-img {
109 display: block; 118 display: block;
110 width: 100%; 119 width: 100%;
111 - height: auto; 120 + height: 100%;
  121 + object-fit: cover;
112 } 122 }
113 } 123 }
114 &.goods-list { 124 &.goods-list {
src/pages/optimization2/optimization2.vue
@@ -447,65 +447,6 @@ @@ -447,65 +447,6 @@
447 moreText: '查看更多', 447 moreText: '查看更多',
448 icon: 'static/img/icon_more_arrow_right.png' 448 icon: 'static/img/icon_more_arrow_right.png'
449 }); 449 });
450 -  
451 -  
452 -  
453 -  
454 -  
455 -  
456 -  
457 - // 临时,主banner数据  
458 - this.$set(this, 'swipers', [  
459 - {  
460 - simg: 'http://wjjtest.ys2.cnliveimg.com/802/shop/img/2021/02/02/image1612245250790582774.jpg?imageMogr2/thumbnail/200/format/jpg'  
461 - },  
462 - {  
463 - simg: 'http://wjjseller.cnlive.com/uploads/780f7a0d12e152d5e35b3fff29bab5d2.jpg?imageMogr2/thumbnail/200/format/jpg'  
464 - },  
465 - {  
466 - simg: 'https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/12/13/5df26e0504e2f.jpg?imageMogr2/thumbnail/200/format/jpg'  
467 - }  
468 - ]);  
469 -  
470 -  
471 -  
472 -  
473 - // 临时,其它频道列表数据  
474 - this.$set(this, 'swiperNavs', [  
475 - [  
476 - {  
477 - logo: 'http://wjjtest.ys2.cnliveimg.com/802/shop/img/2020/05/14/image1589436270199176498.jpg',  
478 - title: '网家家自营'  
479 - },  
480 - {  
481 - simg: 'http://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/01/04/5c2f1d6094223.jpg',  
482 - title: '环球优物'  
483 - },  
484 - {  
485 - logo: 'https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/20/5cbab33c82a82.png',  
486 - title: '李宁旗舰店'  
487 - },  
488 - {  
489 - simg: 'https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/28/5cc53a6e07e67.jpg',  
490 - title: '扶贫精品'  
491 - }  
492 - ]  
493 - ]);  
494 -  
495 -  
496 -  
497 -  
498 -  
499 -  
500 - // 临时,副Banner  
501 - this.$set(this, 'subBanner', {  
502 - simg: 'https://img13.360buyimg.com/cms/jfs/t1/134990/3/16382/148271/5fb61708E49ceefbd/9356c854f878dbc0.jpg?imageMogr2/thumbnail/400/format/jpg'  
503 - });  
504 -  
505 -  
506 -  
507 -  
508 -  
509 }, 450 },
510 methods: { 451 methods: {
511 452
@@ -560,6 +501,21 @@ @@ -560,6 +501,21 @@
560 501
561 /* 获取优选库“优选”数据 开始 */ 502 /* 获取优选库“优选”数据 开始 */
562 503
  504 + // 设置Banner
  505 + if (datas.banner && datas.banner.length) {
  506 + this.$set(this, 'swipers', datas.banner);
  507 + }
  508 +
  509 + // 设置单条banner(ads)
  510 + if (datas.ads && datas.ads.length) {
  511 + this.$set(this, 'subBanner', datas.ads[0]);
  512 + }
  513 +
  514 + // 设置导航
  515 + if (datas.navigate && datas.navigate.length) {
  516 + this.$set(this, 'swiperNavs', datas.navigate);
  517 + }
  518 +
563 // 设置折扣商品状态 519 // 设置折扣商品状态
564 this.$set(this, 'discountType', datas.discount_type); 520 this.$set(this, 'discountType', datas.discount_type);
565 521
@@ -776,11 +732,12 @@ @@ -776,11 +732,12 @@
776 */ 732 */
777 toPage(item) { 733 toPage(item) {
778 734
  735 + // 判断通用跳转函数是否存在
  736 + if (typeof this.$parent.gotoDetail === 'function') {
779 737
780 - console.log('toPage', item);  
781 -  
782 -  
783 - 738 + // 通用跳转
  739 + this.$parent.gotoDetail(item);
  740 + }
784 }, 741 },
785 742
786 /** 743 /**
@@ -789,11 +746,12 @@ @@ -789,11 +746,12 @@
789 */ 746 */
790 toBanner(item) { 747 toBanner(item) {
791 748
  749 + // 判断通用跳转函数是否存在
  750 + if (typeof this.$parent.gotoDetail === 'function') {
792 751
793 - console.log('toBanner', item);  
794 -  
795 -  
796 - 752 + // 通用跳转
  753 + this.$parent.gotoDetail(item);
  754 + }
797 }, 755 },
798 756
799 /** 757 /**