list.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <app-layout>
  3. <view class="container">
  4. <template v-if="lists.length > 0">
  5. <view class="cell-box main-left" v-for="(item,index) in lists":key="index">
  6. <view class="head-img">
  7. <u-image
  8. width="140"
  9. height="140"
  10. :src="item.head_img"
  11. shape="circle"></u-image>
  12. </view>
  13. <view class="nickname dir-top-wrap main-center">
  14. <view class="title main-left cross-center">
  15. <text>{{item.nickname}}</text>
  16. <u-image
  17. width="35"
  18. height="35"
  19. src="@/static/images/vip.png"
  20. v-if="item.is_vip"
  21. ></u-image>
  22. </view>
  23. <view class="sub-title">
  24. 绑定时间:{{item.become_child_at}}
  25. </view>
  26. </view>
  27. </view>
  28. <u-line></u-line>
  29. </template>
  30. <view class="no-data main-center cross-center" v-else>
  31. <text>暂无数据</text>
  32. </view>
  33. </view>
  34. </app-layout>
  35. </template>
  36. <script>
  37. import appLayout from "@/components/app-layout"
  38. export default {
  39. components:{
  40. appLayout,
  41. },
  42. data() {
  43. return {
  44. lists: [],
  45. currentPage: 1,
  46. totalPage: 0
  47. }
  48. },
  49. methods: {
  50. getList(page){
  51. this.$u.api.userShares(page).then(res => {
  52. this.currentPage = res.current_page
  53. this.totalPage = res.last_page
  54. this.lists = this.lists.concat(res.data);
  55. })
  56. }
  57. },
  58. onLoad(){
  59. this.getList();
  60. },
  61. onReachBottom(){
  62. if(this.currentPage < this.totalPage){
  63. this.getList(this.currentPage+1)
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .cell-box{
  70. padding: 30rpx 0;
  71. .head-img{}
  72. .nickname{
  73. flex: 1;
  74. padding: 0 30rpx;
  75. color: #333333;
  76. font-size: 32rpx;
  77. font-weight: 500;
  78. .title{
  79. text{
  80. margin-right: 12rpx;
  81. }
  82. }
  83. .sub-title{
  84. color: #666666;
  85. font-size: 28rpx;
  86. line-height: 2em;
  87. }
  88. }
  89. }
  90. </style>