Bläddra i källkod

feat(module): 新增 AI 文档识别功能

- 添加 AIDocumentView 组件和相关路由
- 实现 AI 文档识别页面的基本布局和功能
- 重构部分代码以支持新功能的集成
徐勤民 1 månad sedan
förälder
incheckning
f60d218218
1 ändrade filer med 19 tillägg och 3 borttagningar
  1. 19 3
      src/main/ets/view/SafeView.ets

+ 19 - 3
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