chatRoom.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="c-view">
  3. <div class="box">
  4. <div class="box-hd">
  5. <div class="title-wrap">
  6. {{isPrivate ? group.privateName : group.groupName}}
  7. <span v-if="!isPrivate">({{group.membersNum}})</span>
  8. <a :href="group.url" target="_blank" class="icon-link" v-if="!isPrivate && group.url"></a>
  9. <i
  10. class="el-icon-more"
  11. v-if="!isPrivate"
  12. @click.stop="groupSet = !groupSet"
  13. ></i>
  14. </div>
  15. </div>
  16. <chat-pin v-bind="pinMsg" @pinMsgClose="pinMsgClose" @scrollToView="scrollToView"></chat-pin>
  17. <div class="box-bd" :class="{'hidden': bdHiden}">
  18. <div ref="scrollWrap" class="bar" @scroll="handleScroll">
  19. <div ref="msgWrap" class="scroll-wrapper">
  20. <div class="msg-wrap">
  21. <div class="msg-top-more" v-if="lockEnd">
  22. <em>{{ $t('chat.noMore') }}</em>
  23. </div>
  24. <div class="msg-top-load" v-if="lockMore && !lockEnd">
  25. <i class="msg-loading-icon"></i>
  26. </div>
  27. <msg-item
  28. v-for="(item, key) in chatList"
  29. :key="key"
  30. :isPrivate="isPrivate"
  31. :msgItem="item"
  32. :isAdmin="isAdmin"
  33. v-bind="item"
  34. @quoteMsg="quoteMsg"
  35. @deleteMsg="deleteMsg"
  36. ></msg-item>
  37. </div>
  38. </div>
  39. </div>
  40. <at-me v-if="!isPrivate" :atList="atList" @scrollToMsg="scrollToMsg"></at-me>
  41. <div
  42. class="msg-unread"
  43. @click="doSetRead"
  44. v-if="group.unreadNums > 0 && enableScroll && !isBottom"
  45. >
  46. <em>
  47. <i class="el-icon-d-arrow-right"></i>
  48. {{group.unreadNums}}{{ $t('chat.unreadMsg') }}
  49. </em>
  50. </div>
  51. </div>
  52. <input-area ref="inputArea" @toBottom="resizeToBottom" v-show="isJoinGroup==1" @handleFocus="showCharSet(0)"></input-area>
  53. <div @click="joinGroup()" class="btn-join" v-show="isJoinGroup==0">{{ $t('chat.joinGroup') }}</div>
  54. </div>
  55. <chat-set
  56. @showCharSet = "showCharSet"
  57. @handleShowGroudMgr="showGroudMgr"
  58. v-if="group.members && !isPrivate"
  59. :class="{'move-left': groupSet}"
  60. ></chat-set>
  61. <chat-groud-mgr
  62. @handleShowGroudMgr="showGroudMgr"
  63. @handleShowCharSet="showCharSet"
  64. v-show="isCreator"
  65. :class="{'move-left': isShowGroudMgr}"
  66. ></chat-groud-mgr>
  67. </div>
  68. </template>
  69. <script>
  70. import Vue from 'vue'
  71. import msgItem from '@/components/msgItem'
  72. import chatPin from '@/components/chatPin'
  73. import atMe from '@/components/chatAt/atme'
  74. import { chatMixin } from '@/mixins/chat'
  75. import chatSet from '@/components/chatSet'
  76. import inputArea from './inputArea'
  77. import { getResizeHeight } from '@/util/util.js'
  78. import { Button } from 'element-ui'
  79. import chatGroudMgr from '@/components/chatGroudMgr'
  80. Vue.component(Button.name, Button)
  81. export default {
  82. name: 'chatRoom',
  83. mixins: [chatMixin],
  84. data () {
  85. return {
  86. isShowGroudMgr: false,
  87. bdHiden: true
  88. }
  89. },
  90. components: {
  91. msgItem,
  92. inputArea,
  93. chatGroudMgr,
  94. chatSet,
  95. chatPin,
  96. atMe
  97. },
  98. methods: {
  99. showCharSet (flag) {
  100. this.groupSet = flag == 1
  101. this.isShowGroudMgr = false
  102. },
  103. showGroudMgr (flag) {
  104. this.isShowGroudMgr = flag == 1
  105. }
  106. },
  107. mounted () {
  108. this.scrollHeight = getResizeHeight()
  109. window.onresize = () => {
  110. this.scrollHeight = getResizeHeight()
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. @import "./chatRoom.scss";
  117. </style>