exam.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import type { SocketMessage as BaseSocketMessage, SocketMessageType } from '@d8d-appcontainer/types';
  2. // 基础答题记录
  3. export interface AnswerRecord {
  4. date: string;
  5. price: string;
  6. holdingStock: string;
  7. holdingCash: string;
  8. profitAmount: number;
  9. profitPercent: number;
  10. index: number;
  11. }
  12. // 答题内容
  13. export interface QuizContent {
  14. date: string;
  15. price: number | string;
  16. holdingStock: string;
  17. holdingCash: string;
  18. userId: string;
  19. }
  20. // 题目状态
  21. export interface QuizState {
  22. date: string;
  23. price: number | string;
  24. }
  25. export type ExamSocketMessageType = SocketMessageType | 'question' | 'answer' | 'settlement' | 'submit' | 'restart';
  26. // Socket消息
  27. export interface ExamSocketMessage extends Omit<BaseSocketMessage, 'type' | 'content'> {
  28. type: ExamSocketMessageType;
  29. content: QuizContent;
  30. }
  31. // Socket房间消息
  32. export interface ExamSocketRoomMessage {
  33. roomId: string;
  34. message: ExamSocketMessage;
  35. }
  36. // 答案
  37. export interface Answer extends QuizContent {
  38. userId: string;
  39. profitAmount?: number;
  40. profitPercent?: number;
  41. totalProfitAmount?: number;
  42. totalProfitPercent?: number;
  43. }
  44. // 教室数据
  45. export interface ClassroomData {
  46. classroom_no: string;
  47. status: string;
  48. training_date: string;
  49. code: string;
  50. }
  51. // 累计结果
  52. export interface CumulativeResult {
  53. userId: string;
  54. totalProfitAmount: number;
  55. totalProfitPercent: number;
  56. }