list.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="main pt0">
  3. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/user/resume/deliver/receive/list?id=' + item.id)">
  4. <image :src="ip + item.avatar" mode="widthFix" class="avatar"></image>
  5. <view class="con">
  6. <view class="name">{{ item.name }}</view>
  7. <text class="desc">{{ item.sex }} · {{ item.age }}岁 · {{ item.experience }}</text>
  8. </view>
  9. </view>
  10. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  11. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. ip: this.http.ip,
  19. list: [],
  20. param: { pageNum: 1, pageSize: 10, isRead: 0 },
  21. loadMore: true
  22. };
  23. },
  24. onLoad(e) {
  25. this.param.positionId = e.id;
  26. this.getData();
  27. },
  28. methods: {
  29. getData() {
  30. this.http.request({
  31. url: '/app/deliver/receive/list',
  32. data: this.param,
  33. loading: 'false',
  34. success: (res) => {
  35. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  36. this.list.push(...res.data.rows);
  37. }
  38. });
  39. },
  40. go(url) {
  41. uni.navigateTo({ url: url });
  42. },
  43. //刷新数据
  44. refresh() {
  45. this.loadMore = true;
  46. this.param.pageNum = 1;
  47. this.list = [];
  48. this.getData();
  49. }
  50. },
  51. //下拉刷新
  52. onPullDownRefresh() {
  53. setTimeout(() => {
  54. this.refresh();
  55. uni.stopPullDownRefresh();
  56. }, 1000);
  57. },
  58. //上拉加载
  59. onReachBottom() {
  60. if (this.loadMore) {
  61. this.param.pageNum++;
  62. this.getData();
  63. }
  64. }
  65. };
  66. </script>
  67. <style lang="scss">
  68. .item {
  69. background-color: white;
  70. border-radius: 7px;
  71. padding: 15px;
  72. overflow: hidden;
  73. margin-bottom: 12px;
  74. .avatar {
  75. float: left;
  76. width: 50px;
  77. height: 50px;
  78. border-radius: 50%;
  79. }
  80. .con {
  81. float: left;
  82. padding-left: 10px;
  83. .name {
  84. font-weight: bold;
  85. padding-bottom: 3px;
  86. }
  87. .desc {
  88. color: $font-c;
  89. font-size: 14px;
  90. }
  91. }
  92. }
  93. </style>