RecommendBrand.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. nowPage: 1,
  44. keyword: '',
  45. isSearch: false,
  46. activeSlide: 0,
  47. swiperOption: {
  48. autoplay: 6000,
  49. pagination: '.swiper-pagination',
  50. paginationClickable: true,
  51. mousewheelControl: false,
  52. effect: 'fade',
  53. lazyLoading: true,
  54. loop: true,
  55. prevButton: '.swiper-button-prev',
  56. nextButton: '.swiper-button-next',
  57. onTransitionStart: (swiper) => {
  58. if (this.banners.data && this.banners.data.length && (swiper.activeIndex > this.banners.data.length)) {
  59. swiper.activeIndex = 1
  60. }
  61. if (this.banners.data && this.banners.data.length && swiper.activeIndex <= 0) {
  62. swiper.activeIndex = this.banners.data.length
  63. }
  64. }
  65. }
  66. }
  67. },
  68. filters: {
  69. applicationFilter: function (str) {
  70. return str.split(',').join('|')
  71. },
  72. introduceFilter: function (title) {
  73. if (title === '') {
  74. return title
  75. }
  76. let len = 0
  77. let index = 0
  78. for (let i = 0; i < title.length; i++) {
  79. if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
  80. len = len + 2
  81. } else {
  82. len++
  83. }
  84. if (len > 60) {
  85. index = i
  86. break
  87. }
  88. }
  89. if (index > 0) {
  90. return title.substring(0, index) + '...'
  91. } else {
  92. return title
  93. }
  94. }
  95. },
  96. computed: {
  97. floors () {
  98. return this.$store.state.floor.list.data
  99. },
  100. banners () {
  101. return this.$store.state.carousel.brandCarousel.data
  102. },
  103. sliceBanners () {
  104. return this.banners.data && this.banners.data.length ? this.banners.data.slice(0, 3) : []
  105. },
  106. activeIndex () {
  107. return !this.isSearch ? this.$route.params.initial : ''
  108. }
  109. },
  110. methods: {
  111. goBrandIndex: function (index) {
  112. if (index === this.$route.params.initial) {
  113. this.initParams()
  114. this.reloadData()
  115. } else {
  116. this.$router.push('/product/brand/brandList/' + index)
  117. // window.location.href = '/product/brand/brandList/' + index + '#index'
  118. // window.open('/product/brand/brandList/' + index + '#index', '_self')
  119. }
  120. },
  121. initParams: function () {
  122. this.nowPage = 1
  123. this.isSearch = false
  124. this.keyword = ''
  125. this.reloadData()
  126. },
  127. reloadData: function () {
  128. !this.isSearch ? this.$store.dispatch('product/loadBrandsPager', {'initial': this.$route.params.initial, 'page': this.nowPage, 'count': this.pageSize, 'keyword': this.keyword}) : this.searchData()
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .recommend-brand {
  135. width: 1190px;
  136. margin: 0 auto;
  137. padding-top: 20px;
  138. .brand-content{
  139. overflow: hidden;
  140. .brand-index-tab {
  141. margin-right: 15px;
  142. float: left;
  143. width: 220px;
  144. height: 400px;
  145. background-color: #ffffff;
  146. border-radius: 5px;
  147. /*border: solid 1px #d2d2d2;*/
  148. .index-head {
  149. padding-left: 10px;
  150. width: 220px;
  151. height: 34px;
  152. line-height: 34px;
  153. background-color: #2496f1;
  154. font-size: 14px;
  155. font-weight: bold;
  156. border-top-left-radius: 5px;
  157. border-top-right-radius: 5px;
  158. color: #fff;
  159. img{
  160. margin-right: 6px;
  161. margin-top: -2px;
  162. }
  163. }
  164. .brand-index-group {
  165. margin: 0 auto 22px;
  166. width: 200px;
  167. height: 40px;
  168. background-color: rgba(36, 150, 241, 0.1);
  169. border-radius: 4px;
  170. /*opacity: 0.1;*/
  171. a{
  172. display: inline-block;
  173. width: 40px;
  174. height: 40px;
  175. line-height: 40px;
  176. text-align: center;
  177. font-size: 16px;
  178. color: #666;
  179. border-radius: 5px;
  180. /*background-color: #2496f1;*/
  181. &:hover{
  182. background-color: #2496f1;
  183. color: #fff;
  184. }
  185. }
  186. &:last-child{
  187. margin-bottom: 0;
  188. }
  189. &:last-child a{
  190. letter-spacing: 15px;
  191. padding-left: 12px;
  192. }
  193. }
  194. }
  195. }
  196. .swiper-container {
  197. z-index: 2;
  198. float: left;
  199. width: 955px;
  200. height: 400px;
  201. .swiper-wrapper {
  202. width: 955px;
  203. height: 400px;
  204. margin: 0 auto;
  205. .swiper-slide {
  206. height: 400px;
  207. margin: 0 auto;
  208. display: flex;
  209. img {
  210. width: 955px;
  211. height: 400px;
  212. /*border: 1px solid #ccc;*/
  213. border-radius: 5px;
  214. }
  215. }
  216. .swiper-button-prev i, .swiper-button-next i {
  217. font-size: 26px;
  218. }
  219. }
  220. .swiper-pagination-bullets {
  221. .swiper-pagination-bullet {
  222. width: 10px!important;
  223. height: 10px!important;
  224. }
  225. }
  226. }
  227. .recommend-adv {
  228. margin: 0 auto;
  229. width: 1190px;
  230. height: 163px;
  231. display: block;
  232. border-radius: 3px;
  233. }
  234. .recommend-area {
  235. margin: 20px auto 0;
  236. width: 1190px;
  237. height: 263px;
  238. background:url("/images/brandCenter/recommend-bg1.png") no-repeat;
  239. .recommend-items {
  240. padding-top: 51px;
  241. padding-left: 3px;
  242. li {
  243. border-radius: 3px;
  244. width: 233px;
  245. height: 98px;
  246. background: #fff;
  247. display: inline-block;
  248. margin-right: 3px;
  249. margin-bottom: 8px;
  250. text-align: center;
  251. border: solid 1px #f4f4f4;
  252. &:nth-child(5n) {
  253. margin-right: 0;
  254. }
  255. a {
  256. padding-top: 22px;
  257. width: 233px;
  258. height: 98px;
  259. line-height: 60px;
  260. display: block;
  261. position: relative;
  262. top:-1px;
  263. left: -1px;
  264. img {
  265. max-width: 140px;
  266. max-height: 60px;
  267. }
  268. >div {
  269. display: none;
  270. position: absolute;
  271. border-radius: 3px;
  272. width: 233px;
  273. height: 98px;
  274. background-color: #3a78f4;
  275. opacity: 0.9;
  276. top: 0;
  277. text-align: left;
  278. padding: 13px 7px;
  279. p {
  280. font-size: 15px;
  281. color: #fff;
  282. font-weight: bold;
  283. height: 16px;
  284. line-height: 16px;
  285. }
  286. span {
  287. color: #fff;
  288. display: block;
  289. width: 228px;
  290. line-height: 18px;
  291. font-size: 12px;
  292. &.brand-application {
  293. padding-right: 5px;
  294. text-overflow: ellipsis;
  295. white-space: nowrap;
  296. overflow: hidden;
  297. }
  298. &.brand-introduce {
  299. padding-right: 5px;
  300. word-break: break-all;
  301. }
  302. }
  303. }
  304. }
  305. &:hover {
  306. /*position: relative;
  307. bottom: 5px;*/
  308. a {
  309. div {
  310. display: block;
  311. }
  312. }
  313. }
  314. }
  315. }
  316. }
  317. }
  318. .recommend-brand .brand-content .brand-index-tab .brand-index-group a.active{
  319. background-color: #2496f1;
  320. border-radius: 5px;
  321. color: #fff;
  322. /*width: 56px;*/
  323. /*padding-left: 3px;*/
  324. }
  325. </style>