userList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="contacts-v">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :sticky="true"
  4. :down="downOption" :up="upOption" :bottombar="false">
  5. <view class="search-box search-box_sticky">
  6. <u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
  7. :show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
  8. </u-search>
  9. </view>
  10. <view class="list-cell u-p-l-20 u-p-r-20" v-for="(item, i) in list" :key="i" @click="detail(item)">
  11. <view class="u-border-bottom list-item u-font-28 u-flex">
  12. <u-avatar :src="baseURL+item.headIcon"></u-avatar>
  13. <view class="list-cell-txt">
  14. <view class="u-font-30 u-m-b-4" style="color: #303133;font-size: 28rpx;">
  15. {{item.realName}}/{{item.account}}
  16. </view>
  17. <view class="u-font-24 department u-m-t-4">{{item.department}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </mescroll-body>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getUserList
  27. } from '@/api/common.js'
  28. import resources from '@/libs/resources.js'
  29. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  30. export default {
  31. mixins: [MescrollMixin],
  32. data() {
  33. return {
  34. downOption: {
  35. use: true,
  36. auto: true
  37. },
  38. upOption: {
  39. page: {
  40. num: 0,
  41. size: 20,
  42. time: null
  43. },
  44. empty: {
  45. use: true,
  46. icon: resources.message.nodata,
  47. tip: this.$t('common.noData'),
  48. fixed: true,
  49. top: "300rpx",
  50. },
  51. textNoMore: this.$t('app.apply.noMoreData'),
  52. },
  53. keyword: '',
  54. list: [],
  55. organizeId: '',
  56. organizeName: '',
  57. positionId: ''
  58. }
  59. },
  60. computed: {
  61. baseURL() {
  62. return this.define.baseURL
  63. }
  64. },
  65. onLoad(e) {
  66. const config = JSON.parse(decodeURIComponent(e.config))
  67. this.organizeId = config.organizeId
  68. this.organizeName = config.organizeName
  69. this.positionId = config.positionId
  70. uni.setNavigationBarTitle({
  71. title: config.organizeName
  72. })
  73. },
  74. methods: {
  75. upCallback(page) {
  76. let query = {
  77. currentPage: page.num,
  78. pageSize: page.size,
  79. keyword: this.keyword,
  80. organizeId: this.organizeId,
  81. organizeName: this.organizeName,
  82. positionId: this.positionId || ""
  83. }
  84. getUserList(query).then(res => {
  85. this.mescroll.endSuccess(res.data.list.length);
  86. if (page.num == 1) this.list = [];
  87. const list = res.data.list || [];
  88. this.list = this.list.concat(list);
  89. }).catch(() => {
  90. this.mescroll.endErr();
  91. })
  92. },
  93. search() {
  94. // 节流,避免输入过快多次请求
  95. this.searchTimer && clearTimeout(this.searchTimer)
  96. this.searchTimer = setTimeout(() => {
  97. this.list = [];
  98. this.mescroll.resetUpScroll();
  99. }, 300)
  100. },
  101. detail(item) {
  102. uni.navigateTo({
  103. url: '/pages/my/userDetail/index?data=' + encodeURIComponent(JSON.stringify(
  104. item))
  105. })
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. page {
  112. background-color: #eef0f4;
  113. }
  114. .contacts-v {
  115. .organization {
  116. width: 100%;
  117. background-color: #fff;
  118. padding: 20rpx;
  119. font-size: 32rpx;
  120. }
  121. .list-cell {
  122. width: 100%;
  123. background-color: #fff;
  124. .list-item {
  125. box-sizing: border-box;
  126. overflow: hidden;
  127. color: $u-content-color;
  128. height: 136rpx;
  129. .list-cell-txt {
  130. margin-left: 20rpx;
  131. .department {
  132. color: #909399;
  133. font-size: 24rpx;
  134. }
  135. }
  136. }
  137. }
  138. }
  139. </style>