index.vue 4.1 KB

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