global.d.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue';
  2. declare global {
  3. // [perf-base-v1] 卡1/卡7: public/js/config.js 注入的全局配置(经典脚本顶层 const,为全局词法绑定,不在 window 上)
  4. const VUE_APP_URL: {
  5. baseUrl: string; // 后台地址
  6. webRtcUrl: string; // rtsp 服务器地址前缀
  7. wsUrl: string; // WebSocket 地址
  8. onlyOfficeUrl?: string; // OnlyOffice Document Server 反向代理前缀
  9. aiChatUrl?: string; // [perf-base-v1] 卡7: AI 会话服务反向代理前缀
  10. difyUrl?: string; // [perf-base-v1] 卡7: Dify 服务反向代理前缀
  11. difyApiKey?: string; // [perf-base-v1] 卡7: Dify 应用 Key(生产应由后端代理下发)
  12. };
  13. // [perf-base-v1] 卡1: OnlyOffice Documents API 全局(由 src/utils/onlyOffice.ts loadDocsApi 按需注入)
  14. const DocsAPI: {
  15. DocEditor: new (placeholderId: string, config?: Recordable<any>) => any;
  16. };
  17. const VENT_PARAM: {
  18. simulatedPassword: string;
  19. showReport: boolean;
  20. isoOpenSso: string;
  21. modalText: string;
  22. productionCrlPlatformUrl: string;
  23. safetyCrlPlatformUrl: string;
  24. gasControlMock: boolean;
  25. historyIsMultiple: boolean;
  26. is2DModel: boolean;
  27. };
  28. interface GlobalConfig {
  29. simulatedPassword: string;
  30. History_Type: string;
  31. pageType: string;
  32. showReport: boolean;
  33. is2DModel: boolean;
  34. }
  35. const __APP_INFO__: {
  36. pkg: {
  37. name: string;
  38. version: string;
  39. dependencies: Recordable<string>;
  40. devDependencies: Recordable<string>;
  41. };
  42. lastBuildTime: string;
  43. };
  44. // declare interface Window {
  45. // // Global vue app instance
  46. // __APP__: App<Element>;
  47. // }
  48. // vue
  49. declare type PropType<T> = VuePropType<T>;
  50. declare type VueNode = VNodeChild | JSX.Element;
  51. export type Writable<T> = {
  52. -readonly [P in keyof T]: T[P];
  53. };
  54. declare type Nullable<T> = T | null;
  55. declare type NonNullable<T> = T extends null | undefined ? never : T;
  56. declare type Recordable<T = any> = Record<string, T>;
  57. declare type ReadonlyRecordable<T = any> = {
  58. readonly [key: string]: T;
  59. };
  60. declare type Indexable<T = any> = {
  61. [key: string]: T;
  62. };
  63. declare type DeepPartial<T> = {
  64. [P in keyof T]?: DeepPartial<T[P]>;
  65. };
  66. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  67. declare type IntervalHandle = ReturnType<typeof setInterval>;
  68. declare interface ChangeEvent extends Event {
  69. target: HTMLInputElement;
  70. }
  71. declare interface WheelEvent {
  72. path?: EventTarget[];
  73. }
  74. interface ImportMetaEnv extends ViteEnv {
  75. __: unknown;
  76. }
  77. interface ImportMeta {
  78. readonly env: ImportMetaEnv;
  79. }
  80. declare interface ViteEnv {
  81. VITE_PORT: number;
  82. VITE_USE_MOCK: boolean;
  83. VITE_PUBLIC_PATH: string;
  84. VITE_PROXY: [string, string][];
  85. VITE_GLOB_APP_TITLE: string;
  86. VITE_GLOB_APP_SHORT_NAME: string;
  87. VITE_USE_CDN: boolean;
  88. VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
  89. VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
  90. VITE_GLOB_DOMAIN_URL: string;
  91. VITE_CACHE_CIPHER_KEY_CHAR_CODE: string;
  92. VITE_CACHE_CIPHER_IV_CHAR_CODE: string;
  93. VITE_LOGIN_CIPHER_KEY_CHAR_CODE: string;
  94. VITE_LOGIN_CIPHER_IV_CHAR_CODE: string;
  95. VITE_MOCK_LOGIN_USERNAME_CHAR_CODE: string;
  96. VITE_MOCK_LOGIN_PASSWORD_CHAR_CODE: string;
  97. VITE_SIGNATURE_SECRET_CHAR_CODE: string;
  98. PROD: boolean;
  99. }
  100. declare function parseInt(s: string | number, radix?: number): number;
  101. declare function parseFloat(string: string | number): number;
  102. namespace JSX {
  103. // tslint:disable no-empty-interface
  104. type Element = VNode;
  105. // tslint:disable no-empty-interface
  106. type ElementClass = ComponentRenderProxy;
  107. interface ElementAttributesProperty {
  108. $props: any;
  109. }
  110. interface IntrinsicElements {
  111. [elem: string]: any;
  112. }
  113. interface IntrinsicAttributes {
  114. [elem: string]: any;
  115. }
  116. }
  117. }
  118. declare module 'vue' {
  119. export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
  120. }