mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	fix: fixed bug image preview im mobile chat session page
This commit is contained in:
		@@ -131,6 +131,7 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
 | 
			
		||||
		c.Abort()
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	h.Init()
 | 
			
		||||
 | 
			
		||||
	// 保存会话连接
 | 
			
		||||
	h.App.ChatClients.Put(sessionId, client)
 | 
			
		||||
 
 | 
			
		||||
@@ -393,9 +393,6 @@ func main() {
 | 
			
		||||
				log.Fatal(err)
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
		fx.Invoke(func(h *chatimpl.ChatHandler) {
 | 
			
		||||
			h.Init()
 | 
			
		||||
		}),
 | 
			
		||||
		// 注册生命周期回调函数
 | 
			
		||||
		fx.Invoke(func(lifecycle fx.Lifecycle, lc *AppLifecycle) {
 | 
			
		||||
			lifecycle.Append(fx.Hook{
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import {onMounted, ref} from "vue"
 | 
			
		||||
import {nextTick, onMounted, ref} from "vue"
 | 
			
		||||
 | 
			
		||||
import {showImagePreview} from "vant";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -104,7 +104,7 @@
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import {nextTick, onMounted, ref} from "vue";
 | 
			
		||||
import {showNotify, showToast} from "vant";
 | 
			
		||||
import {showImagePreview, showNotify, showToast} from "vant";
 | 
			
		||||
import {onBeforeRouteLeave, useRouter} from "vue-router";
 | 
			
		||||
import {dateFormat, processContent, randString, renderInputText, UUID} from "@/utils/libs";
 | 
			
		||||
import {getChatConfig} from "@/store/chat";
 | 
			
		||||
@@ -326,6 +326,18 @@ const connect = function (chat_id, role_id) {
 | 
			
		||||
              hl.highlightElement(block)
 | 
			
		||||
            })
 | 
			
		||||
            scrollListBox()
 | 
			
		||||
 | 
			
		||||
            const items = document.querySelectorAll('.message-line')
 | 
			
		||||
            const imgs = items[items.length - 1].querySelectorAll('img')
 | 
			
		||||
            for (let i = 0; i < imgs.length; i++) {
 | 
			
		||||
              if (!imgs[i].src) {
 | 
			
		||||
                continue
 | 
			
		||||
              }
 | 
			
		||||
              imgs[i].addEventListener('click', (e) => {
 | 
			
		||||
                e.stopPropagation()
 | 
			
		||||
                showImagePreview([imgs[i].src]);
 | 
			
		||||
              })
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user