金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
3.1 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="热门活动" :showIcon="true" bgColor="#fff" @changeHeight="e => nav_height = e"></lf-nav>
  4. <view v-if="tab_list.length">
  5. <u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="tab_current" @change="tabChange"></u-tabs>
  6. </view>
  7. <swiper :style="{height: autoHeight}" :current="tab_current" @change="swiperChange">
  8. <swiper-item v-for="(item, index) in tab_list" :key="index">
  9. <scroll-view :style="{height: autoHeight}" :scroll-y="true">
  10. <view class="scroll-content">
  11. <view class="card" v-for="(item, index) in 3" :key="index">
  12. <view class="cover">
  13. <image class="img"></image>
  14. </view>
  15. <view class="info">
  16. <view class="title">海蓝之谜美颜会 9月15日场10:30</view>
  17. <view class="date">2021.09.01-2021.09.15</view>
  18. </view>
  19. </view>
  20. </view>
  21. <view style="height: 30rpx;"></view>
  22. </scroll-view>
  23. </swiper-item>
  24. </swiper>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data(){
  30. let _public = {
  31. page: 1,
  32. isPage: true,
  33. loadingClass: true,
  34. loadingText: '正在加载中'
  35. }
  36. return {
  37. tab_current: 0,
  38. tab_list: [{
  39. name: '正在进行',
  40. list: [],
  41. ..._public
  42. },{
  43. name: '往期回顾',
  44. list: [],
  45. ..._public
  46. }],
  47. scrollH: 0,
  48. nav_height: 0
  49. }
  50. },
  51. computed: {
  52. autoHeight(){
  53. return `calc(${this.scrollH}px - ${this.nav_height}px - 86rpx)`;
  54. }
  55. },
  56. onLoad(){
  57. let info = uni.getSystemInfoSync();
  58. this.scrollH = info.screenHeight;
  59. },
  60. methods: {
  61. tabChange(event){
  62. this.tab_current = event;
  63. },
  64. swiperChange(event){
  65. this.tab_current = event.detail.current;
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped="scoped">
  71. .scroll-content{
  72. width: 100%;
  73. display: flex;
  74. flex-wrap: wrap;
  75. justify-content: center;
  76. .card{
  77. width: 686rpx;
  78. height: max-content;
  79. background-color: #FFFFFF;
  80. box-shadow: 1rpx 1rpx 6rpx 3rpx #e5e5e5;
  81. margin-top: 30rpx;
  82. border-radius: 20rpx;
  83. overflow: hidden;
  84. .cover{
  85. width: 686rpx;
  86. height: 300rpx;
  87. position: relative;
  88. .img{
  89. width: 100%;
  90. height: 100%;
  91. background-color: #EEEEEE;
  92. }
  93. }
  94. .info{
  95. width: 686rpx;
  96. height: max-content;
  97. padding: 20rpx 30rpx;
  98. box-sizing: border-box;
  99. .title{
  100. font-size: 28rpx;
  101. color: #222222;
  102. font-weight: bold;
  103. }
  104. .date{
  105. margin-top: 20rpx;
  106. font-size: 24rpx;
  107. color: #555555;
  108. }
  109. }
  110. }
  111. }
  112. // tabs 样式修改
  113. /deep/.u-scroll-box {
  114. display: flex;
  115. justify-content: center;
  116. align-items: center;
  117. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  118. }
  119. /deep/.u-scroll-box .u-tab-bar {
  120. background-color: #15716E!important;
  121. width: 80rpx!important;
  122. position: absolute;
  123. left: 0;
  124. bottom: -12rpx;
  125. }
  126. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  127. background-color: #15716E!important;
  128. width: 56rpx!important;
  129. position: absolute;
  130. height: 5rpx!important;
  131. left: 8rpx;
  132. bottom: -4rpx;
  133. }
  134. /deep/ .u-tab-item {
  135. font-size: 28rpx!important;
  136. }
  137. </style>