chatMini.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="mini-wrap">
  3. <div class="mini-body" :class="{'moblie-wrap': isMobile}" v-show="showChat">
  4. <div class="box">
  5. <div class="box-hd">
  6. <div class="btn-menu" :class="[{'active':personUnRead>0}]" @click.stop="showMenuExtra = !showMenuExtra"></div>
  7. <div class="box-title" @click.stop="showMenuExtra = !showMenuExtra">{{group.groupName}} ({{group.membersNum}})</div>
  8. <div class="btn-close" @click="handleToggleChat(false)"></div>
  9. <p class="user-tips" v-if="showLoginBtn" @click="handleLogin"><em>{{ $t('mini.server') }}</em></p>
  10. <a class="user-tips" v-else :class="[{'active':serverUnRead>0}]" :href="linkToCreator" target="meechatpc" @click="clearPmUnread(1)">
  11. <em>{{ $t('mini.server') }}</em>
  12. </a>
  13. <ul class="menu-extra" v-show="showMenuExtra">
  14. <div class="info clearfix" v-if="account && userInfo">
  15. <img class="avatar" :src="`${userInfo.cover_photo}?imageview/0/w/180`" v-if="userInfo.cover_photo">
  16. <span class="avatar avatar-bg" v-else>{{userInfo.nick_name.slice(0,2).toUpperCase() || userInfo.user_name.slice(0,2).toUpperCase()}}</span>
  17. <span class="account-info">
  18. <em>{{userInfo.nick_name || userInfo.user_name}}</em>
  19. <i class="login-out" href="javascript:void(0);" @click="handleLogout">{{ $t('mini.logout') }}</i>
  20. </span>
  21. </div>
  22. <li v-if="account && userInfo" @click="$showUserInfo"><a href="#">{{ $t('mini.accountSetting') }}</a></li>
  23. <li v-if="group.groupId"><a :href="`/#/group/${group.groupId}`" target="meechatpc" @click="clearPmUnread(2)">{{ $t('mini.openWeb') }}<em v-show="personUnRead>0">{{personUnRead}}</em></a></li>
  24. <li @click="changeLang"><a href="javascript:;">{{curLang=="en"?'中文':'English'}}</a></li>
  25. <li><a href="https://www.mee.chat/" target="_blank">
  26. Powered by <span>MeeChat</span>
  27. </a></li>
  28. </ul>
  29. </div>
  30. <chat-pin v-bind="pinMsg" @pinMsgClose="pinMsgClose" @scrollToView="scrollToView"></chat-pin>
  31. <div class="box-bd" ref="msgBox">
  32. <div ref="scrollWrap"
  33. @scroll.prevent="handleScroll"
  34. class="scroller"
  35. >
  36. <div ref="msgWrap" class="msg-wrap">
  37. <div class="msg-top-more" v-if="lockEnd">
  38. <em>{{ $t('chat.noMore') }}</em>
  39. </div>
  40. <div class="msg-top-load" v-if="lockMore && !lockEnd">
  41. <i class="msg-loading-icon"></i>
  42. </div>
  43. <msg-item v-for="item in chatList"
  44. :key="item.hash"
  45. v-bind="item"
  46. :msgItem="item"
  47. :isMobile="isMobile"
  48. :isAdmin="isAdmin"
  49. @quoteMsg="quoteMsg"
  50. @deleteMsg="deleteMsg"
  51. ></msg-item>
  52. </div>
  53. </div>
  54. <at-me :atList="atList" class="mini" @scrollToMsg="scrollToMsg"></at-me>
  55. <div class="msg-unread"
  56. @click="doSetRead"
  57. v-if="unreadNums > 0 && enableScroll && !isBottom">
  58. <em><i class="el-icon-d-arrow-right"></i>{{unreadNums}}{{ $t('chat.unreadMsg') }}</em>
  59. </div>
  60. </div>
  61. <room-tool
  62. @resizeToBottom='resizeToBottom'
  63. @handleLogin='handleLogin'
  64. :showLoginBtn="showLoginBtn"></room-tool>
  65. </div>
  66. <div class="pub-loading" v-show="isLoadingRoom"></div>
  67. </div>
  68. <div @click="handleToggleChat(true)" class="mini-control" v-show="!showChat">
  69. <i class="at-tip" v-show="atList.length">@</i>
  70. <ul v-if="unreadCounts > 0">
  71. <li class="msg-tips">
  72. <em>+{{unreadCounts}}</em>
  73. </li>
  74. <li class="user-tips">
  75. <em>{{group.membersNum}}</em>
  76. </li>
  77. </ul>
  78. <div class="meechat-icon" v-else>
  79. <i class="user-tips">
  80. <em>{{group.membersNum}}</em>
  81. </i>
  82. </div>
  83. </div>
  84. <transition name="msgbox-fade">
  85. <div class="pub-wrapper" v-if="loginBoxVisible">
  86. <div class="pub-mask" @click="loginBoxVisible=false"></div>
  87. <login-box @initMiniLoginCallback="initMiniLoginCallback"></login-box>
  88. </div>
  89. </transition>
  90. </div>
  91. </template>
  92. <script>
  93. import chatMini from './chatMiniHandle.js'
  94. export default chatMini
  95. </script>
  96. <style lang="scss" scoped>
  97. @import "./chatMini.scss";
  98. </style>