index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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">{{group.groupNotice}}</p>
  73. <p class="text notice" v-else>{{$t('group.noPin')}}</p>
  74. </template>
  75. </div>
  76. <div class="setting-item">
  77. <div class="title">{{$t('group.groupInviteLink')}}</div>
  78. <p class="text">
  79. <template v-if="!isEditLink">
  80. <a class="invite-link" href="javascript:" @click="copyLink(group.inviteUrl)">{{sharePath + shareName}}</a>
  81. <span class="invite-editBtn" v-if="isAdmin || isCreator" @click="handleLinkFocus">
  82. <i class="el-icon-edit"></i>
  83. </span>
  84. <!-- <span class="link-change" v-if="isAdmin || isCreator" @click="handleLinkFocus" >更改</span> -->
  85. </template>
  86. <template v-else>
  87. <em class="edit-name-path">{{sharePath}}</em>
  88. <input class="edit-name-input" v-model="editShareName" v-focus type="text" autofocus @blur="handleLinkBlur">
  89. </template>
  90. </p>
  91. </div>
  92. <div class="setting-item" v-if="isAdmin || isCreator">
  93. <div class="title">{{$t('group.groupId')}}</div>
  94. <p class="text">group_id: {{group.groupId}}</p>
  95. </div>
  96. <div class="setting-item">
  97. <div class="title">{{$t('group.doNotDisturb')}}</div>
  98. <p class="text">
  99. <el-switch
  100. v-model="sessionInfo.is_mute"
  101. @change="changeMute"
  102. :active-value="1"
  103. :inactive-value="0"
  104. active-color="#2298f0"
  105. inactive-color="#cbcbcb">
  106. </el-switch>
  107. </p>
  108. </div>
  109. <div class="setting-item">
  110. <div class="title">{{$t('group.topChat')}}</div>
  111. <p class="text">
  112. <el-switch
  113. v-model="sessionInfo.is_pin"
  114. @change="changePin"
  115. :active-value="1"
  116. :inactive-value="0"
  117. active-color="#2298f0"
  118. inactive-color="#cbcbcb">
  119. </el-switch>
  120. </p>
  121. </div>
  122. <div class="setting-item cursor" v-if="isCreator" @click="handleGroudMgr">
  123. <div class="title">{{$t('group.admin')}}<i class="el-icon-arrow-right team-arrow-icon"></i></div>
  124. </div>
  125. <div class="setting-bottom" v-show="group.isJoin">
  126. <button class="delete-btn" @click="leaveGroup">{{$t('group.quitGroup')}}</button>
  127. </div>
  128. <!-- 群公告 -->
  129. <transition name="msgbox-fade">
  130. <div class="pub-wrapper" v-if="editNotice">
  131. <div class="pub-mask"></div>
  132. <div class="pub-modal notice-modal">
  133. <div class="modal-hd">
  134. <div class="title">{{$t('group.groupPin')}}</div>
  135. <i class="el-icon-close" @click="editNotice = false"></i>
  136. </div>
  137. <div class="modal-bd">
  138. <textarea v-focus :placeholder="$t('group.groupPinInput')" v-model="newNotice"></textarea>
  139. </div>
  140. <div class="modal-fd">
  141. <el-button type="primary" @click="handleNotice">{{$t('public.confirm')}}</el-button>
  142. </div>
  143. </div>
  144. </div>
  145. </transition>
  146. </div>
  147. </template>
  148. <script>
  149. import Vue from 'vue'
  150. import { Switch, Button } from 'element-ui'
  151. import { groupSetMixins } from '@/mixins/group'
  152. Vue.component(Button.name, Button)
  153. Vue.component(Switch.name, Switch)
  154. export default {
  155. name: 'chatSet',
  156. mixins: [groupSetMixins],
  157. watch: {
  158. searchTxt (newVal, val) {
  159. if (newVal == '') {
  160. this.isSearch = false
  161. } else {
  162. this.isSearch = true
  163. this.searchUser()
  164. }
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="scss" scoped>
  170. @import './style.scss';
  171. </style>