|
@@ -23,21 +23,27 @@
|
|
</template>
|
|
</template>
|
|
</van-nav-bar>
|
|
</van-nav-bar>
|
|
<template v-if="showPage">
|
|
<template v-if="showPage">
|
|
- <!-- <van-pull-refresh v-model="refreshing" @refresh="loadMore" class="flex-1"> -->
|
|
|
|
- <van-list
|
|
|
|
- ref="chatListRef"
|
|
|
|
- class="h-full overflow-y-auto px-12 flex flex-col"
|
|
|
|
- :finished="true"
|
|
|
|
- finished-text=""
|
|
|
|
|
|
+ <van-pull-refresh
|
|
|
|
+ v-model="moreLoading"
|
|
|
|
+ :disabled="moreDisabled"
|
|
|
|
+ @refresh="loadMore"
|
|
|
|
+ head-height="50"
|
|
|
|
+ class="flex-1"
|
|
>
|
|
>
|
|
- <template v-for="(message, index) in currConversationChatList" :key="index">
|
|
|
|
- <ChatMessage :message="message"></ChatMessage>
|
|
|
|
- </template>
|
|
|
|
- <div v-if="false" class="text-[#979797] text-sm text-center mt-auto mb-10">
|
|
|
|
- {{ followStatus }}在对方关注或回复前,最多只能发送1条信息
|
|
|
|
- </div>
|
|
|
|
- </van-list>
|
|
|
|
- <!-- </van-pull-refresh> -->
|
|
|
|
|
|
+ <van-list
|
|
|
|
+ ref="chatListRef"
|
|
|
|
+ class="h-full overflow-y-auto px-12 flex flex-col"
|
|
|
|
+ finished-text=""
|
|
|
|
+ :finished="true"
|
|
|
|
+ >
|
|
|
|
+ <template v-for="(message, index) in currConversationChatList" :key="index">
|
|
|
|
+ <ChatMessage :message="message"></ChatMessage>
|
|
|
|
+ </template>
|
|
|
|
+ <div v-if="false" class="text-[#979797] text-sm text-center mt-auto mb-10">
|
|
|
|
+ {{ followStatus }}在对方关注或回复前,最多只能发送1条信息
|
|
|
|
+ </div>
|
|
|
|
+ </van-list>
|
|
|
|
+ </van-pull-refresh>
|
|
<div class="h-70 w-full bg-[#fff]"></div>
|
|
<div class="h-70 w-full bg-[#fff]"></div>
|
|
<div class="fixed bottom-0 left-0 right-0 w-full bg-[#fff]">
|
|
<div class="fixed bottom-0 left-0 right-0 w-full bg-[#fff]">
|
|
<ChatInput
|
|
<ChatInput
|
|
@@ -99,6 +105,7 @@ const initGroupId = async () => {
|
|
groupId.value = res.data
|
|
groupId.value = res.data
|
|
getAnnouncement()
|
|
getAnnouncement()
|
|
await getChatList('init')
|
|
await getChatList('init')
|
|
|
|
+ await getFollowStatus()
|
|
} catch (e) {
|
|
} catch (e) {
|
|
} finally {
|
|
} finally {
|
|
pageLoading.value = false
|
|
pageLoading.value = false
|
|
@@ -140,7 +147,6 @@ const getChatList = async (type = 'init') => {
|
|
currConversationChatList.value = resList
|
|
currConversationChatList.value = resList
|
|
await scrollToBottom()
|
|
await scrollToBottom()
|
|
}
|
|
}
|
|
- await getFollowStatus()
|
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.error(e)
|
|
console.error(e)
|
|
} finally {
|
|
} finally {
|
|
@@ -241,7 +247,7 @@ const handleSendMessage = async ({ type, messageContent }) => {
|
|
|
|
|
|
const scrollToBottom = async () => {
|
|
const scrollToBottom = async () => {
|
|
// 操作向上加载不滚动 TODO 判断用户是否有向上滑的操作更准确
|
|
// 操作向上加载不滚动 TODO 判断用户是否有向上滑的操作更准确
|
|
- if (refreshing.value) return
|
|
|
|
|
|
+ if (moreLoading.value) return
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
await nextTick() // 确保DOM已经更新
|
|
await nextTick() // 确保DOM已经更新
|
|
const listElement = chatListRef.value?.$el
|
|
const listElement = chatListRef.value?.$el
|
|
@@ -262,13 +268,18 @@ const getFollowStatus = async () => {
|
|
}
|
|
}
|
|
|
|
|
|
// 加载更多
|
|
// 加载更多
|
|
-const refreshing = ref(false)
|
|
|
|
|
|
+const moreLoading = ref(false)
|
|
|
|
+const moreDisabled = ref(false)
|
|
|
|
+
|
|
const loadMore = async () => {
|
|
const loadMore = async () => {
|
|
|
|
+ console.warn('loadMore')
|
|
try {
|
|
try {
|
|
- refreshing.value = true
|
|
|
|
|
|
+ moreLoading.value = true
|
|
if (currConversationChatList.value.length) {
|
|
if (currConversationChatList.value.length) {
|
|
if (totalCount.value === currConversationChatList.value.length) {
|
|
if (totalCount.value === currConversationChatList.value.length) {
|
|
|
|
+ console.warn('已经加载了全部')
|
|
// 已经加载了全部
|
|
// 已经加载了全部
|
|
|
|
+ moreDisabled.value = true
|
|
} else {
|
|
} else {
|
|
await getChatList('more')
|
|
await getChatList('more')
|
|
}
|
|
}
|
|
@@ -276,8 +287,9 @@ const loadMore = async () => {
|
|
await getChatList('init')
|
|
await getChatList('init')
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
|
+ console.log(e, 'error')
|
|
} finally {
|
|
} finally {
|
|
- refreshing.value = false
|
|
|
|
|
|
+ moreLoading.value = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -333,6 +345,21 @@ async function getAnnouncement() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+// async function getAnnouncement() {
|
|
|
|
+// let { data } = await request('/website/tourMember/getGroupUserListVo', {
|
|
|
|
+// query: { groupId: groupId.value }
|
|
|
|
+// })
|
|
|
|
+
|
|
|
|
+// if (data) {
|
|
|
|
+// if (Array.isArray(data.memberList) && data?.memberList?.length) {
|
|
|
|
+// data.memberList.map((el) => {
|
|
|
|
+// if (el.userId == userInfo.value.userId) {
|
|
|
|
+// memberInfo.value = el
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
// 用户删除消息
|
|
// 用户删除消息
|
|
const delMessage = (messageId) => {
|
|
const delMessage = (messageId) => {
|