chatSet.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div class="chat-set">
  3. <back-bar :title="$t('h5.chatInfo')"></back-bar>
  4. <div class="setting-top">
  5. <ul class="user-list pub-scroll-box" ref="scrollWrap" :class="{'height-limit': limitHeight}">
  6. <li class="list-item" @click="showInvite(2)" v-if="isAdmin || isCreator">
  7. <div class="avatar btn">
  8. <i class="el-icon-plus"></i>
  9. </div>
  10. <span class="name">{{$t('group.add')}}</span>
  11. </li>
  12. <li class="list-item" @click="showInvite(3)" v-if="isAdmin || isCreator">
  13. <div class="avatar btn">
  14. <i class="el-icon-minus"></i>
  15. </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="toAboutOther(item.user_id)">
  20. <div class="avatar-box">
  21. <img class="avatar" v-if="item.cover_photo" :src="item.cover_photo" alt>
  22. <div
  23. v-else
  24. class="user-avatar avatar"
  25. :class="'avatar_bg' + item.user_id % 9"
  26. :title="item.nick_name"
  27. :data-name="item && item.nick_name && item.nick_name.slice(0,2).toUpperCase()"
  28. ></div>
  29. <i v-if="group.creator == item.user_id" class="creator-icon"></i>
  30. <i
  31. v-else-if="adminList.includes(Number(item.user_id))"
  32. class="admin-icon el-icon-star-on"
  33. ></i>
  34. </div>
  35. <span class="name">{{item.nick_name}}</span>
  36. </li>
  37. </template>
  38. </ul>
  39. <div class="show-all-btn" v-if="showMore" @click="handleShowAll">
  40. {{limitHeight ? $t('group.showAll') : $t('group.hideAll')}} <i :class="`el-icon-arrow-${limitHeight ? 'down' : 'up'}`"></i>
  41. </div>
  42. </div>
  43. <div class="pub-setting" v-if="isAdmin || isCreator">
  44. <div class="setting-item">
  45. <div class="title">{{$t('h5.groupAvatar')}}</div>
  46. <p class="text">
  47. <input v-if="isCreator" type="file" accept="image/jpeg,image/png,image/jpg" @change="uploadImg($event)"/>
  48. <img v-if="group.coverPhoto" class="team-avatar" :src="group.coverPhoto" @click.stop="$showImgPreview(group.coverPhoto)">
  49. <span class="no-avatar" v-else>
  50. <i class="el-icon-plus"></i>
  51. </span>
  52. <i class="el-icon-arrow-right team-arrow-icon"></i>
  53. </p>
  54. </div>
  55. <div class="setting-item" v-if="isAdmin || isCreator" @click="editGroupName">
  56. <div class="title">{{$t('h5.groupName')}}</div>
  57. <p class="text">
  58. {{group.groupName}}
  59. <i class="el-icon-arrow-right team-arrow-icon"></i>
  60. </p>
  61. </div>
  62. </div>
  63. <div class="pub-setting">
  64. <div class="setting-item">
  65. <div class="title">{{$t('group.groupInviteLink')}}</div>
  66. <p class="text">
  67. <template v-if="!isEditLink">
  68. <span
  69. class="invite-link"
  70. href="javascript:"
  71. @click="copyLink(group.inviteUrl)"
  72. >{{sharePath + shareName}}</span>
  73. <span class="invite-editBtn" v-if="isAdmin || isCreator" @click="handleLinkFocus">
  74. <i class="el-icon-arrow-right team-arrow-icon"></i>
  75. </span>
  76. </template>
  77. <template v-else>
  78. <em class="edit-name-path">{{sharePath}}</em>
  79. <input
  80. class="edit-name-input"
  81. v-model="editShareName"
  82. v-focus
  83. type="text"
  84. autofocus
  85. @blur="handleLinkBlur"
  86. >
  87. </template>
  88. </p>
  89. </div>
  90. <div class="setting-item">
  91. <div class="title">{{$t('group.groupPin')}}</div>
  92. <p class="text cursor" v-if="isAdmin || isCreator" @click="editGroupNotice">
  93. {{group.groupNotice}}
  94. <i class="el-icon-arrow-right team-arrow-icon"></i>
  95. </p>
  96. <template v-else>
  97. <p class="text notice" v-if="group.groupNotice">{{group.groupNotice}}</p>
  98. <p class="text notice" v-else>{{$t('group.noPin')}}</p>
  99. </template>
  100. </div>
  101. </div>
  102. <div class="pub-setting">
  103. <div class="setting-item">
  104. <div class="title">{{$t('group.doNotDisturb')}}</div>
  105. <p class="text">
  106. <el-switch
  107. v-model="sessionInfo.is_mute"
  108. @change="changeMute"
  109. :active-value="1"
  110. :inactive-value="0"
  111. active-color="#4dd865"
  112. inactive-color="#cbcbcb"
  113. ></el-switch>
  114. </p>
  115. </div>
  116. <div class="setting-item">
  117. <div class="title">{{$t('group.topChat')}}</div>
  118. <p class="text">
  119. <el-switch
  120. v-model="sessionInfo.is_pin"
  121. @change="changePin"
  122. :active-value="1"
  123. :inactive-value="0"
  124. active-color="#4dd865"
  125. inactive-color="#cbcbcb"
  126. ></el-switch>
  127. </p>
  128. </div>
  129. </div>
  130. <div class="pub-bottom-btn" @click="leaveGroup">{{$t('group.quitGroup')}}</div>
  131. <cropper v-bind="cropperOption" @close="cropperClose" @cropper="cropperSubmit"></cropper>
  132. </div>
  133. </template>
  134. <script>
  135. import backBar from '@/components/backBar'
  136. import { groupSetMixins } from '@/mixins/group'
  137. import cropper from '../components/cropper'
  138. import { avatarMixin } from '../mixins/index'
  139. export default {
  140. name: 'h5ChatSet',
  141. mixins: [groupSetMixins, avatarMixin],
  142. computed: {
  143. showMore () {
  144. if (this.isAdmin || this.isCreator) {
  145. return this.group.userCounts > 3
  146. } else {
  147. return this.group.userCounts > 6
  148. }
  149. }
  150. },
  151. components: {
  152. backBar,
  153. cropper
  154. },
  155. methods: {
  156. showInvite (type) {
  157. this.$router.push(`/invite/${type}/${this.curGroupId}`)
  158. },
  159. toAboutOther (userId) {
  160. this.$router.push(`/other/${userId}`)
  161. },
  162. editGroupName () {
  163. this.$router.push(`/editInfo/groupName/${this.curGroupId}`)
  164. },
  165. editGroupNotice () {
  166. this.$router.push(`/editInfo/groupNotice/${this.curGroupId}`)
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .setting-top{
  173. background: #ffffff;
  174. overflow: hidden;
  175. border-bottom: 1px solid #d8d8d8;
  176. }
  177. .user-list{
  178. display: flex;
  179. flex-wrap: wrap;
  180. max-height: 362px;
  181. overflow: auto;
  182. margin: px2rem(21) px2rem(-39) 0 px2rem(45);
  183. &.height-limit{
  184. height: px2rem(150);
  185. overflow: hidden;
  186. }
  187. .list-item{
  188. width: px2rem(100);
  189. margin: 0 px2rem(39) px2rem(24) 0;
  190. }
  191. img.avatar{
  192. background: #ccc;
  193. }
  194. .avatar-box{
  195. position: relative;
  196. }
  197. .avatar{
  198. display: block;
  199. width: px2rem(100);
  200. height: px2rem(100);
  201. margin-bottom: 6px;
  202. border-radius: 2px;
  203. cursor: pointer;
  204. position: relative;
  205. &:hover{
  206. opacity: .8;
  207. }
  208. }
  209. .btn{
  210. box-sizing: border-box;
  211. border: 1px solid #c0c0c0;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. cursor: pointer;
  216. i{
  217. font-size: 22px;
  218. color: #5e5e5e;
  219. }
  220. }
  221. .name{
  222. @include ellipsis();
  223. font-size: px2rem(24);
  224. color: #333333;
  225. display: block;
  226. text-align: center;
  227. }
  228. }
  229. .no-avatar{
  230. display: inline-block;
  231. width: 40px;
  232. height: 40px;
  233. border-radius: 2px;
  234. cursor: pointer;
  235. border: 1px solid #c0c0c0;
  236. text-align: center;
  237. line-height: 40px;
  238. i{
  239. vertical-align: middle;
  240. font-size: 20px;
  241. margin-left: 0 !important;
  242. }
  243. }
  244. .admin-icon{
  245. position: absolute;
  246. left: 0;
  247. bottom: 0;
  248. width: 18px;
  249. height: 18px;
  250. line-height: 18px;
  251. background-color: rgba($color: #000000, $alpha: .4);
  252. border-radius: 2px;
  253. text-align: center;
  254. font-size: 14px;
  255. color: #f5ab5c;
  256. }
  257. .creator-icon{
  258. position: absolute;
  259. left: 0;
  260. bottom: 0;
  261. background: url('../../../assets/icon-creater.png') center center no-repeat;
  262. background-size: 12px 11px;
  263. background-color: rgba($color: #000000, $alpha: .6);
  264. width: 18px;
  265. height: 18px;
  266. }
  267. .show-all-btn{
  268. color: #999999;
  269. font-size: 12px;
  270. text-align: center;
  271. padding: 10px 0;
  272. cursor: pointer;
  273. i{
  274. display: inline-block;
  275. margin-left: 6px;
  276. }
  277. }
  278. .pub-bottom-btn{
  279. margin-top: px2rem(21);
  280. }
  281. </style>