index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div ref="chatSet" class="r-view pub-scroll-box" @click.stop>
  3. <div class="setting-top">
  4. <div class="search-input">
  5. <input type="text" v-model="searchTxt" :placeholder="$t('group.searchMember')">
  6. <i class="el-icon-search"></i>
  7. </div>
  8. <!-- 没搜索 -->
  9. <ul v-if="!isSearch" class="user-list pub-scroll-box" ref="scrollWrap" :class="{'height-limit': limitHeight}">
  10. <li class="list-item" @click="$showInvite(2)" v-if="isAdmin || isCreator">
  11. <div class="avatar btn"><i class="el-icon-plus"></i></div>
  12. <span class="name">{{$t('group.add')}}</span>
  13. </li>
  14. <li class="list-item" @click="$showInvite(3)" v-if="isAdmin || isCreator">
  15. <div class="avatar btn"><i class="el-icon-minus"></i></div>
  16. <span class="name">{{$t('group.delete')}}</span>
  17. </li>
  18. <template v-for="(item, index) in membersArray">
  19. <li class="list-item" :key="index" @click="$showOtherInfo(item.user_id)">
  20. <div class="avatar-box">
  21. <img class="avatar" v-if="members[item.user_id] && members[item.user_id].cover_photo" :src="members[item.user_id] && members[item.user_id].cover_photo" alt="">
  22. <div v-else class="user-avatar avatar"
  23. :class="'avatar_bg' + item.user_id % 9"
  24. :title="item.nick_name"
  25. :data-name="members[item.user_id] && members[item.user_id].nick_name && members[item.user_id].nick_name.slice(0,2).toUpperCase()">
  26. </div>
  27. <i v-if="group.creator == item.user_id" class="creator-icon"></i>
  28. <i v-else-if="adminList.includes(Number(item.user_id))" class="admin-icon el-icon-star-on"></i>
  29. </div>
  30. <span class="name">{{item.nick_name}}</span>
  31. </li>
  32. </template>
  33. </ul>
  34. <ul v-else class="user-list pub-scroll-box">
  35. <template v-for="(item, index) in searchList">
  36. <li class="list-item" :key="index" @click="$showOtherInfo(item.user_id)">
  37. <img class="avatar" v-if="members[item.user_id] && members[item.user_id].cover_photo" :src="members[item.user_id] && members[item.user_id].cover_photo" alt="">
  38. <div v-else class="user-avatar avatar"
  39. :class="'avatar_bg' + item.user_id % 9"
  40. :title="item.nick_name"
  41. :data-name="members[item.user_id] && members[item.user_id].nick_name && members[item.user_id].nick_name.slice(0,2).toUpperCase()">
  42. </div>
  43. <span class="name">{{members[item.user_id] && members[item.user_id].nick_name && members[item.user_id].nick_name}}</span>
  44. </li>
  45. </template>
  46. </ul>
  47. <div class="show-all-btn" v-if="group.userCounts > 6" @click="handleShowAll">
  48. {{limitHeight ? $t('group.showAll') : $t('group.hideAll')}} <i :class="`el-icon-arrow-${limitHeight ? 'down' : 'up'}`"></i>
  49. </div>
  50. </div>
  51. <div class="setting-item" v-if="isAdmin || isCreator">
  52. <div class="title">{{$t('group.groupName')}}</div>
  53. <input class="edit-full-input" type="text" v-model="newGroupName" v-focus v-if="isEdit" @blur="handleTitleBlur">
  54. <p class="text" v-else @click="handleTitleFocus">{{group.groupName}}<i class="el-icon-edit"></i></p>
  55. </div>
  56. <!-- <div class="setting-item cursor" v-if="isCreator" @click="$setGroupType">
  57. <div class="title">{{$t('group.groupTypeSetting')}}<i class="el-icon-arrow-right team-arrow-icon"></i></div>
  58. </div> -->
  59. <div class="setting-item ext-avatar" v-if="isAdmin || isCreator">
  60. <div class="title">{{$t('group.setGroupAvatar')}}</div>
  61. <p class="text cursor" @click="$editGroupAvatar(group.coverPhoto)">
  62. <img v-if="group.coverPhoto" class="team-avatar" :src="group.coverPhoto" alt="">
  63. <span class="no-avatar" v-else>
  64. <i class="el-icon-plus"></i>
  65. </span>
  66. <i class="el-icon-arrow-right team-arrow-icon"></i>
  67. </p>
  68. </div>
  69. <div class="setting-item">
  70. <div class="title">{{$t('group.groupPin')}}</div>
  71. <p class="text cursor" @click="handleOpenNotice" v-if="isAdmin || isCreator">{{group.groupNotice}}<i class="el-icon-edit"></i></p>
  72. <template v-else>
  73. <p class="text notice" v-if="group.groupNotice">{{group.groupNotice}}</p>
  74. <p class="text notice" v-else>{{$t('group.noPin')}}</p>
  75. </template>
  76. </div>
  77. <div class="setting-item">
  78. <div class="title">{{$t('group.groupInviteLink')}}</div>
  79. <p class="text">
  80. <template v-if="!isEditLink">
  81. <a class="invite-link" href="javascript:" @click="copyLink(group.inviteUrl)">{{sharePath + shareName}}</a>
  82. <span class="invite-editBtn" v-if="isAdmin || isCreator" @click="handleLinkFocus">
  83. <i class="el-icon-edit"></i>
  84. </span>
  85. <!-- <span class="link-change" v-if="isAdmin || isCreator" @click="handleLinkFocus" >更改</span> -->
  86. </template>
  87. <template v-else>
  88. <em class="edit-name-path">{{sharePath}}</em>
  89. <input class="edit-name-input" v-model="editShareName" v-focus type="text" autofocus @blur="handleLinkBlur">
  90. </template>
  91. </p>
  92. </div>
  93. <div class="setting-item" v-if="isAdmin || isCreator">
  94. <div class="title">{{$t('group.groupId')}}</div>
  95. <p class="text">group_id: {{group.groupId}}</p>
  96. </div>
  97. <div class="setting-item">
  98. <div class="title">{{$t('group.doNotDisturb')}}</div>
  99. <p class="text">
  100. <el-switch
  101. v-model="sessionInfo.is_mute"
  102. @change="changeMute"
  103. :active-value="1"
  104. :inactive-value="0"
  105. active-color="#2298f0"
  106. inactive-color="#cbcbcb">
  107. </el-switch>
  108. </p>
  109. </div>
  110. <div class="setting-item">
  111. <div class="title">{{$t('group.topChat')}}</div>
  112. <p class="text">
  113. <el-switch
  114. v-model="sessionInfo.is_pin"
  115. @change="changePin"
  116. :active-value="1"
  117. :inactive-value="0"
  118. active-color="#2298f0"
  119. inactive-color="#cbcbcb">
  120. </el-switch>
  121. </p>
  122. </div>
  123. <div class="setting-item cursor" v-if="isCreator" @click="handleGroudMgr">
  124. <div class="title">{{$t('group.admin')}}<i class="el-icon-arrow-right team-arrow-icon"></i></div>
  125. </div>
  126. <div class="setting-bottom" v-show="group.isJoin">
  127. <button class="delete-btn" @click="leaveGroup">{{$t('group.quitGroup')}}</button>
  128. </div>
  129. <!-- 群公告 -->
  130. <transition name="msgbox-fade">
  131. <div class="pub-wrapper" v-if="editNotice">
  132. <div class="pub-mask"></div>
  133. <div class="pub-modal notice-modal">
  134. <div class="modal-hd">
  135. <div class="title">{{$t('group.groupPin')}}</div>
  136. <i class="el-icon-close" @click="editNotice = false"></i>
  137. </div>
  138. <div class="modal-bd">
  139. <textarea v-focus :placeholder="$t('group.groupPinInput')" v-model="newNotice"></textarea>
  140. </div>
  141. <div class="modal-fd">
  142. <el-button type="primary" @click="handleNotice">{{$t('public.confirm')}}</el-button>
  143. </div>
  144. </div>
  145. </div>
  146. </transition>
  147. </div>
  148. </template>
  149. <script>
  150. import Vue from 'vue'
  151. import { Switch, Button } from 'element-ui'
  152. import { groupSetMixins } from '@/mixins/group'
  153. Vue.component(Button.name, Button)
  154. Vue.component(Switch.name, Switch)
  155. export default {
  156. name: 'chatSet',
  157. mixins: [groupSetMixins],
  158. watch: {
  159. searchTxt (newVal, val) {
  160. if (newVal == '') {
  161. this.isSearch = false
  162. } else {
  163. this.isSearch = true
  164. this.searchUser()
  165. }
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. @import './style.scss';
  172. </style>