diff --git a/sun_badge_menu/static/src/scss/badge.scss b/sun_badge_menu/static/src/scss/badge.scss new file mode 100644 index 000000000..4e791562b --- /dev/null +++ b/sun_badge_menu/static/src/scss/badge.scss @@ -0,0 +1,29 @@ +/* sun_badge_menu — 菜单角标样式 */ +/* 此模块在菜单名称后注入 .menu-badge 元素,需此文件提供定位样式 */ + +/* 菜单项容器相对定位,供角标绝对定位参照 */ +.o_app_menu_item, +.o_navbar_apps_menu_item, +.show_dropdown_menu .dropdown-item { + position: relative; +} + +/* 角标基础样式 */ +.menu-badge { + position: absolute; + top: 2px; + right: 4px; + min-width: 18px; + height: 18px; + padding: 0 5px; + border-radius: 9px; + background: #dc3545; + color: #fff; + font-size: 11px; + font-weight: 600; + line-height: 18px; + text-align: center; + pointer-events: none; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); + z-index: 1; +} diff --git a/yuthon_ai_agent/static/src/js/ai_chat_open.js b/yuthon_ai_agent/static/src/js/ai_chat_open.js new file mode 100644 index 000000000..c442c130d --- /dev/null +++ b/yuthon_ai_agent/static/src/js/ai_chat_open.js @@ -0,0 +1,25 @@ +/** @odoo-module **/ + +import { Component } from "@odoo/owl"; +import { registry } from "@web/core/registry"; + +/** + * Client Action: 打开浮动 AI 聊天框 + * + * 由 ai.rule 的 action_test_guide() 按钮触发, + * 创建测试消息后返回此 action,自动弹出浮动聊天面板。 + */ +class AiChatOpen extends Component { + async setup() { + super.setup(); + // 派发自定义事件,通知浮动聊天模块打开并刷新 + // ai_floating.js 监听此事件 + window.dispatchEvent(new CustomEvent("yuthon:ai_open_chat", { + detail: { forceOpen: true }, + })); + } +} + +AiChatOpen.template = "yuthon_ai_agent.AiChatOpenTemplate"; + +registry.category("actions").add("yuthon_ai_chat_open", AiChatOpen);