|
|
@@ -38,6 +38,7 @@ const openFile = ref(false); //文件目录
|
|
|
const openForwardFile = ref(false); //转发目录
|
|
|
const showCircel=ref('') //是否 显示圆点
|
|
|
const chatRecords = reactive({ data: [] });
|
|
|
+const loading = ref(false)
|
|
|
const sendCont = reactive({
|
|
|
//发送聊天内容数据组装
|
|
|
data: {
|
|
|
@@ -194,9 +195,6 @@ const handleNewMessage = () => {
|
|
|
};
|
|
|
watchEffect(() => {
|
|
|
if (websoctStore.messOne?.fromId) {
|
|
|
- if(websoctStore.messOne.fromId==personList.data[0]?.fromId){
|
|
|
- showCircel.value=websoctStore.messOne.fromId
|
|
|
- }
|
|
|
msgRecordEvent(websoctStore.messOne.fromId);
|
|
|
}
|
|
|
});
|
|
|
@@ -205,7 +203,8 @@ const noMes = ref(false);
|
|
|
const handleScroll = (event) => {
|
|
|
// 在滚动到顶部时,加载上一页的聊天记录
|
|
|
const mainContainer = document.querySelector(".right-container");
|
|
|
- if (event.deltaY < 0 && mainContainer.scrollTop <= 1) {
|
|
|
+ if (event.deltaY < 0 && mainContainer.scrollTop <= 1&&!noMes.value) {
|
|
|
+ loading.value=true
|
|
|
loadPreviousPage();
|
|
|
}
|
|
|
};
|
|
|
@@ -216,10 +215,12 @@ const loadPreviousPage = async () => {
|
|
|
pageSize: 10,
|
|
|
};
|
|
|
const resMsgData = await msgRecord(sendCont.data.toId, queryParams);
|
|
|
+ loading.value=false
|
|
|
const previousPageData = resMsgData.rows.reverse();
|
|
|
if (currentPageNum * 10 >= resMsgData.total && !noMes.value) {
|
|
|
- noMes.value = true;
|
|
|
- return ElMessage("无更多聊天记录");
|
|
|
+ return noMes.value = true;
|
|
|
+
|
|
|
+ // return ElMessage("无更多聊天记录");
|
|
|
}
|
|
|
// 将加载的上一页聊天记录插入到 chatRecords.data 的前面
|
|
|
chatRecords.data = [...previousPageData, ...chatRecords.data];
|
|
|
@@ -276,8 +277,7 @@ onMounted(() => {
|
|
|
@change="SearchChat"
|
|
|
/>
|
|
|
<!-- 添加聊天人员 -->
|
|
|
- <el-icon size="24" color="#505870" @click="clickNewPerson"
|
|
|
- ><Plus
|
|
|
+ <el-icon size="24" color="#505870" @click="clickNewPerson" style=" margin-right: 8px;"><Plus
|
|
|
/></el-icon>
|
|
|
<!-- 新建聊天弹框 -->
|
|
|
<Addperson
|
|
|
@@ -318,10 +318,10 @@ onMounted(() => {
|
|
|
: item.toName
|
|
|
}}</span
|
|
|
><span class="person-cont spill">
|
|
|
- {{ item.cont ? item.cont : item.content }}</span
|
|
|
+ {{ item.file?.fileName ? item.file?.fileName : item.content }}</span
|
|
|
>
|
|
|
</div>
|
|
|
- <span class="yuandian" v-if="showCircel==item.fromId&&$route.path=='/index'"></span>
|
|
|
+ <!-- <span class="yuandian" v-if="showCircel==item.fromId&&$route.path=='/index'"></span> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 右侧聊天 -->
|
|
|
@@ -340,6 +340,8 @@ onMounted(() => {
|
|
|
@mousewheel="handleScroll"
|
|
|
ref="mainContainer"
|
|
|
>
|
|
|
+ <div v-loading="loading"></div>
|
|
|
+ <!-- <div v-if="noMes" style="color:#9fa1a5 ;">无更多聊天记录</div> -->
|
|
|
<div
|
|
|
class="message-container"
|
|
|
v-for="(record, index) in chatRecords.data"
|