已过滤工具类消息

This commit is contained in:
2026-07-06 09:34:55 +08:00
parent 879d2e350a
commit b8af01cc69
7 changed files with 171 additions and 144 deletions

View File

@@ -73,9 +73,9 @@
<uni-icons type="chat-filled" size="26" color="#007aff"></uni-icons>
</view>
<view v-if="chat.agent_id">
{{chat.agent_data.title}}
{{truncateText(chat.agent_data?.title) || "加载中"}}
</view>
<view v-else>{{chat.title}}</view>
<view v-else>{{truncateText(chat.title)}}</view>
</view>
<!-- 好友对话列表 -->
<view v-if="chatType === 1" v-for="chat in UserConversations" :key="chat.sessionId"
@@ -312,6 +312,12 @@
const UserAvatar = ref('')
const UserName = ref('')
// 文本截断方法超过20字符显示省略号
const truncateText = (text, maxLength = 20) => {
if (!text) return ''
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text
}
onMounted(async () => {
UserToken.value = getToken()
const UserInfo = await getUserInfo(UserToken.value)