home.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="tab_page" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <up-navbar title=" " bgColor="transparent">
  4. <template #left>
  5. <view class="u-nav-slot" slot="left" style="display: flex;background-color: transparent;">
  6. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/a5ad7f10-d625-4c9a-89f3-59f98c56dee8.png" style="width: 370rpx;height: 40rpx;"></image>
  7. </view>
  8. </template>
  9. </up-navbar>
  10. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/a7f990ec-1bff-4bd6-8b7f-fa61c0170d3b.png" class="top_bg_img" mode="widthFix"></image>
  11. <div class="c-box adffc">
  12. <div class="c-box-lunbo">
  13. <up-swiper
  14. :list="bannarList"
  15. @change="e => current = e.current"
  16. :autoplay="false"
  17. height="326rpx"
  18. >
  19. <template #indicator>
  20. <view class="indicator adf">
  21. <view class="indicator__dot" v-for="(item, index) in bannarList" :key="index"
  22. :class="[index === current && 'indicator__dot--active']">
  23. </view>
  24. </view>
  25. </template>
  26. </up-swiper>
  27. </div>
  28. <div class="c-box-title adfacjb">
  29. <div class="c-box-title-left">公益活动</div>
  30. <div class="c-box-title-right adfac">更多 <up-icon name="arrow-right" size="30rpx" style="margin-left: 10rpx;"></up-icon></div>
  31. </div>
  32. <div class="c-box-type">
  33. <scroll-view class="scroll-view_H" scroll-x="true" scroll-with-animation="true" :scroll-left="scrollLeft">
  34. <view class="scroll-view-item_H" :id="'svih_'+index" v-for="(item,index) in typeList" :key="index" @tap="changeType(item,index)">
  35. <view class="cl_item" :class="{'active':tlIndex===index}">
  36. <text>{{item.name}}</text>
  37. </view>
  38. </view>
  39. </scroll-view>
  40. </div>
  41. <div class="c-box-list">
  42. <NonprofitActivety></NonprofitActivety>
  43. <NonprofitActivety></NonprofitActivety>
  44. </div>
  45. </div>
  46. <CusTabbar :tabbarIndex="0"></CusTabbar>
  47. </view>
  48. </template>
  49. <script setup name="">
  50. import CusTabbar from '@/components/CusTabbar/index.vue'
  51. import NonprofitActivety from '@/components/pages/nonprofitActivety/index.vue'
  52. import { ref, getCurrentInstance, onMounted } from 'vue'
  53. const { proxy } = getCurrentInstance()
  54. const bannarList = ref([
  55. 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/337c22f0-2583-4556-84b6-eb21fdde6e82.png',
  56. 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/337c22f0-2583-4556-84b6-eb21fdde6e82.png',
  57. 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/337c22f0-2583-4556-84b6-eb21fdde6e82.png'
  58. ])
  59. const current = ref(0)
  60. const typeList = ref([
  61. {id:'',name:'全部'},
  62. {id:1,name:'儿童关爱'},
  63. {id:2,name:'老人关爱'},
  64. {id:3,name:'社区发展'},
  65. {id:4,name:'社会服务'},
  66. {id:5,name:'健康行动'},
  67. {id:6,name:'减肥运动'}
  68. ])
  69. const tlIndex = ref(0)
  70. const scrollLeft = ref(0)
  71. const changeType = (item,index) => {
  72. tlIndex.value = index;
  73. if(typeList.value.length>4){
  74. if(index<3) scrollLeft.value = 0
  75. else{
  76. scrollLeft.value = (index-2)*172/2;
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. ::v-deep .indicator__dot{
  83. width: 48rpx;
  84. height: 4rpx;
  85. background: #E2E5E9;
  86. border-radius: 2rpx;
  87. margin: 0 8rpx;
  88. }
  89. ::v-deep .indicator__dot--active{
  90. width: 48rpx;
  91. height: 4rpx;
  92. background: #00AE57;
  93. border-radius: 2rpx;
  94. }
  95. .scroll-view_H {
  96. white-space: nowrap;
  97. width: 100%;
  98. }
  99. .scroll-view-item_H {
  100. display: inline-block;
  101. width: 152rpx;
  102. height: 100%;
  103. margin-left: 20rpx;
  104. &:first-child{
  105. margin-left: 0;
  106. }
  107. }
  108. .tab_page{
  109. .c-box{
  110. width: 100%;
  111. height: 100%;
  112. overflow-y: auto;
  113. position: relative;
  114. &-lunbo{
  115. width: 100%;
  116. height: 326rpx;
  117. margin-top: 20rpx;
  118. }
  119. &-title{
  120. margin-top: 58rpx;
  121. &-left{
  122. width: 170rpx;
  123. height: 44rpx;
  124. padding-left: 2rpx;
  125. font-family: PingFang-SC, PingFang-SC;
  126. font-weight: 800;
  127. font-size: 36rpx;
  128. color: #151B29;
  129. line-height: 36rpx;
  130. background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/6ec1f999-fcbb-4a0b-a1a5-d0b5e1374bb1.png');
  131. background-size: 170rpx 31rpx;
  132. background-position: 0 20rpx;
  133. background-repeat: no-repeat;
  134. }
  135. &-right{
  136. font-family: PingFangSC, PingFang SC;
  137. font-weight: 400;
  138. font-size: 28rpx;
  139. color: #676775;
  140. line-height: 33rpx;
  141. }
  142. }
  143. &-type{
  144. width: 100%;
  145. height: 68rpx;
  146. margin-top: 31rpx;
  147. .cl_item{
  148. width: 152rpx;
  149. height: 68rpx;
  150. background: #FFFFFF;
  151. border-radius: 34rpx;
  152. font-family: PingFangSC, PingFang SC;
  153. font-weight: 400;
  154. font-size: 28rpx;
  155. color: #676775;
  156. line-height: 68rpx;
  157. text-align: center;
  158. &.active{
  159. background: #B7F358;
  160. font-weight: bold;
  161. font-size: 30rpx;
  162. color: #151B29;
  163. }
  164. }
  165. }
  166. &-list{
  167. width: 100%;
  168. flex: 1;
  169. overflow-y: auto;
  170. }
  171. }
  172. }
  173. </style>