ad747a1fba37c9ea63dab1351ce22bc1d5802d4e..5c9d412ec380f56ae00aa45cd71af7dc56c2834c
2025-04-15 wujingjing
bottom
5c9d41 对比 | 目录
2025-04-15 wujingjing
桌标判断空值
6aca5d 对比 | 目录
已修改4个文件
88 ■■■■ 文件已修改
src/components/chat/Chat.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/BasicMap.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/components/ChatContainer.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/hooks/useScroll.ts 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/Chat.vue
@@ -3,6 +3,7 @@
        :loading="chatListLoading"
        :more-is-loading="moreIsLoading"
        :is-share-page="isSharePage"
        :isTalking="isTalking"
        ref="containerRef"
        @autoSendMessage="autoSendMessage"
    >
@@ -408,7 +409,6 @@
                }
                // 强制触发更新
                scrollToBottom();
            },
            {
@@ -554,10 +554,10 @@
) => {
    updateLoadIndex();
    updateInfo(userItem, assistantItem, resMsgContent, other);
    setTimeout(() => {
        // 收到回复,继续滚
        scrollToBottom();
    }, 300);
    // setTimeout(() => {
    //     // 收到回复,继续滚
    //     scrollToBottom();
    // }, 300);
};
const sendChatMessage = async (content: ChatContent = messageContent.value, lifecycleCall?: QuestionLifecycle) => {
    if (!checkCanSend(content)) {
src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/BasicMap.vue
@@ -48,7 +48,12 @@
            @toggleFullScreen="toggleFullScreen"
        ></PanelTool>
        <Search class="absolute top-0 left-2 z-14 w-fit" :olMap="olMap" :propertyMap="propertyMap"  :propertyConfigMap="propertyConfigMap"/>
        <Search
            class="absolute top-0 left-2 z-14 w-fit"
            :olMap="olMap"
            :propertyMap="propertyMap"
            :propertyConfigMap="propertyConfigMap"
        />
    </div>
</template>
@@ -152,20 +157,31 @@
};
const addMarkerLayer = () => {
    const map = props.data.map;
    if (map.pos_x == null && map.pos_y == null) return;
    const dataList = (props.data?.values ?? []).map((item) => {
        const x = item[map.pos_x];
        const y = item[map.pos_y];
    if (map.pos_x == null || map.pos_y == null) return;
    const dataList = (props.data?.values ?? [])
        .filter((item) => {
            const x = item[map.pos_x];
            const y = item[map.pos_y];
            if (x === null || y == null) {
                return false;
            } else {
                return true;
            }
        })
        .map((item) => {
            const x = item[map.pos_x];
            const y = item[map.pos_y];
        return {
            position: [x, y],
            // textColor: item.color,
            extData: {
                value: item,
                recordSetTable: props.data,
            },
        };
    });
            return {
                position: [x, y],
                // textColor: item.color,
                extData: {
                    value: item,
                    recordSetTable: props.data,
                },
            };
        });
    olMap.value.addMarkerLayer(dataList, {
        markerOpt: {
            icon: {
src/components/chat/components/ChatContainer.vue
@@ -66,7 +66,7 @@
</template>
<script setup lang="ts">
import { onActivated, onDeactivated, ref } from 'vue';
import { onActivated, onDeactivated, ref, toRef, toRefs } from 'vue';
import { useChatWidth } from '../hooks/useChatWidth';
import { useScroll } from '../hooks/useScroll';
import type { QuestionLifecycle } from '../types';
@@ -76,11 +76,14 @@
    loading?: boolean;
    moreIsLoading?: boolean;
    isSharePage?: boolean;
    isTalking?: boolean;
}>();
const emit = defineEmits<{
    autoSendMessage: [string, QuestionLifecycle];
}>();
const { isTalking } = toRefs(props);
const chatListDom = ref<HTMLDivElement>();
const { openDigitalHuman, isHumanTalking, humanIsLoading, digitalHumanIsShow, closeDigitalHuman, digitalHumanWidth } = useDigitalHuman(
@@ -93,6 +96,7 @@
);
const { scrollToBottom, isBottom } = useScroll({
    chatListDom,
    isTalking: isTalking,
});
const fileContentIsShow = ref(false);
src/components/chat/hooks/useScroll.ts
@@ -3,20 +3,25 @@
import type { ChatMessage } from '../model/types';
import emitter from '/@/utils/mitt';
import { debounce } from '/@/utils/util';
import { useEventListener } from '@vueuse/core';
export type UseScrollOption = {
    chatListDom: Ref<HTMLDivElement>;
    isTalking: Ref<boolean>;
};
export const useScroll = (option: UseScrollOption) => {
    const { chatListDom } = option;
    const { chatListDom, isTalking } = option;
    const scrollStepToBottom = () => {
        const allStepList = document.querySelectorAll('.step-list');
        const lastStepList = allStepList[allStepList.length - 1];
        if (!lastStepList) return;
        lastStepList.scrollTop = lastStepList.scrollHeight - lastStepList.clientHeight;
    };
    let isScroll = false;
    const scrollToBottom = () => {
        if (isScroll) return;
        nextTick(() => {
            if (chatListDom.value.scrollHeight > chatListDom.value.clientHeight) {
                chatListDom.value.scrollTop = chatListDom.value.scrollHeight - chatListDom.value.clientHeight;
@@ -27,6 +32,21 @@
        });
    };
    useEventListener(chatListDom, 'scroll', () => {
        if (!isTalking.value) return;
        if (isScroll) return;
        isScroll = true;
    });
    watch(
        () => isTalking.value,
        (val) => {
            if (!val) {
                isScroll = false;
            }
        }
    );
    const scrollToTop = () => {
        nextTick(() => {
            chatListDom.value.scrollTop = 0;
@@ -34,8 +54,12 @@
    };
    const checkIsBottom = () => {
        const bottom = Math.abs(chatListDom.value.scrollTop + chatListDom.value.clientHeight - chatListDom.value.scrollHeight) < 2;
        if (bottom) {
            isScroll = false;
        }
        // 误差 2像素
        isBottom.value = Math.abs(chatListDom.value.scrollTop + chatListDom.value.clientHeight - chatListDom.value.scrollHeight) < 2;
        isBottom.value = bottom;
    };
    const isBottom = ref(true);
    onMounted(() => {