84 lines
2.0 KiB
Plaintext
84 lines
2.0 KiB
Plaintext
<template>
|
|
<view class="all-conversations">
|
|
<!-- 会话列表 -->
|
|
<view
|
|
class="conversation-item"
|
|
hover-class="hover-class"
|
|
hover-start-time="50"
|
|
v-for="item in chatList"
|
|
:key="item.id"
|
|
@click="onConversationClick(item)"
|
|
>
|
|
<text class="conversation-title text-ellipsis">{{ item.topic }}</text>
|
|
<text class="conversation-date">{{ formatDate(item.modified) }}</text>
|
|
</view>
|
|
<empty-state v-if="!chatList.length" />
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="uts">
|
|
import type { ConversationInfo} from '@/types/interfaces/conversationInfo';
|
|
import { formatDate } from '@/utils/system';
|
|
import { jumpToAgentDetailPage } from '@/utils/commonBusiness';
|
|
|
|
interface Props{
|
|
chatList:ConversationInfo[],
|
|
isAppDetails: boolean,
|
|
}
|
|
|
|
// 接收组件属性,设置默认值
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
chatList: [],
|
|
isAppDetails: false,
|
|
})
|
|
|
|
// 会话项点击处理
|
|
const onConversationClick = (item: ConversationInfo) => {
|
|
// 是否是应用详情页
|
|
if (props.isAppDetails) {
|
|
let url = `/subpackages/pages/app-details/app-details?id=${item.agentId}`;
|
|
if (item.id) {
|
|
url = url + "&conversationId=" + item.id;
|
|
}
|
|
|
|
uni.navigateTo({ url });
|
|
} else {
|
|
// 跳转到智能体详情页面,并传递消息数据
|
|
jumpToAgentDetailPage(item.agentId, item.id)
|
|
}
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.all-conversations {
|
|
.conversation-item {
|
|
height: 76rpx;
|
|
padding: 0 16rpx;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
transition: background-color 0.2s;
|
|
gap: 32rpx;
|
|
border-radius: 16rpx;
|
|
|
|
&.hover-class {
|
|
background-color: rgba(12, 20, 102, 0.04);
|
|
}
|
|
|
|
.conversation-title {
|
|
color: #000;
|
|
font-size: 28rpx;
|
|
font-weight: 400;
|
|
flex: 1;
|
|
}
|
|
|
|
.conversation-date {
|
|
text-align: right;
|
|
font-size: 24rpx;
|
|
color: rgba(0, 0, 0, 0.45);
|
|
}
|
|
}
|
|
}
|
|
</style> |