fix: 修复空格格式化换行问题

This commit is contained in:
yangzhe 2025-07-24 14:42:54 +08:00
parent 9eeb8eadac
commit a2ced17f63
1 changed files with 31 additions and 27 deletions

View File

@ -21,7 +21,7 @@
></image> ></image>
<text class="message-text" <text class="message-text"
>Hi~ 我是源小新你们的AI校园助手非常高兴认识您我可以为你答疑解惑</text >Hi~&nbsp;我是源小新你们的AI校园助手非常高兴认识您我可以为你答疑解惑</text
> >
</view> </view>
@ -117,7 +117,7 @@
<view class="loading-more" v-if="isLoading"> <view class="loading-more" v-if="isLoading">
<u-loading mode="circle" color="#4370fe"></u-loading> <u-loading mode="circle" color="#4370fe"></u-loading>
</view> </view>
<!-- 到顶部提示 --> <!-- 到顶部提示 -->
<view class="no-more-data" v-if="noMoreData"> <view class="no-more-data" v-if="noMoreData">
<text>已经到顶了</text> <text>已经到顶了</text>
@ -283,7 +283,7 @@ export default {
isLoadingMore: false, // isLoadingMore: false, //
noMoreData: false, // noMoreData: false, //
isSwitchingConversation: false, // isSwitchingConversation: false, //
pageQuery: { pageQuery: {
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
@ -502,7 +502,7 @@ export default {
// //
this.messageGroups.push(userMessage); this.messageGroups.push(userMessage);
this.messageValue = ""; this.messageValue = "";
// AI // AI
const loadingMessage = { const loadingMessage = {
id: "loading_" + Math.random().toString(36).substring(2, 15), id: "loading_" + Math.random().toString(36).substring(2, 15),
@ -514,9 +514,9 @@ export default {
messageType: 0, messageType: 0,
timeLabel: 0, timeLabel: 0,
displayTime: "", displayTime: "",
isLoading: true // isLoading: true, //
}; };
// //
this.messageGroups.push(loadingMessage); this.messageGroups.push(loadingMessage);
@ -532,7 +532,9 @@ export default {
this.currentConversationId = data.conversationId; this.currentConversationId = data.conversationId;
// //
this.messageGroups = this.messageGroups.filter(msg => !msg.isLoading); this.messageGroups = this.messageGroups.filter(
(msg) => !msg.isLoading
);
// AI // AI
const aiMessage = { const aiMessage = {
@ -554,10 +556,12 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.error("API请求失败:", error); console.error("API请求失败:", error);
// //
this.messageGroups = this.messageGroups.filter(msg => !msg.isLoading); this.messageGroups = this.messageGroups.filter(
(msg) => !msg.isLoading
);
// //
const errorMessage = { const errorMessage = {
id: "error_" + Math.random().toString(36).substring(2, 15), id: "error_" + Math.random().toString(36).substring(2, 15),
@ -570,7 +574,7 @@ export default {
timeLabel: 0, timeLabel: 0,
displayTime: "", displayTime: "",
}; };
this.messageGroups.push(errorMessage); this.messageGroups.push(errorMessage);
}); });
}, },
@ -638,18 +642,18 @@ export default {
// //
this.popupShow = false; this.popupShow = false;
this.isChat = true; this.isChat = true;
// //
this.isSwitchingConversation = true; this.isSwitchingConversation = true;
this.currentConversationId = ""; this.currentConversationId = "";
this.messageGroups = []; this.messageGroups = [];
// //
this.pageQuery.PageIndex = 1; this.pageQuery.PageIndex = 1;
this.isLoadingMore = false; this.isLoadingMore = false;
this.noMoreData = false; this.noMoreData = false;
// //
setTimeout(() => { setTimeout(() => {
this.isSwitchingConversation = false; this.isSwitchingConversation = false;
@ -659,18 +663,18 @@ export default {
// //
handleStartChat() { handleStartChat() {
this.isChat = true; this.isChat = true;
// //
this.isSwitchingConversation = true; this.isSwitchingConversation = true;
this.currentConversationId = ""; this.currentConversationId = "";
this.messageGroups = []; this.messageGroups = [];
// //
this.pageQuery.PageIndex = 1; this.pageQuery.PageIndex = 1;
this.isLoadingMore = false; this.isLoadingMore = false;
this.noMoreData = false; this.noMoreData = false;
// //
setTimeout(() => { setTimeout(() => {
this.isSwitchingConversation = false; this.isSwitchingConversation = false;
@ -685,7 +689,7 @@ export default {
// //
onScrollToUpper() { onScrollToUpper() {
console.log("触发上拉刷新"); console.log("触发上拉刷新");
// //
if (this.noMoreData || this.isSwitchingConversation) { if (this.noMoreData || this.isSwitchingConversation) {
return; return;
@ -711,7 +715,7 @@ export default {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "已经到顶了", title: "已经到顶了",
type: "warning", type: "warning",
duration: 1500 duration: 1500,
}); });
return; return;
} }
@ -1002,7 +1006,7 @@ export default {
text-align: center; text-align: center;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.no-more-data { .no-more-data {
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
@ -1050,7 +1054,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
.dot { .dot {
display: inline-block; display: inline-block;
width: 12rpx; width: 12rpx;
@ -1060,20 +1064,20 @@ export default {
margin: 0 6rpx; margin: 0 6rpx;
opacity: 0.6; opacity: 0.6;
animation: dot-flashing 1.5s infinite linear alternate; animation: dot-flashing 1.5s infinite linear alternate;
&:nth-child(1) { &:nth-child(1) {
animation-delay: 0s; animation-delay: 0s;
} }
&:nth-child(2) { &:nth-child(2) {
animation-delay: 0.5s; animation-delay: 0.5s;
} }
&:nth-child(3) { &:nth-child(3) {
animation-delay: 1s; animation-delay: 1s;
} }
} }
@keyframes dot-flashing { @keyframes dot-flashing {
0% { 0% {
opacity: 0.6; opacity: 0.6;