|
@@ -181,8 +181,8 @@ const sendTextMessage = async (text) => {
|
|
|
}
|
|
|
}
|
|
|
const isLink = !!findHyperlinks(text)
|
|
|
- if (isLink) msg.messageType = 0
|
|
|
- console.log(currConversationChatList.value, '1122')
|
|
|
+ if (isLink) msg.messageType = 4
|
|
|
+ // console.log(currConversationChatList.value, '1122')
|
|
|
currConversationChatList.value.push(msg)
|
|
|
await scrollToBottom()
|
|
|
await chatsStore.sendSocketMessage(msg)
|
|
@@ -234,6 +234,8 @@ const sendImageMessage = async (file) => {
|
|
|
}
|
|
|
|
|
|
const handleSendMessage = async ({ type, messageContent }) => {
|
|
|
+ console.log(131)
|
|
|
+
|
|
|
try {
|
|
|
switch (type) {
|
|
|
case 'text':
|
|
@@ -252,17 +254,17 @@ const handleSendMessage = async ({ type, messageContent }) => {
|
|
|
}
|
|
|
|
|
|
// async
|
|
|
-const scrollToBottom = () => {
|
|
|
+const scrollToBottom = async () => {
|
|
|
// 操作向上加载不滚动 TODO 判断用户是否有向上滑的操作更准确
|
|
|
if (moreLoading.value) return
|
|
|
- // setTimeout(async () => {
|
|
|
- // await nextTick() // 确保DOM已经更新
|
|
|
- // const listElement = chatListRef.value?.$el
|
|
|
- // if (listElement) {
|
|
|
- // const scrollContainer = listElement
|
|
|
- // scrollContainer.scrollTop = scrollContainer.scrollHeight
|
|
|
- // }
|
|
|
- // }, 200)
|
|
|
+ setTimeout(async () => {
|
|
|
+ await nextTick() // 确保DOM已经更新
|
|
|
+ const listElement = chatListRef.value?.$el
|
|
|
+ if (listElement) {
|
|
|
+ const scrollContainer = listElement
|
|
|
+ scrollContainer.scrollTop = scrollContainer.scrollHeight + 100
|
|
|
+ }
|
|
|
+ }, 200)
|
|
|
|
|
|
// await nextTick() // 确保DOM已经更新
|
|
|
// const listElement = chatListRef.value?.$el
|
|
@@ -270,12 +272,12 @@ const scrollToBottom = () => {
|
|
|
// const scrollContainer = listElement
|
|
|
// scrollContainer.scrollTop = scrollContainer.scrollHeight
|
|
|
// }
|
|
|
- nextTick(() => {
|
|
|
- const listElement = chatListRef.value?.$el
|
|
|
- setTimeout(() => {
|
|
|
- listElement && (listElement.scrollTop = listElement.scrollHeight + 100)
|
|
|
- }, 200)
|
|
|
- })
|
|
|
+ // await nextTick(() => {
|
|
|
+ // const listElement = chatListRef.value?.$el
|
|
|
+ // setTimeout(() => {
|
|
|
+ // listElement && (listElement.scrollTop = listElement.scrollHeight + 100)
|
|
|
+ // }, 200)
|
|
|
+ // })
|
|
|
}
|
|
|
|
|
|
// 获取我与对方的关注情况
|
|
@@ -292,7 +294,7 @@ const moreLoading = ref(false)
|
|
|
const moreDisabled = ref(false)
|
|
|
|
|
|
const loadMore = async () => {
|
|
|
- console.warn('loadMore')
|
|
|
+ // console.warn('loadMore')
|
|
|
try {
|
|
|
moreLoading.value = true
|
|
|
if (currConversationChatList.value.length) {
|