panel.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="c-panel">
  3. <div class="c-panel-header">
  4. <div class="avatar-wrap" @click="$showUserInfo" v-if="userInfo">
  5. <img v-if="userInfo.cover_photo" :src="userInfo.cover_photo" alt="">
  6. <div v-else class="user-avatar"
  7. :class="'avatar_bg' + userInfo.user_id % 9"
  8. :data-name="userInfo.nick_name.slice(0,2).toUpperCase()"></div>
  9. </div>
  10. <ul class="panel-ctrls">
  11. <li class="current">
  12. <i class="mee-icon-chat"></i>
  13. </li>
  14. </ul>
  15. </div>
  16. <div class="c-panel-nav">
  17. <div class="panel-searbar">
  18. <div class="input-con">
  19. <i class="el-icon-search"></i>
  20. <input type="text" @input="searchUser($event, sessionList)" placeholder="搜索">
  21. </div>
  22. <i class="el-icon-plus" @click="$showInvite"></i>
  23. </div>
  24. <!-- <div class="group-recommand">
  25. <i class="group-icon"></i>
  26. <p class="title">熱門群組推薦<i class="el-icon-arrow-right"></i></p>
  27. </div> -->
  28. <div class="chat-list pub-scroll-box">
  29. <template v-if="!isSearch">
  30. <session-item
  31. v-for="(item, index) in sessionList"
  32. :key="index"
  33. :item="item">
  34. </session-item>
  35. </template>
  36. <template v-else>
  37. <session-item
  38. v-for="(item, index) in searchList"
  39. :key="index"
  40. :item="item">
  41. </session-item>
  42. </template>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import { mapState } from 'vuex'
  49. import sessionItem from './sessionItem'
  50. import { searchUserMixin } from '@/mixins'
  51. export default {
  52. name: 'panel',
  53. mixins: [searchUserMixin],
  54. data () {
  55. return {
  56. }
  57. },
  58. computed: {
  59. ...mapState({
  60. sessionList: state => state.chat.sessionList,
  61. userInfo: state => state.userInfo
  62. })
  63. },
  64. components: {
  65. sessionItem
  66. },
  67. created () {
  68. this.$store.dispatch('getSessionList')
  69. this.$store.dispatch('getUserInfo')
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. @import './panel.scss';
  75. </style>