index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="cantacts">
  3. <view style="padding: 10px;">
  4. <My_search placeholder="搜索名称,手机号" @onSearch="onSearch"></My_search>
  5. </view>
  6. <view class="content">
  7. <view class="type-list">
  8. <u-list>
  9. <u-list-item v-for="(item,index) in groupList" :key="item.sys_phonebookgroupid">
  10. <view :class="['type-item',act == index ? 'active' : '']" @click="typeClick(index,item)">
  11. {{ item.groupname }}
  12. </view>
  13. </u-list-item>
  14. </u-list>
  15. </view>
  16. <view class="list">
  17. <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
  18. <List :list="list"></List>
  19. </My_listbox>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import List from './list.vue'
  26. export default {
  27. components:{List},
  28. data () {
  29. return {
  30. list:[],
  31. content: {
  32. "pageNumber": 1,
  33. "pageSize": 20,
  34. "where": {
  35. "condition": "",
  36. "groupname": ""
  37. }
  38. },
  39. groupParam: {
  40. "id": "20240516135202",
  41. "content": {
  42. "pageNumber": 1,
  43. "pageSize": 99999,
  44. "where": {
  45. "isenable": 1
  46. }
  47. },
  48. },
  49. groupList:[],
  50. act:0
  51. }
  52. },
  53. methods: {
  54. onSearch (condition) {
  55. this.content.where.condition = condition
  56. this.getList(true)
  57. },
  58. typeClick (index,item) {
  59. this.act = index
  60. this.content.where.groupname = item.groupname
  61. this.getList(true)
  62. },
  63. getList(init = false) {
  64. return new Promise((resolve, reject) => {
  65. if (this.paging(this.content, init)) return resolve();
  66. this.$Http.basic({
  67. "id": "20240516144502",
  68. content: this.content
  69. }).then(res => {
  70. this.$refs.List.setHeight()
  71. this.$refs.List.RefreshToComplete()
  72. resolve();
  73. if (this.cutoff(res.msg)) return;
  74. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  75. console.log("获取通讯录列表", this.list)
  76. this.content = this.$refs.List.paging(this.content, res)
  77. })
  78. })
  79. },
  80. async getGroup () {
  81. let res = await this.$Http.basic(this.groupParam)
  82. this.groupList = res.data
  83. if (this.groupList.length) this.content.where.groupname = this.groupList[0].groupname
  84. this.getList()
  85. console.log(this.groupList,'分组列表');
  86. },
  87. onLoad () {
  88. uni.setNavigationBarTitle({
  89. title:'通讯录',
  90. })
  91. this.getGroup()
  92. }
  93. },
  94. }
  95. </script>
  96. <style lang="scss">
  97. .cantacts {
  98. box-sizing: border-box;
  99. background: #ffffff;
  100. .content {
  101. font-family: Source Han Sans SC, Source Han Sans SC;
  102. display: flex;
  103. .type-list {
  104. background: #F7F7F7;
  105. width: 90px;
  106. .type-item {
  107. font-weight: 400;
  108. font-size: 14px;
  109. color: #333333;
  110. display: flex;
  111. align-items: center;
  112. background: #F7F7F7;
  113. align-content: center;
  114. padding: 12px 16px;
  115. }
  116. }
  117. .active {
  118. background: #ffffff !important;
  119. }
  120. .list {
  121. flex: 1;
  122. }
  123. }
  124. }
  125. </style>