1
0

friend.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <app-layout>
  3. <view class='top'>
  4. <view class='top-item'>
  5. <view class='top-num'>{{count}}</view>
  6. <view>邀请好友总数</view>
  7. </view>
  8. <view class='line'></view>
  9. <view class='top-item'>
  10. <view class='top-num'>{{now_count}}</view>
  11. <view>今日邀请好友</view>
  12. </view>
  13. </view>
  14. <view class='list'>
  15. <view class='list-title'>
  16. <text>助力好友</text>
  17. <text class='title-right'>助力时间</text>
  18. </view>
  19. <view class='list-item' v-for="item in list" :key="item.id">
  20. <view class='user-avatar'>
  21. <image :src='item.avatar'></image>
  22. </view>
  23. <view class='name'>{{item.nickname}}</view>
  24. <view class='time'>{{item.created_at}}</view>
  25. </view>
  26. <view class='list-item' v-if="list.length == 0">
  27. <view class='no-friend'>暂无助力好友</view>
  28. </view>
  29. <view class='loading' v-if="loading">正在加载中...</view>
  30. </view>
  31. </app-layout>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. list: [],
  38. count: 0,
  39. now_count: 0,
  40. page: 2,
  41. loading: false,
  42. more_list: false,
  43. }
  44. },
  45. methods: {
  46. getMore() {
  47. let that = this;
  48. that.$request({
  49. url: that.$api.step.invite_list,
  50. data: {
  51. page: that.page
  52. },
  53. }).then(response=>{
  54. that.$hideLoading();
  55. if(response.code == 0) {
  56. that.list = that.list.concat(response.data.list);
  57. that.page++;
  58. that.more_list = false;
  59. if (response.data.list.length == 15) {
  60. that.more_list = true;
  61. }
  62. }else {
  63. uni.showToast({
  64. title: response.msg,
  65. icon: 'none',
  66. duration: 1000
  67. });
  68. }
  69. }).catch(response => {
  70. that.$hideLoading();
  71. });
  72. },
  73. getList() {
  74. let that = this;
  75. that.$request({
  76. url: that.$api.step.invite_list,
  77. }).then(response=>{
  78. that.$hideLoading();
  79. if(response.code == 0) {
  80. that.list = response.data.list;
  81. that.count = response.data.count;
  82. that.now_count = response.data.now_count;
  83. that.more_list = false;
  84. if (response.data.list.length == 15) {
  85. that.more_list = true;
  86. }
  87. }else {
  88. uni.showToast({
  89. title: response.msg,
  90. icon: 'none',
  91. duration: 1000
  92. });
  93. }
  94. }).catch(response => {
  95. that.$hideLoading();
  96. });
  97. },
  98. },
  99. onReachBottom: function () {
  100. if (!this.more_list) {
  101. this.getMore();
  102. }
  103. },
  104. onLoad() {
  105. let that = this;
  106. that.$showLoading({
  107. type: 'global',
  108. text: '加载中...'
  109. });
  110. that.getList();
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. .top{
  116. margin: #{24rpx} #{24rpx} #{20rpx};
  117. background-color: #fff;
  118. height: #{200rpx};
  119. position: relative;
  120. color: #999999;
  121. padding: #{50rpx} 0;
  122. font-size: #{24rpx};
  123. border-radius: #{16rpx};
  124. }
  125. .title-right{
  126. float: right;
  127. }
  128. .top-num{
  129. font-size: #{48rpx};
  130. color: #ff9d1e;
  131. font-family: 'DIN';
  132. margin-bottom: #{5rpx};
  133. }
  134. .line{
  135. position: absolute;
  136. top: #{50rpx};
  137. left: 50%;
  138. height: #{100rpx};
  139. width: #{2rpx};
  140. background-color: #e2e2e2;
  141. }
  142. .top-item{
  143. width: 50%;
  144. float: left;
  145. text-align: center;
  146. }
  147. .list{
  148. background-color: white;
  149. padding: #{32rpx} #{32rpx} #{16rpx};
  150. border-radius: #{16rpx};
  151. margin: 0 #{24rpx} #{24rpx};
  152. }
  153. .list-title{
  154. font-size: #{38rpx};
  155. color: #353535;
  156. margin-bottom: #{38rpx};
  157. }
  158. .list-item{
  159. padding-bottom: #{38rpx};
  160. height: #{88rpx};
  161. }
  162. .list-item .user-avatar{
  163. height: #{56rpx};
  164. width: #{56rpx};
  165. margin-right: #{24rpx};
  166. float: left;
  167. }
  168. .user-avatar image{
  169. height: 100%;
  170. width: 100%;
  171. border-radius: #{28rpx};
  172. }
  173. .name{
  174. float: left;
  175. font-size: #{30rpx};
  176. color: #353535;
  177. width: #{300rpx};
  178. overflow: hidden;
  179. text-overflow: ellipsis;
  180. white-space: nowrap;
  181. vertical-align: top;
  182. height: #{56rpx};
  183. line-height: #{56rpx};
  184. }
  185. .time{
  186. float: right;
  187. font-size: #{24rpx};
  188. color: #999999;
  189. vertical-align: top;
  190. height: #{56rpx};
  191. line-height: #{56rpx};
  192. }
  193. .no-friend{
  194. margin-top: #{120rpx};
  195. text-align: center;
  196. }
  197. .loading {
  198. font-size: #{24rpx};
  199. color: #353535;
  200. text-align: center;
  201. height: #{80rpx};
  202. line-height: #{80rpx};
  203. background-color: white;
  204. }
  205. </style>