mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-02-02 03:34:59 +08:00
【解决todo】AI 对话增加加载中。
This commit is contained in:
parent
8b0d598d8a
commit
6a03b7637e
@ -24,7 +24,10 @@
|
|||||||
|
|
||||||
<!-- 左中间:对话列表 -->
|
<!-- 左中间:对话列表 -->
|
||||||
<div class="conversation-list">
|
<div class="conversation-list">
|
||||||
<!-- TODO @fain:置顶、聊天记录、一星期钱、30天前,前端对数据重新做一下分组,或者后端接口改一下 -->
|
|
||||||
|
<el-empty v-if="loading" description="." :v-loading="loading" />
|
||||||
|
|
||||||
|
<!-- TODO done @fain:置顶、聊天记录、一星期钱、30天前,前端对数据重新做一下分组,或者后端接口改一下 -->
|
||||||
<div v-for="conversationKey in Object.keys(conversationMap)" :key="conversationKey">
|
<div v-for="conversationKey in Object.keys(conversationMap)" :key="conversationKey">
|
||||||
<div class="conversation-item classify-title" v-if="conversationMap[conversationKey].length">
|
<div class="conversation-item classify-title" v-if="conversationMap[conversationKey].length">
|
||||||
<el-text class="mx-1" size="small" tag="b">{{ conversationKey }}</el-text>
|
<el-text class="mx-1" size="small" tag="b">{{ conversationKey }}</el-text>
|
||||||
@ -102,6 +105,8 @@ const activeConversationId = ref<string | null>(null) // 选中的对话,默
|
|||||||
const conversationList = ref([] as ChatConversationVO[]) // 对话列表
|
const conversationList = ref([] as ChatConversationVO[]) // 对话列表
|
||||||
const conversationMap = ref<any>({}) // 对话分组 (置顶、今天、三天前、一星期前、一个月前)
|
const conversationMap = ref<any>({}) // 对话分组 (置顶、今天、三天前、一星期前、一个月前)
|
||||||
const drawer = ref<boolean>(false) // 角色仓库抽屉
|
const drawer = ref<boolean>(false) // 角色仓库抽屉
|
||||||
|
const loading = ref<boolean>(false) // 加载中
|
||||||
|
const loadingTime = ref<any>() // 加载中定时器
|
||||||
|
|
||||||
// 定义组件 props
|
// 定义组件 props
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -147,6 +152,11 @@ const handleConversationClick = async (id: string) => {
|
|||||||
* 对话 - 获取列表
|
* 对话 - 获取列表
|
||||||
*/
|
*/
|
||||||
const getChatConversationList = async () => {
|
const getChatConversationList = async () => {
|
||||||
|
try {
|
||||||
|
// 0、加载中
|
||||||
|
loadingTime.value = setTimeout(() => {
|
||||||
|
loading.value = true
|
||||||
|
}, 50)
|
||||||
// 1、获取 对话数据
|
// 1、获取 对话数据
|
||||||
const res = await ChatConversationApi.getChatConversationMyList()
|
const res = await ChatConversationApi.getChatConversationMyList()
|
||||||
// 2、排序
|
// 2、排序
|
||||||
@ -166,6 +176,14 @@ const getChatConversationList = async () => {
|
|||||||
}
|
}
|
||||||
// 5、对话根据时间分组(置顶、今天、一天前、三天前、七天前、30天前)
|
// 5、对话根据时间分组(置顶、今天、一天前、三天前、七天前、30天前)
|
||||||
conversationMap.value = await conversationTimeGroup(conversationList.value)
|
conversationMap.value = await conversationTimeGroup(conversationList.value)
|
||||||
|
} finally {
|
||||||
|
// 清理定时器
|
||||||
|
if (loadingTime.value) {
|
||||||
|
clearTimeout(loadingTime.value)
|
||||||
|
}
|
||||||
|
// 加载完成
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversationTimeGroup = async (list: ChatConversationVO[]) => {
|
const conversationTimeGroup = async (list: ChatConversationVO[]) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user