chatMini.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. <div class="box-ft">
  62. <chat-at
  63. ref="chatAt"
  64. v-if="atShow"
  65. @atperson="atPerson"
  66. :curInd="atInd"
  67. :filterList="filterMembers">
  68. </chat-at>
  69. <div class="input-ctrl" v-if="showLoginBtn">
  70. <span v-if="showLoginBtn === 'loading'">{{ $t('mini.logining') }}</span>
  71. <span v-else class="enable" @click="handleLogin">{{ $t('mini.login') }}</span>
  72. </div>
  73. <div class="input-con" v-else>
  74. <div class="more-icon" @click.stop="handleMoreClick"></div>
  75. <form class="input-wrap" @submit="handleSend">
  76. <textarea
  77. @keydown.up="handleUp"
  78. @keydown.down="handleDown"
  79. @keydown.left="handleLeft"
  80. @keydown.right="handleRight"
  81. @keydown.delete="handleDel"
  82. @keydown.esc="handleEsc"
  83. cols="1"
  84. ref="chatInput"
  85. rows="1"
  86. @keydown.enter="handleKeyDown"
  87. placeholder="Write a message"
  88. v-model="inputMsg"
  89. @focus="handleFocus"
  90. @blur="handleBlur"
  91. :style="{height:inputHeight}"
  92. />
  93. </form>
  94. <div class="emoji-icon" @click.stop="handleEmojiClick"></div>
  95. <div class="btn-send" @click="handleSend">{{ $t('chat.send') }}</div>
  96. </div>
  97. <toolbar ref="toolbar" :toolShow="toolShow" @handleFile="handleFile"></toolbar>
  98. <emoji @addEmoji="addEmoji" :emojiShow="showEmoji" v-show="showEmoji" @closeEmojiList="closeEmojiList"></emoji>
  99. </div>
  100. </div>
  101. <div class="pub-loading" v-show="isLoadingRoom"></div>
  102. </div>
  103. <div @click="handleToggleChat(true)" class="mini-control" v-show="!showChat">
  104. <i class="at-tip" v-show="atList.length">@</i>
  105. <ul v-if="unreadCounts > 0">
  106. <li class="msg-tips">
  107. <em>+{{unreadCounts}}</em>
  108. </li>
  109. <li class="user-tips">
  110. <em>{{group.membersNum}}</em>
  111. </li>
  112. </ul>
  113. <div class="meechat-icon" v-else>
  114. <i class="user-tips">
  115. <em>{{group.membersNum}}</em>
  116. </i>
  117. </div>
  118. </div>
  119. <transition name="msgbox-fade">
  120. <div class="pub-wrapper" v-if="loginBoxVisible">
  121. <div class="pub-mask" @click="loginBoxVisible=false"></div>
  122. <login-box @initMiniLoginCallback="initMiniLoginCallback"></login-box>
  123. </div>
  124. </transition>
  125. </div>
  126. </template>
  127. <script>
  128. import chatMini from './chatMiniHandle.js'
  129. export default chatMini
  130. </script>
  131. <style lang="scss" scoped>
  132. @import "./chatMini.scss";
  133. </style>