RecommendBrand.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="recommend-brand">
  3. <div class="brand-content">
  4. <div class="brand-index-tab">
  5. <div class="index-head">
  6. <img src="/images/brandCenter/search-index.png"/>品牌索引
  7. </div>
  8. <div style="padding-top: 8px;">
  9. <div class="brand-index-group index-group" v-for="(indexGroup, index) in indexGroups">
  10. <span v-if="index == 5"></span>
  11. <a @click="goBrandIndex(group_index)" v-for="group_index in indexGroup" :class="{'active': activeIndex==group_index}">{{group_index}}</a>
  12. <span v-if="index == 5"></span>
  13. </div>
  14. </div>
  15. </div>
  16. <div v-swiper:mySwiper="swiperOption" class="swiper-container">
  17. <div class="swiper-wrapper">
  18. <div class="swiper-slide" v-for="banner in sliceBanners">
  19. <a :href="banner.detailsLink" target="_blank">
  20. <img :src="banner.pictureLink"/>
  21. </a>
  22. </div>
  23. <div v-if="sliceBanners.length === 0" class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
  24. <div v-if="sliceBanners.length === 0"class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
  25. </div>
  26. <div v-if="sliceBanners.length === 0" class="swiper-pagination swiper-pagination-bullets"></div>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. export default {
  33. data () {
  34. return {
  35. indexGroups: [
  36. ['A', 'B', 'C', 'D', 'E'],
  37. ['F', 'G', 'H', 'I', 'J'],
  38. ['K', 'L', 'M', 'N', 'O'],
  39. ['P', 'Q', 'R', 'S', 'T'],
  40. ['U', 'V', 'W', 'X', 'Y', 'Z'],
  41. ['0~9']
  42. ],
  43. activeSlide: 0,
  44. swiperOption: {
  45. autoplay: 6000,
  46. pagination: '.swiper-pagination',
  47. paginationClickable: true,
  48. mousewheelControl: false,
  49. effect: 'fade',
  50. lazyLoading: true,
  51. loop: true,
  52. prevButton: '.swiper-button-prev',
  53. nextButton: '.swiper-button-next',
  54. onTransitionStart: (swiper) => {
  55. if (this.banners.data && this.banners.data.length && (swiper.activeIndex > this.banners.data.length)) {
  56. swiper.activeIndex = 1
  57. }
  58. if (this.banners.data && this.banners.data.length && swiper.activeIndex <= 0) {
  59. swiper.activeIndex = this.banners.data.length
  60. }
  61. }
  62. }
  63. }
  64. },
  65. filters: {
  66. applicationFilter: function (str) {
  67. return str.split(',').join('|')
  68. },
  69. introduceFilter: function (title) {
  70. if (title === '') {
  71. return title
  72. }
  73. let len = 0
  74. let index = 0
  75. for (let i = 0; i < title.length; i++) {
  76. if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
  77. len = len + 2
  78. } else {
  79. len++
  80. }
  81. if (len > 60) {
  82. index = i
  83. break
  84. }
  85. }
  86. if (index > 0) {
  87. return title.substring(0, index) + '...'
  88. } else {
  89. return title
  90. }
  91. }
  92. },
  93. computed: {
  94. floors () {
  95. return this.$store.state.floor.list.data
  96. },
  97. banners () {
  98. return this.$store.state.carousel.brandCarousel.data
  99. },
  100. sliceBanners () {
  101. return this.banners.data && this.banners.data.length ? this.banners.data.slice(0, 3) : []
  102. },
  103. activeIndex () {
  104. return !this.isSearch ? this.$route.params.initial : ''
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .recommend-brand {
  111. width: 1190px;
  112. margin: 0 auto;
  113. margin-top: 10px;
  114. .brand-content{
  115. overflow: hidden;
  116. .brand-index-tab {
  117. margin-right: 15px;
  118. float: left;
  119. width: 220px;
  120. height: 400px;
  121. background-color: #ffffff;
  122. border-radius: 5px;
  123. border: solid 1px #d2d2d2;
  124. .index-head {
  125. padding-left: 10px;
  126. width: 220px;
  127. height: 34px;
  128. line-height: 34px;
  129. background-color: #2496f1;
  130. font-size: 14px;
  131. border-top-left-radius: 5px;
  132. border-top-right-radius: 5px;
  133. color: #fff;
  134. img{
  135. margin-right: 6px;
  136. margin-top: -2px;
  137. }
  138. }
  139. .brand-index-group {
  140. margin: 0 auto 22px;
  141. width: 200px;
  142. height: 40px;
  143. background-color: rgba(36, 150, 241, 0.1);
  144. border-radius: 4px;
  145. /*opacity: 0.1;*/
  146. a{
  147. display: inline-block;
  148. width: 40px;
  149. height: 40px;
  150. line-height: 40px;
  151. text-align: center;
  152. font-size: 16px;
  153. color: #666;
  154. border-radius: 5px;
  155. /*background-color: #2496f1;*/
  156. &:hover{
  157. background-color: #2496f1;
  158. color: #fff;
  159. }
  160. }
  161. &:last-child{
  162. margin-bottom: 0;
  163. }
  164. }
  165. }
  166. }
  167. .swiper-container {
  168. z-index: 2;
  169. float: left;
  170. width: 955px;
  171. height: 400px;
  172. .swiper-wrapper {
  173. width: 955px;
  174. height: 400px;
  175. margin: 0 auto;
  176. .swiper-slide {
  177. height: 400px;
  178. margin: 0 auto;
  179. display: flex;
  180. img {
  181. width: 955px;
  182. height: 400px;
  183. border: 1px solid #ccc;
  184. }
  185. }
  186. .swiper-button-prev i, .swiper-button-next i {
  187. font-size: 26px;
  188. }
  189. }
  190. .swiper-pagination-bullets {
  191. .swiper-pagination-bullet {
  192. width: 10px!important;
  193. height: 10px!important;
  194. }
  195. }
  196. }
  197. .recommend-adv {
  198. margin: 0 auto;
  199. width: 1190px;
  200. height: 163px;
  201. display: block;
  202. border-radius: 3px;
  203. }
  204. .recommend-area {
  205. margin: 20px auto 0;
  206. width: 1190px;
  207. height: 263px;
  208. background:url("/images/brandCenter/recommend-bg1.png") no-repeat;
  209. .recommend-items {
  210. padding-top: 51px;
  211. padding-left: 3px;
  212. li {
  213. border-radius: 3px;
  214. width: 233px;
  215. height: 98px;
  216. background: #fff;
  217. display: inline-block;
  218. margin-right: 3px;
  219. margin-bottom: 8px;
  220. text-align: center;
  221. border: solid 1px #f4f4f4;
  222. &:nth-child(5n) {
  223. margin-right: 0;
  224. }
  225. a {
  226. padding-top: 22px;
  227. width: 233px;
  228. height: 98px;
  229. line-height: 60px;
  230. display: block;
  231. position: relative;
  232. top:-1px;
  233. left: -1px;
  234. img {
  235. max-width: 140px;
  236. max-height: 60px;
  237. }
  238. >div {
  239. display: none;
  240. position: absolute;
  241. border-radius: 3px;
  242. width: 233px;
  243. height: 98px;
  244. background-color: #3a78f4;
  245. opacity: 0.9;
  246. top: 0;
  247. text-align: left;
  248. padding: 13px 7px;
  249. p {
  250. font-size: 15px;
  251. color: #fff;
  252. font-weight: bold;
  253. height: 16px;
  254. line-height: 16px;
  255. }
  256. span {
  257. color: #fff;
  258. display: block;
  259. width: 228px;
  260. line-height: 18px;
  261. font-size: 12px;
  262. &.brand-application {
  263. padding-right: 5px;
  264. text-overflow: ellipsis;
  265. white-space: nowrap;
  266. overflow: hidden;
  267. }
  268. &.brand-introduce {
  269. padding-right: 5px;
  270. word-break: break-all;
  271. }
  272. }
  273. }
  274. }
  275. &:hover {
  276. /*position: relative;
  277. bottom: 5px;*/
  278. a {
  279. div {
  280. display: block;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. }
  287. }
  288. </style>