RecommendBrand.vue 5.3 KB

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