1. 新增模块品类穿透
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
<template>
|
||||
<slot></slot>
|
||||
<!-- 全局右下角悬浮按钮(参考 AIRBT.html 样式);登录页不展示 -->
|
||||
<div
|
||||
v-if="showAssistantFab"
|
||||
ref="fabRef"
|
||||
class="ai-assistant-fab"
|
||||
:class="{ 'is-loading': pageLoading, 'is-hidden': dialogVisible, 'is-dragging': fabDragging }"
|
||||
:style="fabPositionStyle"
|
||||
@pointerdown="onFabPointerDown"
|
||||
>
|
||||
<div class="fab-icon-wrap">
|
||||
<Icon v-if="!pageLoading" icon="ep:chat-dot-round" class="fab-icon" />
|
||||
<Icon v-else icon="ep:loading" class="fab-icon fab-loading" />
|
||||
<!-- Teleport 到 body:避免父級 transform/overflow 讓 position:fixed 參考錯容器而被裁切 -->
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="showAssistantFab"
|
||||
ref="fabRef"
|
||||
class="ai-assistant-fab"
|
||||
:class="{ 'is-loading': pageLoading, 'is-hidden': dialogVisible, 'is-dragging': fabDragging }"
|
||||
:style="fabPositionStyle"
|
||||
@pointerdown="onFabPointerDown"
|
||||
>
|
||||
<div class="fab-icon-wrap">
|
||||
<Icon v-if="!pageLoading" icon="ep:chat-dot-round" class="fab-icon" />
|
||||
<Icon v-else icon="ep:loading" class="fab-icon fab-loading" />
|
||||
</div>
|
||||
<span class="fab-text">AI 决策助手</span>
|
||||
</div>
|
||||
<span class="fab-text">AI 决策助手</span>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<AiImageChatDialog
|
||||
v-model="dialogVisible"
|
||||
@@ -34,6 +36,7 @@ import {
|
||||
} from './useAiAssistant'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { routeShouldShowAiAssistantFab } from './aiFabRoute'
|
||||
|
||||
defineOptions({ name: 'AiAssistantProvider' })
|
||||
|
||||
@@ -212,6 +215,20 @@ function setAiAssistantFabEnabled(enabled: boolean) {
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
/** 依當前路由同步浮層(後台動態路由 name 常與組件 defineOptions 不一致,僅靠業務頁 setFab 易失效) */
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (isHideAssistantFabPath(route.path)) {
|
||||
fabEnabled.value = false
|
||||
return
|
||||
}
|
||||
fabEnabled.value = routeShouldShowAiAssistantFab(route)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const showAssistantFab = computed(
|
||||
() => !isHideAssistantFabPath(route.path) && fabEnabled.value
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user