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