chatMini.vue 5.8 KB

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