97 lines
2.5 KiB
Plaintext
97 lines
2.5 KiB
Plaintext
<template>
|
|
<view class="related-conversation">
|
|
<view class="header">
|
|
<text class="title">{{ t("Mobile.Conversation.relatedTitle") }}</text>
|
|
<view class="view-all" @click="onViewAll(chatList)">
|
|
<text class="view-all-text">{{
|
|
t("Mobile.Conversation.viewAll")
|
|
}}</text>
|
|
<text class="iconfont icon-a-Chevronright" />
|
|
</view>
|
|
</view>
|
|
<custom-nav-bar-speak :chat-list="chatList?.slice(0, 10)" />
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="uts">
|
|
import type { ConversationInfo } from "@/types/interfaces/conversationInfo";
|
|
import type { AgentDetailDto } from "@/types/interfaces/agent";
|
|
import { SUCCESS_CODE } from "@/constants/codes.constants";
|
|
import { apiAgentConversationList } from "@/servers/conversation";
|
|
import CustomNavBarSpeak from "@/components/custom-nav-bar/custom-nav-bar-speak/custom-nav-bar-speak.uvue";
|
|
import { useI18n } from "@/utils/i18n";
|
|
|
|
const { t } = useI18n();
|
|
|
|
interface Props {
|
|
agentInfo: AgentDetailDto;
|
|
}
|
|
|
|
// 接收组件属性,设置默认值
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
// 定义自定义事件
|
|
const emit = defineEmits<{
|
|
// 查看全部事件
|
|
"view-all": [type: string];
|
|
}>();
|
|
|
|
const chatList = ref<ConversationInfo[]>([]);
|
|
|
|
// 查看全部处理
|
|
const onViewAll = (data: ConversationInfo[]) => {
|
|
emit("view-all", data);
|
|
};
|
|
|
|
// 查询用户历史会话
|
|
const fetchUserConversationList = async () => {
|
|
const { code, data } = await apiAgentConversationList({
|
|
agentId: props.agentInfo.agentId,
|
|
});
|
|
if (code === SUCCESS_CODE) {
|
|
chatList.value = data || [];
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
fetchUserConversationList();
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.related-conversation {
|
|
padding: 0rpx;
|
|
background-color: #fff;
|
|
border-radius: 16rpx;
|
|
margin-bottom: 24rpx;
|
|
.header {
|
|
margin-top: 20rpx;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 20rpx 10rpx;
|
|
.title {
|
|
font-size: 28rpx;
|
|
font-weight: 600;
|
|
color: rgba(21, 23, 31, 1);
|
|
line-height: 44rpx;
|
|
}
|
|
.view-all {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
.view-all-text {
|
|
font-size: 24rpx;
|
|
color: rgba(130, 136, 148, 1);
|
|
margin-right: 5rpx;
|
|
line-height: 38rpx;
|
|
}
|
|
.iconfont {
|
|
font-size: 26rpx;
|
|
color: #898a8e;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|