types.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 全局配置常量
  2. export interface GlobalConfig {
  3. OSS_BASE_URL: string;
  4. APP_NAME: string;
  5. AGORA_APP_ID?: string;
  6. AGORA_PRIMARY_CERT?: string;
  7. AGORA_TOKEN?: string;
  8. AGORA_CHANNEL?: string;
  9. AGORA_KEY?: string;
  10. AGORA_SECRET?: string;
  11. AGORA_STT_JOIN_URL?: string;
  12. AGORA_STT_WS_URL?: string;
  13. }
  14. // 认证上下文类型
  15. export interface AuthContextType<T> {
  16. user: T | null;
  17. token: string | null;
  18. login: (username: string, password: string, latitude?: number, longitude?: number) => Promise<void>;
  19. logout: () => Promise<void>;
  20. isAuthenticated: boolean;
  21. isLoading: boolean;
  22. }
  23. // 启用/禁用状态枚举
  24. export enum EnableStatus {
  25. DISABLED = 0, // 禁用
  26. ENABLED = 1 // 启用
  27. }
  28. // 启用/禁用状态中文映射
  29. export const EnableStatusNameMap: Record<EnableStatus, string> = {
  30. [EnableStatus.DISABLED]: '禁用',
  31. [EnableStatus.ENABLED]: '启用'
  32. };
  33. // 删除状态枚举
  34. export enum DeleteStatus {
  35. NOT_DELETED = 0, // 未删除
  36. DELETED = 1 // 已删除
  37. }
  38. // 删除状态中文映射
  39. export const DeleteStatusNameMap: Record<DeleteStatus, string> = {
  40. [DeleteStatus.NOT_DELETED]: '未删除',
  41. [DeleteStatus.DELETED]: '已删除'
  42. };
  43. // 启用/禁用状态枚举
  44. export enum DisabledStatus {
  45. DISABLED = 1, // 禁用
  46. ENABLED = 0 // 启用
  47. }