|
@@ -1,6 +1,9 @@
|
|
|
<template>
|
|
|
<div ref="manageRef" class="manage">
|
|
|
- <header v-if="!isUniFrameWork || currentTab === 'admin'" class="manage-header">
|
|
|
+ <header
|
|
|
+ v-if="!isUniFrameWork || currentTab === 'admin'"
|
|
|
+ class="manage-header"
|
|
|
+ >
|
|
|
<div @click="back">
|
|
|
<Icon :file="backSVG" />
|
|
|
</div>
|
|
@@ -8,7 +11,10 @@
|
|
|
{{ TUITranslateService.t(`TUIGroup.${TabName}`) }}
|
|
|
</div>
|
|
|
</header>
|
|
|
- <main v-if="!currentTab || (isUniFrameWork && currentTab != 'admin')" class="main">
|
|
|
+ <main
|
|
|
+ v-if="!currentTab || (isUniFrameWork && currentTab != 'admin')"
|
|
|
+ class="main"
|
|
|
+ >
|
|
|
<ManageName
|
|
|
class="space-top"
|
|
|
:isAuthor="isAuthor"
|
|
@@ -34,7 +40,10 @@
|
|
|
:key="index"
|
|
|
class="user-info-list-item"
|
|
|
>
|
|
|
- <dt class="user-info-list-item-main" @click="handleMemberProfileShow(item)">
|
|
|
+ <dt
|
|
|
+ class="user-info-list-item-main"
|
|
|
+ @click="handleMemberProfileShow(item)"
|
|
|
+ >
|
|
|
<img
|
|
|
class="avatar"
|
|
|
:src="
|
|
@@ -59,7 +68,9 @@
|
|
|
<ul class="content list space-top" @click="editLableName = ''">
|
|
|
<li class="list-item" @click="setCurrentTab('notification')">
|
|
|
<aside class="aside">
|
|
|
- <label class="label">{{ TUITranslateService.t(`TUIGroup.群公告`) }}</label>
|
|
|
+ <label class="label">{{
|
|
|
+ TUITranslateService.t(`TUIGroup.群公告`)
|
|
|
+ }}</label>
|
|
|
<article class="article">
|
|
|
{{ currentGroup.notification }}
|
|
|
</article>
|
|
@@ -71,7 +82,9 @@
|
|
|
class="list-item"
|
|
|
@click="setCurrentTab('admin')"
|
|
|
>
|
|
|
- <label class="label">{{ TUITranslateService.t(`TUIGroup.群管理`) }}</label>
|
|
|
+ <label class="label">{{
|
|
|
+ TUITranslateService.t(`TUIGroup.群管理`)
|
|
|
+ }}</label>
|
|
|
<Icon :file="rightIcon" />
|
|
|
</li>
|
|
|
<!-- <li class="list-item">
|
|
@@ -81,7 +94,9 @@
|
|
|
</div>
|
|
|
</li> -->
|
|
|
<li class="list-item">
|
|
|
- <label class="label">{{ TUITranslateService.t(`TUIGroup.群头像`) }}</label>
|
|
|
+ <label class="label">{{
|
|
|
+ TUITranslateService.t(`TUIGroup.群头像`)
|
|
|
+ }}</label>
|
|
|
<img
|
|
|
class="avatar"
|
|
|
:src="
|
|
@@ -92,26 +107,32 @@
|
|
|
/>
|
|
|
</li>
|
|
|
<li class="list-item">
|
|
|
- <label class="label">{{ TUITranslateService.t(`TUIGroup.群类型`) }}</label>
|
|
|
+ <label class="label">{{
|
|
|
+ TUITranslateService.t(`TUIGroup.群类型`)
|
|
|
+ }}</label>
|
|
|
<span class="span">{{
|
|
|
TUITranslateService.t(`TUIGroup.${typeName[currentGroup.type]}`)
|
|
|
}}</span>
|
|
|
</li>
|
|
|
<li class="list-item">
|
|
|
- <label class="label">{{ TUITranslateService.t(`TUIGroup.加群方式`) }}</label>
|
|
|
+ <label class="label">{{
|
|
|
+ TUITranslateService.t(`TUIGroup.加群方式`)
|
|
|
+ }}</label>
|
|
|
<span class="span">{{
|
|
|
- TUITranslateService.t(`TUIGroup.${typeName[currentGroup.joinOption]}`)
|
|
|
+ TUITranslateService.t(
|
|
|
+ `TUIGroup.${typeName[currentGroup.joinOption]}`
|
|
|
+ )
|
|
|
}}</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<ul class="footer list space-top">
|
|
|
- <li
|
|
|
+ <!-- <li
|
|
|
v-if="currentSelfRole === 'Owner' && groupMemberList.length > 1"
|
|
|
class="list-item"
|
|
|
@click.stop="toggleMask('changeOwner')"
|
|
|
>
|
|
|
{{ TUITranslateService.t(`TUIGroup.转让群组`) }}
|
|
|
- </li>
|
|
|
+ </li> -->
|
|
|
<li
|
|
|
v-if="canIDissmissGroup"
|
|
|
class="list-item"
|
|
@@ -193,7 +214,14 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, computed, watchEffect, onMounted, nextTick } from "../../../adapter-vue";
|
|
|
+import * as MesApi from "../../../../api/message";
|
|
|
+import {
|
|
|
+ ref,
|
|
|
+ computed,
|
|
|
+ watchEffect,
|
|
|
+ onMounted,
|
|
|
+ nextTick,
|
|
|
+} from "../../../adapter-vue";
|
|
|
import TUIChatEngine, {
|
|
|
TUITranslateService,
|
|
|
TUIGroupService,
|
|
@@ -400,17 +428,27 @@ const updateProfile = async (newGroupProfile: any) => {
|
|
|
groupID: currentGroup.value.groupID,
|
|
|
[key]: value,
|
|
|
};
|
|
|
- TUIGroupService.updateGroupProfile(options)
|
|
|
- .then((res: any) => {
|
|
|
- currentGroup.value = res.data.group;
|
|
|
- editLableName.value = "";
|
|
|
- })
|
|
|
- .catch((error: any) => {
|
|
|
- Toast({
|
|
|
- message: error?.message,
|
|
|
- type: TOAST_TYPE.ERROR,
|
|
|
- });
|
|
|
+ let res = await MesApi.default.updateGroup(options);
|
|
|
+ if (res.code == 200) {
|
|
|
+ currentGroup.value = res.data.group;
|
|
|
+ editLableName.value = "";
|
|
|
+ } else {
|
|
|
+ Toast({
|
|
|
+ message: error?.message,
|
|
|
+ type: TOAST_TYPE.ERROR,
|
|
|
});
|
|
|
+ }
|
|
|
+ // TUIGroupService.updateGroupProfile(options)
|
|
|
+ // .then((res: any) => {
|
|
|
+ // currentGroup.value = res.data.group;
|
|
|
+ // editLableName.value = "";
|
|
|
+ // })
|
|
|
+ // .catch((error: any) => {
|
|
|
+ // Toast({
|
|
|
+ // message: error?.message,
|
|
|
+ // type: TOAST_TYPE.ERROR,
|
|
|
+ // });
|
|
|
+ // });
|
|
|
};
|
|
|
|
|
|
const setCurrentTab = (tabName: string) => {
|
|
@@ -486,7 +524,9 @@ const friendList = async () => {
|
|
|
const friendList = imResponse.data.map((item: any) => item?.profile);
|
|
|
return friendList.filter(
|
|
|
(item: any) =>
|
|
|
- !userInfo.value.list.some((infoItem: any) => infoItem.userID === item.userID)
|
|
|
+ !userInfo.value.list.some(
|
|
|
+ (infoItem: any) => infoItem.userID === item.userID
|
|
|
+ )
|
|
|
);
|
|
|
};
|
|
|
|
|
@@ -549,20 +589,53 @@ const submit = (userList: any) => {
|
|
|
};
|
|
|
|
|
|
const dismissGroup = async (group: any) => {
|
|
|
- // 解散群组
|
|
|
- await TUIGroupService.dismissGroup(group.groupID);
|
|
|
- enableSampleTaskStatus("dismissGroup");
|
|
|
- Toast({
|
|
|
- message: TUITranslateService.t("TUIGroup.群组解散成功"),
|
|
|
- type: TOAST_TYPE.SUCCESS,
|
|
|
+ TUIGlobal.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "是否确认解散该群聊",
|
|
|
+ success: async (res: any) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ // 调起客户端小程序设置界面,返回用户设置的操作结果。(重新让用户授权)
|
|
|
+ let res = await MesApi.default.delGroupByIdDisband({
|
|
|
+ id: group.groupID,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ enableSampleTaskStatus("dismissGroup");
|
|
|
+ Toast({
|
|
|
+ message: TUITranslateService.t("TUIGroup.群组解散成功"),
|
|
|
+ type: TOAST_TYPE.SUCCESS,
|
|
|
+ });
|
|
|
+ TUIConversationService.deleteConversation(`GROUP${group.groupID}`);
|
|
|
+ clearGroupInfo();
|
|
|
+ }
|
|
|
+ } else if (res.cancel) {
|
|
|
+ return Toast({
|
|
|
+ message: TUITranslateService.t("component.已取消"),
|
|
|
+ type: TOAST_TYPE.ERROR,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
- clearGroupInfo();
|
|
|
-};
|
|
|
|
|
|
+ // // 解散群组
|
|
|
+ // await TUIGroupService.dismissGroup(group.groupID);
|
|
|
+ // enableSampleTaskStatus("dismissGroup");
|
|
|
+ // Toast({
|
|
|
+ // message: TUITranslateService.t("TUIGroup.群组解散成功"),
|
|
|
+ // type: TOAST_TYPE.SUCCESS,
|
|
|
+ // });
|
|
|
+ // clearGroupInfo();
|
|
|
+};
|
|
|
+function capitalize(str: string): string {
|
|
|
+ if (!str) return "";
|
|
|
+ return str.charAt(0).toUpperCase() + str.slice(1);
|
|
|
+}
|
|
|
const clearGroupInfo = () => {
|
|
|
if (isUniFrameWork) {
|
|
|
- TUIGlobal?.switchTab({
|
|
|
- url: "/TUIKit/components/TUIConversation/index",
|
|
|
+ TUIGlobal?.navigateTo({
|
|
|
+ url: `/TUIKit-${capitalize(
|
|
|
+ uni.getStorageSync("Identity")
|
|
|
+ )}/components/TUIConversation/index`,
|
|
|
});
|
|
|
} else {
|
|
|
handleCompleteManage();
|
|
@@ -633,7 +706,10 @@ const handleSearchMember = async (value: string) => {
|
|
|
(item: any) => item.userID !== imResponse?.data?.memberList[0]?.userID
|
|
|
);
|
|
|
if (imResponse?.data?.memberList.length) {
|
|
|
- transferList.value = [...transferList.value, ...imResponse.data.memberList];
|
|
|
+ transferList.value = [
|
|
|
+ ...transferList.value,
|
|
|
+ ...imResponse.data.memberList,
|
|
|
+ ];
|
|
|
}
|
|
|
} catch (error: any) {
|
|
|
const message = TUITranslateService.t("TUIGroup.该用户不存在");
|
|
@@ -728,16 +804,40 @@ const handleAdmin = async (user: any) => {
|
|
|
|
|
|
const deleteGroupMember = async (userIDList: any) => {
|
|
|
const options: any = {
|
|
|
- groupID: currentGroupID.value,
|
|
|
- userIDList,
|
|
|
+ groupId: currentGroupID.value,
|
|
|
+ memberlist: userIDList,
|
|
|
reason: "",
|
|
|
};
|
|
|
- await TUIGroupService.deleteGroupMember(options);
|
|
|
+ let res = await MesApi.default.groupdelUse(options);
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.$u.toast("移除成功");
|
|
|
+ clearGroupInfo();
|
|
|
+ }
|
|
|
+ // await TUIGroupService.deleteGroupMember(options);
|
|
|
};
|
|
|
|
|
|
const quitGroup = async (group: any) => {
|
|
|
- await TUIGroupService.quitGroup(group.groupID);
|
|
|
- clearGroupInfo();
|
|
|
+ let userId = group.selfInfo.userID;
|
|
|
+ let params = {
|
|
|
+ memberlist: [userId],
|
|
|
+ groupId: group.groupID,
|
|
|
+ };
|
|
|
+ TUIGlobal.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "是否确认退出该群聊",
|
|
|
+ success: async (res: any) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ await MesApi.default.quitGroup(params);
|
|
|
+ await TUIGroupService.quitGroup(group.groupID);
|
|
|
+ clearGroupInfo();
|
|
|
+ } else if (res.cancel) {
|
|
|
+ return Toast({
|
|
|
+ message: TUITranslateService.t("component.已取消"),
|
|
|
+ type: TOAST_TYPE.ERROR,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const back = () => {
|