RecommendBrand.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="recommend-brand">
  3. <div class="brand-content">
  4. <div v-swiper:mySwiper="swiperOption" class="swiper-container" ref="Vswiper">
  5. <div class="swiper-wrapper">
  6. <div class="swiper-slide" v-for="banner in sliceBanners">
  7. <a :href="banner.detailsLink" target="_blank">
  8. <img :src="banner.pictureLink"/>
  9. </a>
  10. </div>
  11. <div v-show="sliceBanners.length > 1" class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
  12. <div v-show="sliceBanners.length > 1" class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
  13. </div>
  14. <div v-show="sliceBanners.length > 1" class="swiper-pagination swiper-pagination-bullets"></div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. data () {
  22. return {
  23. swiperOption: {
  24. autoplay: 6000,
  25. pagination: '.swiper-pagination',
  26. paginationClickable: true,
  27. // 解决点击分页器后图片就不能轮播的问题
  28. autoplayDisableOnInteraction: false,
  29. mousewheelControl: false,
  30. effect: 'fade',
  31. lazyLoading: true,
  32. observer: true,
  33. loop: true,
  34. prevButton: '.swiper-button-prev',
  35. nextButton: '.swiper-button-next',
  36. onTransitionStart: (swiper) => {
  37. if (this.banners.data && this.banners.data.length && (swiper.activeIndex > this.banners.data.length)) {
  38. swiper.activeIndex = 1
  39. }
  40. if (this.banners.data && this.banners.data.length && swiper.activeIndex <= 0) {
  41. swiper.activeIndex = this.banners.data.length
  42. }
  43. }
  44. }
  45. }
  46. },
  47. created () {
  48. this.$store.dispatch('loadBrandCarousel')
  49. },
  50. mounted() {
  51. this.$nextTick(() => {
  52. })
  53. },
  54. computed: {
  55. banners () {
  56. return this.$store.state.carousel.brandCarousel.data
  57. },
  58. sliceBanners () {
  59. return this.banners.data && this.banners.data.length ? this.banners.data.slice(0, 3) : []
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .recommend-brand {
  66. width: 1190px;
  67. margin: 0 auto;
  68. overflow: hidden;
  69. .brand-toggle {
  70. float: left;
  71. margin-right: 15px;
  72. }
  73. .brand-content{
  74. float: left;
  75. }
  76. .swiper-container {
  77. z-index: 2;
  78. float: left;
  79. width: 955px;
  80. height: 400px;
  81. .swiper-wrapper {
  82. width: 955px;
  83. height: 400px;
  84. margin: 0 auto;
  85. .swiper-slide {
  86. height: 400px;
  87. margin: 0 auto;
  88. display: flex;
  89. img {
  90. width: 955px;
  91. /*height: 400px;*/
  92. /*border: 1px solid #ccc;*/
  93. border-radius: 5px;
  94. }
  95. }
  96. .swiper-button-prev i, .swiper-button-next i {
  97. font-size: 26px;
  98. }
  99. }
  100. .swiper-pagination-bullets {
  101. .swiper-pagination-bullet {
  102. width: 10px!important;
  103. height: 10px!important;
  104. }
  105. }
  106. }
  107. .recommend-adv {
  108. margin: 0 auto;
  109. width: 1190px;
  110. height: 163px;
  111. display: block;
  112. border-radius: 3px;
  113. }
  114. .recommend-area {
  115. margin: 20px auto 0;
  116. width: 1190px;
  117. height: 263px;
  118. background:url("/images/brandCenter/recommend-bg1.png") no-repeat;
  119. .recommend-items {
  120. padding-top: 51px;
  121. padding-left: 3px;
  122. li {
  123. border-radius: 3px;
  124. width: 233px;
  125. height: 98px;
  126. background: #fff;
  127. display: inline-block;
  128. margin-right: 3px;
  129. margin-bottom: 8px;
  130. text-align: center;
  131. border: solid 1px #f4f4f4;
  132. &:nth-child(5n) {
  133. margin-right: 0;
  134. }
  135. a {
  136. padding-top: 22px;
  137. width: 233px;
  138. height: 98px;
  139. line-height: 60px;
  140. display: block;
  141. position: relative;
  142. top:-1px;
  143. left: -1px;
  144. img {
  145. max-width: 140px;
  146. max-height: 60px;
  147. }
  148. >div {
  149. display: none;
  150. position: absolute;
  151. border-radius: 3px;
  152. width: 233px;
  153. height: 98px;
  154. background-color: #3a78f4;
  155. opacity: 0.9;
  156. top: 0;
  157. text-align: left;
  158. padding: 13px 7px;
  159. p {
  160. font-size: 15px;
  161. color: #fff;
  162. font-weight: bold;
  163. height: 16px;
  164. line-height: 16px;
  165. }
  166. span {
  167. color: #fff;
  168. display: block;
  169. width: 228px;
  170. line-height: 18px;
  171. font-size: 12px;
  172. &.brand-application {
  173. padding-right: 5px;
  174. text-overflow: ellipsis;
  175. white-space: nowrap;
  176. overflow: hidden;
  177. }
  178. &.brand-introduce {
  179. padding-right: 5px;
  180. word-break: break-all;
  181. }
  182. }
  183. }
  184. }
  185. &:hover {
  186. /*position: relative;
  187. bottom: 5px;*/
  188. a {
  189. div {
  190. display: block;
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. }
  198. .recommend-brand .brand-content .brand-index-tab .brand-index-group a.active{
  199. background-color: #2496f1;
  200. border-radius: 5px;
  201. color: #fff;
  202. /*width: 56px;*/
  203. /*padding-left: 3px;*/
  204. }
  205. </style>