app-special-topic-normal.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="app-normal">
  3. <view class="app-simple app-single dir-left-nowrap main-center cross-center" v-if="count == 1">
  4. <icon class="app-icon app-count-icon" :style="{backgroundImage: `url(${logo_1})`}"></icon>
  5. <swiper class="app-swiper" vertical circular autoplay>
  6. <swiper-item class="dir-left-nowrap main-left cross-center" v-for="(item, index) in topic_list" :key="index">
  7. <app-jump-button arrangement="row" form width="100" height="100" open_type="navigate" url="../topic/list">
  8. <icon class="app-icon app-logo" :style="{backgroundImage: `url(${icon})`}"></icon>
  9. <text class="app-text">{{item.title}}</text>
  10. </app-jump-button>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. <view class="app-simple app-double dir-left-nowrap main-center cross-center" v-else-if="count == 2">
  15. <icon class="app-icon app-count-icon" :style="{backgroundImage: `url(${logo_2})`}"></icon>
  16. <swiper class="app-swiper" vertical circular autoplay>
  17. <swiper-item v-for="list in newDataList" :key="item.id">
  18. <view class="app-list-view" v-for="(item, index) in list" :key="index">
  19. <app-jump-button arrangement="row" form width="100" height="100" open_type="navigate" url="../topic/list">
  20. <icon class="app-icon app-logo" :style="{backgroundImage: `url(${icon})`}"></icon>
  21. <text class="app-text">{{item.title}}</text>
  22. </app-jump-button>
  23. </view>
  24. </swiper-item>
  25. </swiper>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: "app-special-topic",
  32. props: {
  33. topic_list: {
  34. type: Array,
  35. default() {
  36. return [];
  37. }
  38. },
  39. count: {
  40. type: Number,
  41. default() {
  42. return 2;
  43. }
  44. },
  45. icon: String,
  46. logo_1: String,
  47. logo_2: String,
  48. },
  49. computed: {
  50. newDataList: function() {
  51. if (this.count !== 2) return;
  52. let newTopicList = [];
  53. for (let i = 0; i < Math.ceil(this.topic_list.length/this.count); i++) {
  54. newTopicList.push(this.topic_list.slice(i*this.count, (i+1)*this.count));
  55. }
  56. return newTopicList;
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .app-simple {
  63. width: #{750-24*2rpx};
  64. margin: 0 #{24rpx};
  65. }
  66. .app-normal {
  67. background-color: #ffffff;
  68. .app-single {
  69. width: #{750-24*2rpx};
  70. height: #{72rpx};
  71. .app-swiper {
  72. margin-left: #{20rpx};
  73. width: #{577rpx};
  74. height: #{28rpx};
  75. }
  76. .app-count-icon {
  77. height: #{32rpx};
  78. width: #{104rpx};
  79. }
  80. }
  81. .app-double {
  82. height: #{110rpx};
  83. .app-count-icon {
  84. width: #{104rpx};
  85. height: #{50rpx};
  86. }
  87. .app-swiper {
  88. margin-left: #{20rpx};
  89. width: #{577rpx};
  90. height: #{110-22-22rpx};
  91. }
  92. .app-list-view {
  93. height: #{28rpx};
  94. }
  95. .app-list-view:first-child {
  96. margin-bottom: #{6rpx};
  97. }
  98. .app-list-view:last-child {
  99. margin-top: #{6rpx};
  100. }
  101. }
  102. }
  103. .app-logo {
  104. width: #{54rpx};
  105. height: #{28rpx};
  106. margin-right: #{10rpx};
  107. }
  108. .app-icon {
  109. background-repeat: no-repeat;
  110. background-size: 100% 100%;
  111. }
  112. .app-text {
  113. width: #{514rpx};
  114. height: #{28rpx};
  115. font-size: #{26rpx};
  116. line-height: #{28rpx};
  117. color: #353535;
  118. overflow:hidden;
  119. text-overflow: ellipsis;
  120. white-space: nowrap;
  121. }
  122. </style>