familyList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  3. <view class="card" v-for="(item,index) in user_list" :key="index">
  4. <view class="alignCenter">
  5. <image :src="item.imageUri?item.imageUri:'http://139.9.103.171:1888/img/image/head.png'" mode="scaleToFill"></image>
  6. </view>
  7. <view class="content">
  8. <view class="flex">
  9. <text class="name">{{item.name}}</text>
  10. <view style="margin:8rpx 0 0 15rpx;" class="cu-tag sm line-blue radius">
  11. <text v-if="item.type==0">业主</text>
  12. <text v-if="item.type==1">家属</text>
  13. <text v-if="item.type==2">租客</text>
  14. </view>
  15. </view>
  16. <view class="padding-top-20 ">
  17. <text class="cuIcon-mobile text-blue padding-right-10"></text>
  18. <text>{{item.tel}}</text>
  19. </view>
  20. <view class="padding-top-10 ">
  21. <text class="cuIcon-vipcard text-blue padding-right-10"></text>
  22. <text>{{item.idCard || '暂无'}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </mescroll-body>
  27. </template>
  28. <script>
  29. import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
  30. export default {
  31. mixins: [MescrollMixin], // 使用mixin
  32. name: '',
  33. data() {
  34. return {
  35. room_id:'',
  36. user_list:[],
  37. downOption:{
  38. auto:false,
  39. use:true
  40. },
  41. upOption:{
  42. auto:true,
  43. use:true,
  44. noMoreSize:5
  45. }
  46. };
  47. },
  48. onLoad(options) {
  49. this.room_id=options.room_id
  50. },
  51. methods:{
  52. /**
  53. * 下拉刷新回调
  54. */
  55. downCallback(){
  56. setTimeout(()=>{
  57. uni.showToast({
  58. title:"刷新成功",
  59. icon:"none"
  60. })
  61. this.mescroll.resetUpScroll()
  62. },1500)
  63. },
  64. upCallback(mescroll){
  65. let that=this
  66. let params = {
  67. pageSize:mescroll.size,
  68. pageNum:mescroll.num,
  69. room_id:this.room_id
  70. };
  71. let operation = 'user/getUserByRoomId';
  72. try{
  73. getApp().globalData.postRequest(params,operation,(res)=>{
  74. let data=res.data.list
  75. //不推荐
  76. mescroll.endSuccess(data.length)
  77. //推荐用下面这个,但是后台没有给我返回total
  78. // this.mescroll.endBySize(data.length, total)
  79. if(mescroll.num == 1) that.user_list = []
  80. that.user_list = that.user_list.concat(data)
  81. })
  82. this.user_list
  83. }catch(e){
  84. mescroll.endErr()
  85. }
  86. }
  87. }
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .card{
  92. background-color: #FFFFFF;
  93. // margin: 20rpx;
  94. margin-bottom: 2rpx;
  95. padding:30rpx 20rpx;
  96. // border-radius: 10rpx;
  97. display: flex;
  98. box-sizing: border-box;
  99. image{
  100. width: 120rpx;
  101. height: 120rpx;
  102. border-radius: 50%;
  103. }
  104. .content{
  105. display: flex;
  106. flex-direction: column;
  107. padding-left: 20rpx;
  108. .name{
  109. font-size: 32rpx;
  110. font-weight: 600;
  111. }
  112. }
  113. }
  114. </style>