manage-admin.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="admin-main">
  3. <div class="admin-manage">
  4. <div class="admin-manage-header">
  5. {{ TUITranslateService.t(`TUIGroup.群管理员`) }}
  6. </div>
  7. <ul class="admin-manage-list">
  8. <li
  9. v-for="(item, index) in memberAdmin.admin"
  10. :key="index"
  11. class="admin-manage-list-item"
  12. >
  13. <div class="item-main">
  14. <img
  15. class="item-main-avatar"
  16. :src="
  17. item.avatar ||
  18. 'https://bucket.sxdirectpurchase.com/wx/static/img/ImAvatar.png'
  19. "
  20. onerror="this.onerror=null;this.src='https://bucket.sxdirectpurchase.com/wx/static/img/ImAvatar.png'"
  21. />
  22. </div>
  23. <div class="item-name">
  24. {{ item.nick || item.userID }}
  25. </div>
  26. </li>
  27. <li class="admin-manage-list-item">
  28. <div class="item-main" @click="addAdmin">
  29. <Icon :file="plusSVG" width="16px" height="16px" />
  30. </div>
  31. </li>
  32. <li class="admin-manage-list-item">
  33. <div v-if="memberAdmin.admin.length > 0" class="item-main" @click="removeAdmin">
  34. <Icon :file="minusSVG" width="16px" height="16px" />
  35. </div>
  36. </li>
  37. </ul>
  38. </div>
  39. <div v-if="isAdminSetMuteTime" class="admin-mute-all">
  40. <div>
  41. <div class="admin-mute-all-title">
  42. {{ TUITranslateService.t(`TUIGroup.全员禁言`) }}
  43. </div>
  44. <div class="admin-mute-all-content">
  45. {{ TUITranslateService.t(`TUIGroup.全员禁言开启后,只允许群主和管理员发言。`) }}
  46. </div>
  47. </div>
  48. <Slider :open="currentGroupAdmin.muteAllMembers" @change="setAllMuteTime" />
  49. </div>
  50. <div v-if="isAdminSetMuteTime" class="admin-mute">
  51. <div class="admin-mute-header">
  52. {{ TUITranslateService.t(`TUIGroup.单独禁言人员`) }}
  53. </div>
  54. <ul class="admin-mute-list">
  55. <li
  56. v-for="(item, index) in memberAdmin.muteMember"
  57. :key="index"
  58. class="admin-mute-list-item"
  59. >
  60. <div class="item-main">
  61. <img
  62. class="item-main-avatar"
  63. :src="
  64. item.avatar ||
  65. 'https://bucket.sxdirectpurchase.com/wx/static/img/ImAvatar.png'
  66. "
  67. onerror="this.onerror=null;this.src='https://bucket.sxdirectpurchase.com/wx/static/img/ImAvatar.png'"
  68. />
  69. </div>
  70. <div class="item-name">
  71. {{ item.nick || item.userID }}
  72. </div>
  73. </li>
  74. <li class="admin-mute-list-item">
  75. <div class="item-main" @click="addMute">
  76. <Icon :file="plusSVG" width="16px" height="16px" />
  77. </div>
  78. </li>
  79. <li class="admin-mute-list-item">
  80. <div
  81. v-if="memberAdmin.muteMember.length > 0"
  82. class="item-main"
  83. @click="removeMute"
  84. >
  85. <Icon :file="minusSVG" width="16px" height="16px" />
  86. </div>
  87. </li>
  88. </ul>
  89. </div>
  90. </div>
  91. </template>
  92. <script lang="ts" setup>
  93. import { TUITranslateService, IGroupModel } from "@tencentcloud/chat-uikit-engine";
  94. import { watchEffect, ref } from "../../../adapter-vue";
  95. import Slider from "../../common/Slider/index.vue";
  96. import Icon from "../../common/Icon.vue";
  97. import plusSVG from "../../../assets/icon/plus.svg";
  98. import minusSVG from "../../../assets/icon/minus.svg";
  99. import { IGroupMember } from "../../../interface";
  100. const props = defineProps({
  101. member: {
  102. type: Object,
  103. default: () => {},
  104. },
  105. isSetMuteTime: {
  106. type: Boolean,
  107. default: () => false,
  108. },
  109. currentGroup: {
  110. type: Object,
  111. default: () => {},
  112. },
  113. });
  114. const isAdminSetMuteTime = ref(false);
  115. const memberAdmin = ref({
  116. admin: [] as Array<IGroupMember>,
  117. member: [] as Array<IGroupMember>,
  118. muteMember: [] as Array<IGroupMember>,
  119. });
  120. const currentGroupAdmin = ref<IGroupModel>();
  121. watchEffect(() => {
  122. memberAdmin.value = props.member as {
  123. admin: Array<IGroupMember>;
  124. member: Array<IGroupMember>;
  125. muteMember: Array<IGroupMember>;
  126. };
  127. isAdminSetMuteTime.value = props.isSetMuteTime;
  128. currentGroupAdmin.value = props.currentGroup;
  129. });
  130. const emits = defineEmits([
  131. "addAdmin",
  132. "removeAdmin",
  133. "setAllMuteTime",
  134. "addMute",
  135. "removeMute",
  136. "close",
  137. ]);
  138. const addAdmin = () => {
  139. emits("addAdmin");
  140. };
  141. const removeAdmin = () => {
  142. emits("removeAdmin");
  143. };
  144. const setAllMuteTime = (value: boolean) => {
  145. emits("setAllMuteTime", value);
  146. };
  147. const addMute = () => {
  148. emits("addMute");
  149. };
  150. const removeMute = () => {
  151. emits("removeMute");
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. @import "../../../assets/styles/common";
  156. .admin {
  157. width: 100%;
  158. overflow: hidden;
  159. &-header {
  160. display: flex;
  161. flex-direction: row;
  162. justify-content: space-between;
  163. padding: 10px;
  164. &-left {
  165. font-family: "PingFang SC", sans-serif;
  166. font-size: 18px;
  167. font-weight: 500;
  168. line-height: 50px;
  169. letter-spacing: 0;
  170. text-align: left;
  171. }
  172. &-close {
  173. font-family: "PingFang SC", sans-serif;
  174. font-size: 16px;
  175. font-weight: 400;
  176. line-height: 48px;
  177. letter-spacing: 0;
  178. text-align: left;
  179. color: #3370ff;
  180. }
  181. }
  182. &-main {
  183. width: 100%;
  184. overflow: hidden;
  185. .admin-manage {
  186. border-bottom: 10px solid #f4f5f9;
  187. }
  188. .admin-manage,
  189. .admin-mute {
  190. padding: 10px;
  191. width: calc(100% - 20px);
  192. overflow: hidden;
  193. &-header {
  194. padding-left: 10px;
  195. font-family: "PingFang SC", sans-serif;
  196. font-size: 14px;
  197. font-weight: 400;
  198. line-height: 20px;
  199. letter-spacing: 0;
  200. text-align: left;
  201. }
  202. &-list {
  203. display: flex;
  204. width: 100%;
  205. overflow: hidden;
  206. flex-wrap: wrap;
  207. &-item {
  208. flex: 0 0 36px;
  209. display: flex;
  210. flex-direction: column;
  211. padding: 10px;
  212. .item-main {
  213. width: 36px;
  214. height: 36px;
  215. border-radius: 4px;
  216. font-size: 12px;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. background: #f4f5f9;
  221. color: #000;
  222. &-avatar {
  223. width: 36px;
  224. height: 36px;
  225. overflow: hidden;
  226. border-radius: 4px;
  227. }
  228. }
  229. .item-name {
  230. text-align: center;
  231. max-width: 36px;
  232. overflow: hidden;
  233. text-overflow: ellipsis;
  234. white-space: nowrap;
  235. }
  236. }
  237. }
  238. }
  239. .admin-mute-all {
  240. margin: 0 10px;
  241. padding: 20px 0;
  242. border-bottom: 1px solid #e8e8e9;
  243. display: flex;
  244. flex-direction: row;
  245. justify-content: space-between;
  246. align-items: center;
  247. &-title {
  248. padding-left: 10px;
  249. font-family: "PingFang SC", sans-serif;
  250. font-size: 14px;
  251. font-weight: 400;
  252. line-height: 20px;
  253. letter-spacing: 0;
  254. text-align: left;
  255. }
  256. &-content {
  257. color: #999;
  258. padding-left: 10px;
  259. font-family: "PingFang SC", sans-serif;
  260. font-size: 12px;
  261. font-weight: 400;
  262. line-height: 17px;
  263. letter-spacing: 0;
  264. text-align: left;
  265. }
  266. }
  267. }
  268. }
  269. </style>