home-banner.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="banner home-banner">
  3. <div class="classification-box" v-if="basicCategory.data">
  4. <div class="classification-cell" v-for="(item,ind) in basicCategory.data.slice(0,10)" :key="ind" @click.stop="toCategoryChild({id: item.id})">
  5. <div class="first-class">{{item.name}}</div>
  6. <div class="secondary-class">
  7. <div class="secondary-name" @click.stop="toCategoryChild({id: obj.id})" v-for="(obj,bidx) in item.children" :key="bidx">{{obj.name}}</div>
  8. </div>
  9. </div>
  10. <div class="classification-cell" v-if="basicCategory.total > 10" @click.stop="toUrl('category')"><div class="first-class">查看更多分类</div></div>
  11. </div>
  12. <div class="banner-div">
  13. <bannerItem></bannerItem>
  14. <home-ads-cell :datas="advert"></home-ads-cell>
  15. </div>
  16. <div class="banner-banner-right">
  17. <memberInfo></memberInfo>
  18. <article-cell></article-cell>
  19. </div>
  20. <floor-nav></floor-nav>
  21. </div>
  22. </template>
  23. <script>
  24. import bannerItem from "~/components/templateTwo/home-banner-components/banner-item";
  25. import homeAdsCell from "~/components/templateTwo/home-banner-components/ads-cell";
  26. import memberInfo from "~/components/templateTwo/home-banner-components/member-info";
  27. import articleCell from "~/components/templateTwo/home-banner-components/article";
  28. import floorNav from "~/components/templateTwo/floor-nav";
  29. import {mapState} from "vuex";
  30. export default {
  31. props:{
  32. advert: {
  33. type: Object,
  34. default: () => ({})
  35. },
  36. },
  37. data () {
  38. return {
  39. };
  40. },
  41. activated() {},
  42. components: {
  43. bannerItem,
  44. homeAdsCell,
  45. memberInfo,
  46. articleCell,
  47. floorNav
  48. },
  49. computed: {
  50. ...mapState(["basicSet", "basicCategory"]),
  51. },
  52. mounted() {},
  53. methods: {
  54. toCategoryChild(params) {
  55. if (this.category_template === '03') {
  56. if(this.$baseURL) {
  57. // 静态部署环境下
  58. this.$router.push(this.fun.getUrl('category_child',{}, params));
  59. }else {
  60. this.$router.push(this.fun.getUrl('category_child-id', params));
  61. }
  62. }else {
  63. if(this.$baseURL) {
  64. // 静态部署环境下
  65. this.$router.push(this.fun.getUrl('catelist',{}, params));
  66. }else {
  67. this.$router.push(this.fun.getUrl('catelist-id', params));
  68. }
  69. }
  70. },
  71. toUrl(url, params) {
  72. this.$router.push(this.fun.getUrl(url, params));
  73. },
  74. }
  75. }
  76. </script>
  77. <style lang='scss' rel='stylesheet/scss' scoped>
  78. .banner {
  79. position: relative;
  80. width: 1200px;
  81. margin: 0 auto 30px;
  82. display: flex;
  83. padding-top: 10px;
  84. .banner-div{
  85. display: inline-block;
  86. margin-left: 15px;
  87. position: relative;
  88. width: 690px;
  89. }
  90. .banner-banner-right{
  91. flex: 1;
  92. height: 460px;
  93. overflow: hidden;
  94. display: flex;
  95. margin-left: 15px;
  96. flex-direction: column;
  97. }
  98. .classification-box{
  99. background-color: #fff;
  100. width: 220px;
  101. height: 480px;
  102. padding: 8px 16px;
  103. margin-top: -20px;
  104. box-sizing: border-box;
  105. border-top: 6px solid var(--dark_color);
  106. overflow-y: scroll;
  107. scrollbar-width: none; /* Firefox */
  108. -ms-overflow-style: none; /* IE 10+ */
  109. .classification-cell{
  110. display: flex;
  111. flex-direction: column;
  112. padding-top: 4px;
  113. .first-class{
  114. font-size: 14px;
  115. line-height: 28px;
  116. color: #000000;
  117. font-weight: bold;
  118. &:hover{
  119. cursor: pointer;
  120. color: var(--color);
  121. }
  122. }
  123. .secondary-class{
  124. display: flex;
  125. flex-wrap: wrap;
  126. .secondary-name{
  127. font-size: 12px;
  128. color: #8c8c8c;
  129. padding-right: 8px;
  130. text-align: left;
  131. min-width: 50%;
  132. box-sizing: border-box;
  133. line-height: 26px;
  134. &:hover{
  135. cursor: pointer;
  136. color: var(--color);
  137. }
  138. }
  139. }
  140. }
  141. .classification-cell:first-child{
  142. padding: 0;
  143. }
  144. }
  145. .classification-box::-webkit-scrollbar {
  146. display: none; /* Chrome Safari */
  147. }
  148. }
  149. </style>