global.d.ts 4.0 KB

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