潘超林 1 일 전
부모
커밋
e9db7454c9
2개의 변경된 파일140개의 추가작업 그리고 40개의 파일을 삭제
  1. 1 1
      TUIKit/components/TUIGroup/index.vue
  2. 139 39
      TUIKit/components/TUIGroup/manage-group/index.vue

+ 1 - 1
TUIKit/components/TUIGroup/index.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
   <div :class="[(isShowCreateGroup || isShowManageGroup || isShowSelectMember) && 'tui-group']">
   <div :class="[(isShowCreateGroup || isShowManageGroup || isShowSelectMember) && 'tui-group']">
-    <CreateGroup v-if="isShowCreateGroup" />
+    <!-- <CreateGroup v-if="isShowCreateGroup" /> -->
     <ManageGroup v-if="isShowManageGroup" />
     <ManageGroup v-if="isShowManageGroup" />
     <SelectMember v-if="isShowSelectMember" />
     <SelectMember v-if="isShowSelectMember" />
   </div>
   </div>

+ 139 - 39
TUIKit/components/TUIGroup/manage-group/index.vue

@@ -1,6 +1,9 @@
 <template>
 <template>
   <div ref="manageRef" class="manage">
   <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">
       <div @click="back">
         <Icon :file="backSVG" />
         <Icon :file="backSVG" />
       </div>
       </div>
@@ -8,7 +11,10 @@
         {{ TUITranslateService.t(`TUIGroup.${TabName}`) }}
         {{ TUITranslateService.t(`TUIGroup.${TabName}`) }}
       </div>
       </div>
     </header>
     </header>
-    <main v-if="!currentTab || (isUniFrameWork && currentTab != 'admin')" class="main">
+    <main
+      v-if="!currentTab || (isUniFrameWork && currentTab != 'admin')"
+      class="main"
+    >
       <ManageName
       <ManageName
         class="space-top"
         class="space-top"
         :isAuthor="isAuthor"
         :isAuthor="isAuthor"
@@ -34,7 +40,10 @@
             :key="index"
             :key="index"
             class="user-info-list-item"
             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
               <img
                 class="avatar"
                 class="avatar"
                 :src="
                 :src="
@@ -59,7 +68,9 @@
       <ul class="content list space-top" @click="editLableName = ''">
       <ul class="content list space-top" @click="editLableName = ''">
         <li class="list-item" @click="setCurrentTab('notification')">
         <li class="list-item" @click="setCurrentTab('notification')">
           <aside class="aside">
           <aside class="aside">
-            <label class="label">{{ TUITranslateService.t(`TUIGroup.群公告`) }}</label>
+            <label class="label">{{
+              TUITranslateService.t(`TUIGroup.群公告`)
+            }}</label>
             <article class="article">
             <article class="article">
               {{ currentGroup.notification }}
               {{ currentGroup.notification }}
             </article>
             </article>
@@ -71,7 +82,9 @@
           class="list-item"
           class="list-item"
           @click="setCurrentTab('admin')"
           @click="setCurrentTab('admin')"
         >
         >
-          <label class="label">{{ TUITranslateService.t(`TUIGroup.群管理`) }}</label>
+          <label class="label">{{
+            TUITranslateService.t(`TUIGroup.群管理`)
+          }}</label>
           <Icon :file="rightIcon" />
           <Icon :file="rightIcon" />
         </li>
         </li>
         <!-- <li class="list-item">
         <!-- <li class="list-item">
@@ -81,7 +94,9 @@
           </div>
           </div>
         </li> -->
         </li> -->
         <li class="list-item">
         <li class="list-item">
-          <label class="label">{{ TUITranslateService.t(`TUIGroup.群头像`) }}</label>
+          <label class="label">{{
+            TUITranslateService.t(`TUIGroup.群头像`)
+          }}</label>
           <img
           <img
             class="avatar"
             class="avatar"
             :src="
             :src="
@@ -92,26 +107,32 @@
           />
           />
         </li>
         </li>
         <li class="list-item">
         <li class="list-item">
-          <label class="label">{{ TUITranslateService.t(`TUIGroup.群类型`) }}</label>
+          <label class="label">{{
+            TUITranslateService.t(`TUIGroup.群类型`)
+          }}</label>
           <span class="span">{{
           <span class="span">{{
             TUITranslateService.t(`TUIGroup.${typeName[currentGroup.type]}`)
             TUITranslateService.t(`TUIGroup.${typeName[currentGroup.type]}`)
           }}</span>
           }}</span>
         </li>
         </li>
         <li class="list-item">
         <li class="list-item">
-          <label class="label">{{ TUITranslateService.t(`TUIGroup.加群方式`) }}</label>
+          <label class="label">{{
+            TUITranslateService.t(`TUIGroup.加群方式`)
+          }}</label>
           <span class="span">{{
           <span class="span">{{
-            TUITranslateService.t(`TUIGroup.${typeName[currentGroup.joinOption]}`)
+            TUITranslateService.t(
+              `TUIGroup.${typeName[currentGroup.joinOption]}`
+            )
           }}</span>
           }}</span>
         </li>
         </li>
       </ul>
       </ul>
       <ul class="footer list space-top">
       <ul class="footer list space-top">
-        <li
+        <!-- <li
           v-if="currentSelfRole === 'Owner' && groupMemberList.length > 1"
           v-if="currentSelfRole === 'Owner' && groupMemberList.length > 1"
           class="list-item"
           class="list-item"
           @click.stop="toggleMask('changeOwner')"
           @click.stop="toggleMask('changeOwner')"
         >
         >
           {{ TUITranslateService.t(`TUIGroup.转让群组`) }}
           {{ TUITranslateService.t(`TUIGroup.转让群组`) }}
-        </li>
+        </li> -->
         <li
         <li
           v-if="canIDissmissGroup"
           v-if="canIDissmissGroup"
           class="list-item"
           class="list-item"
@@ -193,7 +214,14 @@
   </div>
   </div>
 </template>
 </template>
 <script lang="ts" setup>
 <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, {
 import TUIChatEngine, {
   TUITranslateService,
   TUITranslateService,
   TUIGroupService,
   TUIGroupService,
@@ -400,17 +428,27 @@ const updateProfile = async (newGroupProfile: any) => {
     groupID: currentGroup.value.groupID,
     groupID: currentGroup.value.groupID,
     [key]: value,
     [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) => {
 const setCurrentTab = (tabName: string) => {
@@ -486,7 +524,9 @@ const friendList = async () => {
   const friendList = imResponse.data.map((item: any) => item?.profile);
   const friendList = imResponse.data.map((item: any) => item?.profile);
   return friendList.filter(
   return friendList.filter(
     (item: any) =>
     (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) => {
 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 = () => {
 const clearGroupInfo = () => {
   if (isUniFrameWork) {
   if (isUniFrameWork) {
-    TUIGlobal?.switchTab({
-      url: "/TUIKit/components/TUIConversation/index",
+    TUIGlobal?.navigateTo({
+      url: `/TUIKit-${capitalize(
+        uni.getStorageSync("Identity")
+      )}/components/TUIConversation/index`,
     });
     });
   } else {
   } else {
     handleCompleteManage();
     handleCompleteManage();
@@ -633,7 +706,10 @@ const handleSearchMember = async (value: string) => {
           (item: any) => item.userID !== imResponse?.data?.memberList[0]?.userID
           (item: any) => item.userID !== imResponse?.data?.memberList[0]?.userID
         );
         );
         if (imResponse?.data?.memberList.length) {
         if (imResponse?.data?.memberList.length) {
-          transferList.value = [...transferList.value, ...imResponse.data.memberList];
+          transferList.value = [
+            ...transferList.value,
+            ...imResponse.data.memberList,
+          ];
         }
         }
       } catch (error: any) {
       } catch (error: any) {
         const message = TUITranslateService.t("TUIGroup.该用户不存在");
         const message = TUITranslateService.t("TUIGroup.该用户不存在");
@@ -728,16 +804,40 @@ const handleAdmin = async (user: any) => {
 
 
 const deleteGroupMember = async (userIDList: any) => {
 const deleteGroupMember = async (userIDList: any) => {
   const options: any = {
   const options: any = {
-    groupID: currentGroupID.value,
-    userIDList,
+    groupId: currentGroupID.value,
+    memberlist: userIDList,
     reason: "",
     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) => {
 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 = () => {
 const back = () => {