ソースを参照

fix: 1.解决扫码框不显示的问题 和链接的问题

suwenjiang 1 ヶ月 前
コミット
874f3722f4
4 ファイル変更27 行追加24 行削除
  1. 3 2
      .env.development
  2. 1 1
      src/pages/chat/group-chat.vue
  3. 20 18
      src/pages/chat/single-chat.vue
  4. 3 3
      src/pages/scan/index.vue

+ 3 - 2
.env.development

@@ -1,11 +1,13 @@
 VITE_APP_ENV=development
 
+
+# 测试服
 # VITE_APP_BASE_URL=https://service.xiaoyaotravel.com/api/
 VITE_APP_BASE_URL=http://101.126.146.250:8082/
 VITE_APP_IM_URL=ws://101.126.146.250:8082/system/message
 
 
-# 测试服
+
 
 
 
@@ -33,7 +35,6 @@ VITE_APP_IM_URL=ws://101.126.146.250:8082/system/message
 # VITE_APP_IM_URL=ws://4eqxwr.natappfree.cc/system/message
 
 
-
 # VITE_APP_BASE_URL=http://192.168.1.204:8082
 VITE_APP_EMOJI_API=https://v.xiaoyaotravel.com/emoji/
 VITE_APP_IM_USER_SUFFIX=dev

+ 1 - 1
src/pages/chat/group-chat.vue

@@ -206,7 +206,7 @@ const sendTextMessage = async (text) => {
       }
     }
     const isLink = !!findHyperlinks(text)
-    if (isLink) msg.messageType = 0
+    if (isLink) msg.messageType = 4
     currConversationChatList.value.push(msg)
     await scrollToBottom()
     const res = await chatsStore.sendSocketMessage(msg)

+ 20 - 18
src/pages/chat/single-chat.vue

@@ -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) {

+ 3 - 3
src/pages/scan/index.vue

@@ -37,12 +37,12 @@ const openQrcode = async () => {
           height: 250
         },
         videoConstraints: {
-          width: window.visualViewport.width, // 框宽的
-          height: '100%', // 框高的
+          width: window.visualViewport.height, // 框宽的
+          height: window.visualViewport.width, // 框高的
           aspectRatio: 5 / 5
         },
         aspectRatio: window.visualViewport.width / window.visualViewport.height // 视频的宽高
-      }
+        }
       if (devices && devices.length) {
         // 当前环境下能识别出摄像头,并且摄像头的数据可能不止一个
         let cameraId = devices[devices.length - 1].id //后置摄像头,一般最后一个是后置摄像头