chatMini.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div :class="['mini-wrap',{'hidden':isLoadingRoom}]">
  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="avatarUrl" v-if="avatarUrl">
  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">
  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 class="enable" @click="handleLogin">{{ $t('mini.login') }}</span>
  71. </div>
  72. <div @click="joinGroup()" v-else-if="!isJoin" class="btn-join">{{ $t('chat.joinGroup') }}</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. <div class="meechat-icon">
  106. <i class="icon-logo"></i>
  107. <em v-show="unreadCounts>0">+{{unreadCounts}}</em>
  108. </div>
  109. </div>
  110. <transition name="msgbox-fade">
  111. <div class="pub-wrapper" v-if="loginBoxVisible">
  112. <div class="pub-mask" @click="hideLoginBox"></div>
  113. <login-box @initMiniLoginCallback="initMiniLoginCallback"></login-box>
  114. </div>
  115. </transition>
  116. </div>
  117. </template>
  118. <script>
  119. import chatMini from './chatMiniHandle.js'
  120. export default chatMini
  121. </script>
  122. <style lang="scss" scoped>
  123. @import "./chatMini.scss";
  124. </style>