group.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="tab-page group">
  3. <view class="nav-bar">
  4. <view class="nav-search">
  5. <uni-search-bar v-model="searchText" cancelButton="none" radius="100"
  6. placeholder="点击搜索群聊"></uni-search-bar>
  7. </view>
  8. <view class="nav-add" @click="onCreateNewGroup()">
  9. <uni-icons type="personadd" size="35"></uni-icons>
  10. </view>
  11. </view>
  12. <view class="group-tip" v-if="groupStore.groups.length==0">
  13. 温馨提示:您现在还没有加入任何群聊,点击右上方'+'按钮可以创建群聊哦~
  14. </view>
  15. <view class="group-items" v-else>
  16. <scroll-view class="scroll-bar" scroll-with-animation="true" scroll-y="true">
  17. <view v-for="group in groupStore.groups" :key="group.id">
  18. <group-item v-if="!group.quit&&group.showGroupName.includes(searchText)"
  19. :group="group"></group-item>
  20. </view>
  21. </scroll-view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. groupStore: this.useGroupStore(),
  30. searchText: ""
  31. }
  32. },
  33. methods: {
  34. onFocusSearch() {
  35. },
  36. onCreateNewGroup() {
  37. uni.navigateTo({
  38. url: "/pages/group/group-edit"
  39. })
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .group {
  46. position: relative;
  47. border: #dddddd solid 1px;
  48. display: flex;
  49. flex-direction: column;
  50. .nav-bar {
  51. padding: 2rpx 10rpx;
  52. display: flex;
  53. align-items: center;
  54. background-color: white;
  55. .nav-search {
  56. flex: 1;
  57. }
  58. .nav-add {
  59. cursor: pointer;
  60. }
  61. }
  62. .group-tip {
  63. position: absolute;
  64. top: 400rpx;
  65. padding: 50rpx;
  66. text-align: left;
  67. line-height: 50rpx;
  68. color: darkblue;
  69. font-size: 30rpx;
  70. }
  71. .group-items {
  72. flex: 1;
  73. padding: 0;
  74. border: #dddddd solid 1px;
  75. overflow: hidden;
  76. position: relative;
  77. .scroll-bar {
  78. height: 100%;
  79. }
  80. }
  81. }
  82. </style>