diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index 99859205e..140c90e8c 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -43,7 +43,7 @@ "@vben/styles": "workspace:*", "@vben/types": "workspace:*", "@vben/utils": "workspace:*", - "@vueuse/components": "^14.0.0", + "@vueuse/components": "catalog:", "@vueuse/core": "catalog:", "@vueuse/integrations": "catalog:", "ant-design-vue": "catalog:", diff --git a/apps/web-antd/src/components/card-title/CardTitle.vue b/apps/web-antd/src/components/card-title/CardTitle.vue index 99f9d1131..b59ed966c 100644 --- a/apps/web-antd/src/components/card-title/CardTitle.vue +++ b/apps/web-antd/src/components/card-title/CardTitle.vue @@ -1,4 +1,6 @@ diff --git a/apps/web-antd/src/views/mall/promotion/kefu/components/KeFuConversationList.vue b/apps/web-antd/src/views/mall/promotion/kefu/components/KeFuConversationList.vue index 0d99777fa..16d8f349a 100644 --- a/apps/web-antd/src/views/mall/promotion/kefu/components/KeFuConversationList.vue +++ b/apps/web-antd/src/views/mall/promotion/kefu/components/KeFuConversationList.vue @@ -3,12 +3,16 @@ import type { MallKefuConversationApi } from '#/api/mall/promotion/kefu/conversa import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'; +import { confirm } from '@vben/common-ui'; import { IconifyIcon } from '@vben/icons'; import { formatPast, jsonParse } from '@vben/utils'; -import { Avatar, Badge, message } from 'ant-design-vue'; +import { Avatar, Badge, Layout, message } from 'ant-design-vue'; -import * as KeFuConversationApi from '#/api/mall/promotion/kefu/conversation'; +import { + deleteConversation, + updateConversationPinned, +} from '#/api/mall/promotion/kefu/conversation'; import { useMallKefuStore } from '#/store/mall/kefu'; import { KeFuMessageContentTypeEnum } from './tools/constants'; @@ -108,27 +112,29 @@ function closeRightMenu() { } /** 置顶会话 */ -async function updateConversationPinned(adminPinned: boolean) { +async function updateConversationPinnedFn(pinned: boolean) { // 1. 会话置顶/取消置顶 - await KeFuConversationApi.updateConversationPinned({ + await updateConversationPinned({ id: rightClickConversation.value.id, - adminPinned, + pinned, }); - message.success(adminPinned ? '置顶成功' : '取消置顶成功'); + message.success(pinned ? '置顶成功' : '取消置顶成功'); // 2. 关闭右键菜单,更新会话列表 closeRightMenu(); await kefuStore.updateConversation(rightClickConversation.value.id); } /** 删除会话 */ -async function deleteConversation() { +async function deleteConversationFn() { // 1. 删除会话 - // TODO @jave:使用全局的 confirm,这样 ele 和 antd 可以相对复用; - await message.confirm('您确定要删除该会话吗?'); - await KeFuConversationApi.deleteConversation(rightClickConversation.value.id); - // 2. 关闭右键菜单,更新会话列表 - closeRightMenu(); - kefuStore.deleteConversation(rightClickConversation.value.id); + confirm({ + content: '您确定要删除该会话吗?', + }).then(async () => { + await deleteConversation(rightClickConversation.value.id); + // 2. 关闭右键菜单,更新会话列表 + closeRightMenu(); + kefuStore.deleteConversation(rightClickConversation.value.id); + }); } /** 监听右键菜单的显示状态,添加点击事件监听器 */ @@ -154,7 +160,7 @@ onBeforeUnmount(() => { - + 会话记录({{ kefuStore.getConversationList.length }}) @@ -206,7 +212,7 @@ onBeforeUnmount(() => { 置顶会话 @@ -214,12 +220,12 @@ onBeforeUnmount(() => { 取消置顶 - + 删除会话 @@ -228,7 +234,7 @@ onBeforeUnmount(() => { 取消 - +