search.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="hot-group">
  3. <div class="top-search">
  4. <input type="text" class="search-wrap" v-model="searchTxt" @input="searchUser($event, sessionList)" @blur="handleBlur" v-focus v-if="searchShow">
  5. <div class="search-tips search-wrap" @click="searchShow=true" v-else>
  6. <i class="el-icon-search"></i>{{$t('public.searchHotGroup')}}
  7. </div>
  8. <span @click="$router.go(-1)">{{$t('public.cancel')}}</span>
  9. </div>
  10. <template v-if="isSearch">
  11. <session-item
  12. v-for="(item, index) in searchList"
  13. :key="index"
  14. :item="item"
  15. class="current">
  16. </session-item>
  17. </template>
  18. <div class="hot-list">
  19. <hot-group :searchTxt="searchTxt"></hot-group>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import Vue from 'vue'
  25. import { Button } from 'element-ui'
  26. import { mapState } from 'vuex'
  27. import { searchUserMixin } from '@/mixins'
  28. import sessionItem from '@/components/panel/sessionItem'
  29. import hotGroup from '@/components/hotGroup/hotGroup'
  30. Vue.component(Button.name, Button)
  31. export default {
  32. name: 'searchH5',
  33. mixins: [searchUserMixin],
  34. components: {
  35. sessionItem,
  36. hotGroup
  37. },
  38. data () {
  39. return {
  40. searchShow: false,
  41. searchTxt: ''
  42. }
  43. },
  44. computed: {
  45. ...mapState({
  46. sessionList: state => state.chat.sessionList
  47. })
  48. },
  49. methods: {
  50. handleBlur (e) {
  51. let val = e.target.value
  52. if (!val) {
  53. this.searchShow = false
  54. }
  55. }
  56. },
  57. created () {}
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .top-search{
  62. height: px2rem(88);
  63. background-color: #f2f2f2;
  64. display: flex;
  65. align-items: center;
  66. justify-content: space-between;
  67. border-bottom: 1px solid #eeeeee;
  68. padding: 0 px2rem(30);
  69. .search-wrap{
  70. background-color: #ffffff;
  71. border-radius: 4px;
  72. border: 1px solid #eeeeee;
  73. width: px2rem(582);
  74. height: px2rem(60);
  75. line-height: px2rem(60);
  76. box-sizing: border-box;
  77. font-size: px2rem(28);
  78. }
  79. input{
  80. padding-left: px2rem(10);
  81. font-size: px2rem(28);
  82. color: #666666;
  83. }
  84. span{
  85. font-size: px2rem(30);
  86. color: #259af2;
  87. }
  88. }
  89. .search-tips{
  90. color: #8e8e93;
  91. i{
  92. display: inline-block;
  93. vertical-align: middle;
  94. margin: 0 px2rem(6) 0 px2rem(27);
  95. font-size: px2rem(26);
  96. }
  97. }
  98. // .avatar-wrap{
  99. // position: relative;
  100. // .icon-auth {
  101. // position: absolute;
  102. // bottom: 0;
  103. // right: 0;
  104. // width: 14px;
  105. // height: 13px;
  106. // background: url("../../../assets/icon-chat-auth.png");
  107. // }
  108. // }
  109. // .el-button{
  110. // padding: px2rem(15) px2rem(27);
  111. // font-size: px2rem(30);
  112. // margin-top: px2rem(9);
  113. // }
  114. </style>