ChooseTabs.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="tab_container">
  3. <template v-for="item in tabs">
  4. <setting-item
  5. v-if="
  6. !(!showGroup && item.idx === 2) &&
  7. !(!showConversation && item.idx === 0)
  8. "
  9. @click="tabChange(item.idx)"
  10. :key="item.idx"
  11. :title="item.title"
  12. :border="false"
  13. />
  14. </template>
  15. <view class="tab_pane" v-show="activeTab === 0">
  16. <choose-index-list
  17. @itemClick="userClick"
  18. :height="getListHeight"
  19. :indexList="indexList"
  20. :itemArr="itemArr"
  21. :showCheck="showCheck"
  22. />
  23. </view>
  24. <view class="tab_pane" v-show="activeTab === 1">
  25. <u-list class="member_list" :style="{ height: getListHeight }">
  26. <u-list-item v-for="(item, index) in indexList" :key="index">
  27. <user-item @itemClick="groupClick" :checkVisible="showCheck" />
  28. </u-list-item>
  29. </u-list>
  30. </view>
  31. <choose-index-footer v-if="showCheck" @confirm="confirm" />
  32. </view>
  33. </template>
  34. <script>
  35. import { ContactChooseTypes } from "../../../../constant";
  36. import UserItem from "../../../../components/UserItem/index.vue";
  37. import ChooseIndexList from "../../../../components/ChooseIndexList/index.vue";
  38. import ChooseIndexFooter from "../../../../components/ChooseIndexFooter/index.vue";
  39. import SettingItem from "../../../../components/SettingItem/index.vue";
  40. export default {
  41. name: "",
  42. components: {
  43. UserItem,
  44. ChooseIndexFooter,
  45. ChooseIndexList,
  46. SettingItem,
  47. },
  48. props: {
  49. type: String,
  50. },
  51. data() {
  52. return {
  53. activeTab: 0,
  54. // card forward merge invite create_group create_work_group remove
  55. chooseType: "invite",
  56. tabs: [
  57. {
  58. idx: 0,
  59. title: "按好友选",
  60. icon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/contact_choose_friend.png",
  61. activeIcon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/contact_choose_friend_active.png",
  62. },
  63. {
  64. idx: 1,
  65. title: "按群聊选",
  66. icon:"https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/contact_choose_group.png",
  67. activeIcon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/contact_choose_group_active.png",
  68. },
  69. ],
  70. };
  71. },
  72. computed: {
  73. getListHeight() {
  74. const statusBar = uni.getWindowInfo().statusBarHeight;
  75. return (
  76. uni.getWindowInfo().safeArea.height -
  77. statusBar -
  78. 58 -
  79. 97 -
  80. (this.showCheck ? 72 : 0) -
  81. 44 +
  82. "px"
  83. );
  84. },
  85. showCheck() {
  86. return this.type !== ContactChooseTypes.Card;
  87. },
  88. },
  89. methods: {
  90. tabChange(idx) {
  91. this.activeTab = idx;
  92. },
  93. groupClick() {},
  94. userClick() {},
  95. confirm() {
  96. // if (this.type === GroupMemberListTypes.Invite) {
  97. // IMSDK.asyncApi(IMSDK.IMMethods.InviteUserToGroup, IMSDK.uuid(), this.groupID, '', this
  98. // .choosedData.map(user => user.userID))
  99. // .then(() => this.showToast('操作成功', () => uni.navigateBack())).catch(() => this.showToast('操作失败'));
  100. // return;
  101. // }
  102. },
  103. },
  104. };
  105. </script>
  106. <style lang="scss" scoped>
  107. .tab_container {
  108. @include colBox(false);
  109. height: 100vh;
  110. overflow: hidden;
  111. .tabs_bar {
  112. @include vCenterBox();
  113. justify-content: space-evenly;
  114. .tab_item {
  115. @include colBox(false);
  116. align-items: center;
  117. img {
  118. width: 50px;
  119. height: 50px;
  120. }
  121. }
  122. }
  123. .tab_pane {
  124. flex: 1;
  125. margin-top: 24px;
  126. .member_list {
  127. ::v-deep uni-scroll-view {
  128. max-height: 100% !important;
  129. }
  130. }
  131. .member_anchor {
  132. background-color: #f8f8f8 !important;
  133. border: none !important;
  134. }
  135. }
  136. }
  137. </style>