|
@@ -49,6 +49,9 @@
|
|
|
<img class="emptyImg" src="../../assets/nomore.png" />
|
|
|
<p>暂无数据</p>
|
|
|
</div>
|
|
|
+ <DialogTUI :show="dialogShow" :isHeaderShow="true" title="提示" :is-footer-show="true" @submit="handleManage()" @update:show="(e) => (dialogShow = e)">
|
|
|
+ <p>该群已解散,是否删除?</p>
|
|
|
+ </DialogTUI>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -56,11 +59,12 @@
|
|
|
import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
|
|
|
import { caculateTimeago } from "../utils";
|
|
|
import { handleAvatar, handleName, handleAt } from "../TUIChat/utils/utils";
|
|
|
-import { imGroupPage } from "../../../api";
|
|
|
+import { imGroupPage, imGroupDetail } from "../../../api";
|
|
|
import { useThrottleFn } from "@vueuse/core";
|
|
|
+import DialogTUI from "../../components/dialogTUi/index.vue";
|
|
|
const TUIGroup = defineComponent({
|
|
|
name: "TUIGroup",
|
|
|
- // components: { TheEmpty, TheSearch },
|
|
|
+ components: { DialogTUI },
|
|
|
props: {
|
|
|
displayOnlineStatus: {
|
|
|
type: Boolean,
|
|
@@ -81,6 +85,8 @@ const TUIGroup = defineComponent({
|
|
|
currentGroup: null,
|
|
|
netWork: "",
|
|
|
userStatusList: new Map(),
|
|
|
+ dialogShow: false,
|
|
|
+ dialogItem: {} as any,
|
|
|
});
|
|
|
|
|
|
const handleItemTime = (time: number) => {
|
|
@@ -91,13 +97,29 @@ const TUIGroup = defineComponent({
|
|
|
};
|
|
|
|
|
|
const handleListItem = async (item: any) => {
|
|
|
- const name = `GROUP${item.groupId}`;
|
|
|
- TUIServer.TUICore.TUIServer.TUIConversation.getConversationProfile(name).then((imResponse: any) => {
|
|
|
- // 通知 TUIConversation 添加当前会话
|
|
|
- TUIServer.TUICore.TUIServer.TUIConversation.handleCurrentConversation(imResponse.data.conversation);
|
|
|
+ try {
|
|
|
+ // 判断群是否存在
|
|
|
+ const res = await imGroupDetail({ id: item.groupId });
|
|
|
+ // 判断是否有群
|
|
|
+ if (res.data?.id) {
|
|
|
+ const name = `GROUP${item.groupId}`;
|
|
|
+ TUIServer.TUICore.TUIServer.TUIConversation.getConversationProfile(name).then((imResponse: any) => {
|
|
|
+ // 通知 TUIConversation 添加当前会话
|
|
|
+ TUIServer.TUICore.TUIServer.TUIConversation.handleCurrentConversation(imResponse.data.conversation);
|
|
|
|
|
|
- (data.currentGroup as any) = {};
|
|
|
- });
|
|
|
+ (data.currentGroup as any) = {};
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ data.dialogShow = true;
|
|
|
+ data.dialogItem = item;
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const handleManage = () => {
|
|
|
+ const index = data.groupList.findIndex((item: any) => item.groupId == data.dialogItem.groupId);
|
|
|
+ data.groupList.splice(index, 1);
|
|
|
};
|
|
|
const isNetwork = computed(() => {
|
|
|
// const disconnected =
|
|
@@ -154,6 +176,7 @@ const TUIGroup = defineComponent({
|
|
|
return {
|
|
|
...toRefs(data),
|
|
|
handleListItem,
|
|
|
+ handleManage,
|
|
|
isNetwork,
|
|
|
handleAvatar,
|
|
|
handleName,
|