index.vue 7.2 KB

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