my-invite.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="my-invite">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view class="swiper-nav">
  6. <view v-for="(item, index) in typeList" :key="index" class="item" :class="{ active: MIXIN_ActiveIndex === index }" @tap="switchSwiper(index)">{{ item }}</view>
  7. <view class="moveBar" :style="{ left: MIXIN_MoveBarLeft + 'px', width: 100 / typeList.length + '%' }"><text></text></view>
  8. </view>
  9. <view class="swiper-area">
  10. <pulldown-refresher ref="pulldownRefresher" @pulldownRefresh="MIXIN_pulldownrefresh">
  11. <swiper class="swiper" :current="MIXIN_NowIndex" :duration="234" @transition="MIXIN_transition" @change="MIXIN_change" @animationfinish="MIXIN_animationfinish">
  12. <swiper-item>
  13. <scroll-view scroll-y :style="{ height: MIXIN_ScrollViewHeight + 'px' }" @scrolltolower="MIXIN_scrolltolower">
  14. <view class="team-item" v-for="(item, itemIndex) in lists[0]" :key="itemIndex" @tap="toPerson(item.id)">
  15. <image class="left" :src="item.avatar"></image>
  16. <view class="center">
  17. <view class="top">
  18. <text class="ellipsis">{{ item.nickname }}</text>
  19. <view class="level-name"><text class="cuIcon-crownfill"></text>{{ item.level }}</view>
  20. </view>
  21. <view class="bot">{{ item.created_at + ' 加入' }}</view>
  22. </view>
  23. <text class="right cuIcon-right"></text>
  24. </view>
  25. <custom-reach-bottom v-if="lists[0].length" :nomore="page[0] === 0" />
  26. <swiper-status v-else :page="page[0]" unit="邀请" />
  27. </scroll-view>
  28. </swiper-item>
  29. <swiper-item>
  30. <scroll-view scroll-y :style="{ height: MIXIN_ScrollViewHeight + 'px' }" @scrolltolower="MIXIN_scrolltolower">
  31. <view class="team-item" v-for="(item, itemIndex) in lists[1]" :key="itemIndex">
  32. <image class="left" :src="item.avatar"></image>
  33. <view class="center">
  34. <view class="top">
  35. <text class="ellipsis">{{ item.nickname }}</text>
  36. <view class="level-name"><text class="cuIcon-crownfill"></text>{{ item.level }}</view>
  37. </view>
  38. <view class="bot">{{ item.created_at + ' 加入' }}</view>
  39. </view>
  40. <text></text>
  41. </view>
  42. <custom-reach-bottom v-if="lists[1].length" :nomore="page[1] === 0" />
  43. <swiper-status v-else :page="page[1]" unit="邀请" />
  44. </scroll-view>
  45. </swiper-item>
  46. </swiper>
  47. </pulldown-refresher>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import MIXIN from '@/mixin/swiper-list.js'
  54. import swiperStatus from '@/components/public/swiper-status.vue'
  55. import pulldownRefresher from '@/components/public/pulldown-refresher.vue'
  56. import customReachBottom from '@/components/public/custom-reach-bottom.vue'
  57. import { _API_TeamInviteActive, _API_TeamInviteNoActive } from '@/apis/team.js'
  58. export default {
  59. mixins: [MIXIN],
  60. components: { swiperStatus, customReachBottom, pulldownRefresher },
  61. data() {
  62. return {
  63. title: '我的邀请',
  64. page: [1, 1], // 每种类型的页数 当页数为 0 时表示当前类型没有更多了 -1 表示请求失败
  65. lists: { 0: [], 1: []}, // 数据
  66. typeList: ['激活(0)', '未激活(0)'],
  67. apis: [_API_TeamInviteActive, _API_TeamInviteNoActive]
  68. }
  69. },
  70. onLoad() { // 发起请求
  71. this.MIXIN_request()
  72. },
  73. methods: {
  74. MIXIN_requestHandle(res) {
  75. this.$set(this.typeList, this.MIXIN_NowIndex, this.typeList[this.MIXIN_NowIndex].replace(/\d+/g, res.data.total))
  76. },
  77. toPerson(id) {
  78. uni.navigateTo({ url: `../person-card/person-card?id=${id}` })
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .my-invite {
  85. @include page();
  86. .content {
  87. @include flex(column);
  88. .swiper-nav {
  89. text {
  90. width: 56rpx;
  91. }
  92. margin-bottom: 10rpx;
  93. }
  94. .swiper-area {
  95. scroll-view {
  96. .team-item {
  97. @include flex();
  98. height: 120rpx;
  99. padding: 0 30rpx;
  100. background: #FFFFFF;
  101. box-sizing: border-box;
  102. border-bottom: 1rpx solid $app-base-bg;
  103. .left {
  104. width: 100rpx;
  105. height: 100rpx;
  106. border-radius: 50%;
  107. }
  108. .center {
  109. @include flex(column);
  110. flex: 1;
  111. height: 100%;
  112. margin: 0 30rpx;
  113. align-items: flex-start;
  114. .top {
  115. @include flex();
  116. width: 100%;
  117. justify-content: flex-start;
  118. .ellipsis {
  119. width: 345rpx;
  120. }
  121. }
  122. .bot {
  123. font-size: 24rpx;
  124. margin-top: 8rpx;
  125. color: $app-sec-text-color;
  126. }
  127. }
  128. .right {
  129. @include flex();
  130. font-size: 32rpx;
  131. }
  132. }
  133. }
  134. margin-bottom: 10rpx;
  135. }
  136. }
  137. }
  138. </style>