index.vue 7.9 KB

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