From f60d21821882924f4a8d3920ba576399cad7771b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Fri, 16 May 2025 15:36:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(module):=20=E6=96=B0=E5=A2=9E=20AI=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E8=AF=86=E5=88=AB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 AIDocumentView 组件和相关路由 - 实现 AI 文档识别页面的基本布局和功能 - 重构部分代码以支持新功能的集成 --- src/main/ets/view/SafeView.ets | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/ets/view/SafeView.ets b/src/main/ets/view/SafeView.ets index db845a5..ced175b 100644 --- a/src/main/ets/view/SafeView.ets +++ b/src/main/ets/view/SafeView.ets @@ -1,6 +1,6 @@ import { WindowHelper } from '../utils/WindowHelper'; import { inputMethod } from '@kit.IMEKit'; -import { GlobalContext } from '../ContextConfig'; +import { ToolsHelper } from '../utils/ToolsHelper'; export interface TitleBarBtn { text?: string | Resource; @@ -28,6 +28,8 @@ export struct SafeView { @Prop opacitys: number | Resource // 是否显示返回按钮 @Prop hideBack: boolean + // 物理返回按键是否需要双击触发 + @Prop doubleBack: boolean // 是否显示浅色返回按钮 @Prop lightBack: boolean // 是否显示导航栏 @@ -237,10 +239,24 @@ export struct SafeView { .backgroundColor(this.backgroundColorView ?? '#ffffff') .onBackPressed(() => { if (this.onBackEvent) { - this.onBackEvent() + if (this.doubleBack) { + const t = this.onBackEvent + ToolsHelper.doubleAndExit(() => { + t() + }) + } else { + this.onBackEvent() + } return true } else if (this.pageInfos) { - this.pageInfos.pop() + if (this.doubleBack) { + const t = this.pageInfos + ToolsHelper.doubleAndExit(() => { + t.pop() + }) + } else { + this.pageInfos.pop() + } return true } else { return false