index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <u-index-list @scrolltolower="scrolltolower" class="user_list" activeColor="#FF5C03" inactiveColor="#757575" :style="{ height: height }" :index-list="indexList">
  3. <template v-for="(item, index) in itemArr">
  4. <u-index-item :key="index">
  5. <u-index-anchor class="user_anchor" :text="indexList[index]"></u-index-anchor>
  6. <user-item
  7. @itemClick="itemClick"
  8. @updateCheck="updateCheck"
  9. :checked="checkedIDList.includes(cell.userID)"
  10. :disabled="disabledIDList.includes(cell.userID)"
  11. :checkVisible="showCheck"
  12. v-for="cell in item"
  13. :item="cell"
  14. :key="cell.userID"
  15. />
  16. </u-index-item>
  17. </template>
  18. <view v-if="showBot" class="friendCount">{{ this.friendsNum }}个好友</view>
  19. </u-index-list>
  20. </template>
  21. <script>
  22. import UserItem from '../UserItem/index.vue';
  23. export default {
  24. name: 'ChooseIndexList',
  25. components: {
  26. UserItem
  27. },
  28. props: {
  29. height: {
  30. type: String,
  31. default: '0px'
  32. },
  33. indexList: {
  34. type: Array,
  35. default: () => []
  36. },
  37. itemArr: {
  38. type: Array,
  39. default: () => []
  40. },
  41. checkedIDList: {
  42. type: Array,
  43. default: () => []
  44. },
  45. disabledIDList: {
  46. type: Array,
  47. default: () => []
  48. },
  49. showCheck: {
  50. type: Boolean,
  51. default: false
  52. }
  53. },
  54. mounted() {
  55. setTimeout(()=>{
  56. this.showBot=this.indexList.length>0;
  57. },1000);
  58. this.getFriendsCount();
  59. },
  60. data() {
  61. return {
  62. showBot:false,
  63. friendsNum:0
  64. };
  65. },
  66. methods: {
  67. itemClick(item) {
  68. this.$emit('itemClick', item);
  69. },
  70. updateCheck(item) {
  71. this.$emit('updateCheck', item);
  72. },
  73. scrolltolower() {
  74. this.$emit('scrolltolower');
  75. },
  76. getFriendsCount(){
  77. for (var index = 0; index < this.itemArr.length; index++) {
  78. let itemArr = this.itemArr[index];
  79. this.friendsNum+=itemArr.length;
  80. }
  81. }
  82. }
  83. };
  84. </script>
  85. <style scoped lang="scss">
  86. .user_list {
  87. flex: 1;
  88. ::v-deep uni-scroll-view {
  89. max-height: 100% !important;
  90. }
  91. }
  92. .user_anchor {
  93. background-color: #f8f8f8 !important;
  94. border: none !important;
  95. }
  96. .friendCount{
  97. font-size: 20px;
  98. color: #666;
  99. text-align: center;
  100. height: 80rpx;
  101. line-height: 80rpx;
  102. margin-bottom: 30px;
  103. }
  104. </style>