chatSet.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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 Vue from 'vue'
  136. import { Switch } from 'element-ui'
  137. import backBar from '@/components/backBar'
  138. import { groupSetMixins } from '@/mixins/group'
  139. import cropper from '../components/cropper'
  140. import { avatarMixin } from '../mixins/index'
  141. Vue.component(Switch.name, Switch)
  142. export default {
  143. name: 'h5ChatSet',
  144. mixins: [groupSetMixins, avatarMixin],
  145. computed: {
  146. showMore () {
  147. if (this.isAdmin || this.isCreator) {
  148. return this.group.userCounts > 3
  149. } else {
  150. return this.group.userCounts > 6
  151. }
  152. }
  153. },
  154. components: {
  155. backBar,
  156. cropper
  157. },
  158. methods: {
  159. showInvite (type) {
  160. this.$router.push(`/invite/${type}/${this.curGroupId}`)
  161. },
  162. toAboutOther (userId) {
  163. this.$router.push(`/other/${userId}`)
  164. },
  165. editGroupName () {
  166. this.$router.push(`/editInfo/groupName/${this.curGroupId}`)
  167. },
  168. editGroupNotice () {
  169. this.$router.push(`/editInfo/groupNotice/${this.curGroupId}`)
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .setting-top{
  176. background: #ffffff;
  177. overflow: hidden;
  178. border-bottom: 1px solid #d8d8d8;
  179. }
  180. .user-list{
  181. display: flex;
  182. flex-wrap: wrap;
  183. max-height: 362px;
  184. overflow: auto;
  185. margin: px2rem(21) px2rem(-39) 0 px2rem(45);
  186. &.height-limit{
  187. height: px2rem(150);
  188. overflow: hidden;
  189. }
  190. .list-item{
  191. width: px2rem(100);
  192. margin: 0 px2rem(39) px2rem(24) 0;
  193. }
  194. img.avatar{
  195. background: #ccc;
  196. }
  197. .avatar-box{
  198. position: relative;
  199. }
  200. .avatar{
  201. display: block;
  202. width: px2rem(100);
  203. height: px2rem(100);
  204. margin-bottom: 6px;
  205. border-radius: 2px;
  206. cursor: pointer;
  207. position: relative;
  208. &:hover{
  209. opacity: .8;
  210. }
  211. }
  212. .btn{
  213. box-sizing: border-box;
  214. border: 1px solid #c0c0c0;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. cursor: pointer;
  219. i{
  220. font-size: 22px;
  221. color: #5e5e5e;
  222. }
  223. }
  224. .name{
  225. @include ellipsis();
  226. font-size: px2rem(24);
  227. color: #333333;
  228. display: block;
  229. text-align: center;
  230. }
  231. }
  232. .no-avatar{
  233. display: inline-block;
  234. width: 40px;
  235. height: 40px;
  236. border-radius: 2px;
  237. cursor: pointer;
  238. border: 1px solid #c0c0c0;
  239. text-align: center;
  240. line-height: 40px;
  241. i{
  242. vertical-align: middle;
  243. font-size: 20px;
  244. margin-left: 0 !important;
  245. }
  246. }
  247. .admin-icon{
  248. position: absolute;
  249. left: 0;
  250. bottom: 0;
  251. width: 18px;
  252. height: 18px;
  253. line-height: 18px;
  254. background-color: rgba($color: #000000, $alpha: .4);
  255. border-radius: 2px;
  256. text-align: center;
  257. font-size: 14px;
  258. color: #f5ab5c;
  259. }
  260. .creator-icon{
  261. position: absolute;
  262. left: 0;
  263. bottom: 0;
  264. background: url('../../../assets/icon-creater.png') center center no-repeat;
  265. background-size: 12px 11px;
  266. background-color: rgba($color: #000000, $alpha: .6);
  267. width: 18px;
  268. height: 18px;
  269. }
  270. .show-all-btn{
  271. color: #999999;
  272. font-size: 12px;
  273. text-align: center;
  274. padding: 10px 0;
  275. cursor: pointer;
  276. i{
  277. display: inline-block;
  278. margin-left: 6px;
  279. }
  280. }
  281. .pub-bottom-btn{
  282. margin-top: px2rem(21);
  283. }
  284. </style>