Course.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import { IStudio } from "../auth/StudioName";
  2. import { IUser } from "../auth/User";
  3. import { IUserRequest, TRole } from "./Auth";
  4. export interface ICourseListApiResponse {
  5. article: string;
  6. title: string;
  7. level: string;
  8. children: number;
  9. }
  10. export interface ICourseDataRequest {
  11. id?: string; //课程ID
  12. title: string; //标题
  13. subtitle?: string; //副标题
  14. summary?: string; //副标题
  15. content?: string;
  16. cover?: string; //封面图片文件名
  17. teacher_id?: string; //UserID
  18. publicity: number; //类型-公开/内部
  19. anthology_id?: string; //文集ID
  20. channel_id?: string; //标准答案channel
  21. start_at?: string; //课程开始时间
  22. end_at?: string; //课程结束时间
  23. join: string;
  24. request_exp: string;
  25. }
  26. export type TCourseJoinMode = "invite" | "manual" | "open";
  27. export type TCourseExpRequest = "none" | "begin-end" | "daily";
  28. export interface ICourseDataResponse {
  29. id: string; //课程ID
  30. title: string; //标题
  31. subtitle: string; //副标题
  32. summary?: string; //副标题
  33. teacher?: IUser; //UserID
  34. course_count?: number; //课程数
  35. publicity: number; //类型-公开/内部
  36. anthology_id?: string; //文集ID
  37. anthology_title?: string; //文集标题
  38. anthology_owner?: IStudio; //文集拥有者
  39. channel_id: string; //标准答案ID
  40. channel_name?: string; //文集标题
  41. channel_owner?: IStudio; //文集拥有者
  42. start_at: string; //课程开始时间
  43. end_at: string; //课程结束时间
  44. content: string; //简介
  45. cover: string; //封面图片文件名
  46. cover_url?: string[]; //封面图片文件名
  47. member_count: number;
  48. join: TCourseJoinMode;
  49. request_exp: TCourseExpRequest;
  50. my_status: TCourseMemberStatus;
  51. count_progressing?: number;
  52. created_at: string; //创建时间
  53. updated_at: string; //修改时间
  54. }
  55. export interface ICourseResponse {
  56. ok: boolean;
  57. message: string;
  58. data: ICourseDataResponse;
  59. }
  60. export interface ICourseListResponse {
  61. ok: boolean;
  62. message: string;
  63. data: {
  64. rows: ICourseDataResponse[];
  65. count: number;
  66. };
  67. }
  68. export interface ICourseCreateRequest {
  69. title: string;
  70. lang: string;
  71. studio: string;
  72. }
  73. export interface IAnthologyCreateRequest {
  74. title: string;
  75. lang: string;
  76. studio: string;
  77. }
  78. export interface ICourseNumberResponse {
  79. ok: boolean;
  80. message: string;
  81. data: {
  82. create: number;
  83. teach: number;
  84. study: number;
  85. };
  86. }
  87. export type TCourseMemberStatus =
  88. | "normal" /*开放课程直接加入*/
  89. | "invited" /**管理员已经邀请学生加入 */
  90. | "sign_up" /**学生已经报名 管理员尚未审核 */
  91. | "accepted" /**已经接受 */
  92. | "rejected" /**已经拒绝 */
  93. | "left" /**学生自己退出 */
  94. | "blocked"; /**学生被管理员屏蔽 */
  95. export interface ICourseMemberData {
  96. id?: string;
  97. user_id: string;
  98. course_id: string;
  99. channel_id?: string;
  100. role?: string;
  101. operating?: "invite" | "sign_up";
  102. user?: IUserRequest;
  103. status?: TCourseMemberStatus;
  104. created_at?: string;
  105. updated_at?: string;
  106. }
  107. export interface ICourseMemberResponse {
  108. ok: boolean;
  109. message: string;
  110. data: ICourseMemberData;
  111. }
  112. export interface ICourseMemberListResponse {
  113. ok: boolean;
  114. message: string;
  115. data: {
  116. rows: ICourseMemberData[];
  117. role: TRole;
  118. count: number;
  119. };
  120. }
  121. export interface ICourseMemberDeleteResponse {
  122. ok: boolean;
  123. message: string;
  124. data: boolean;
  125. }
  126. export interface ICourseCurrUserResponse {
  127. ok: boolean;
  128. message: string;
  129. data: {
  130. role: string;
  131. channel_id: string;
  132. };
  133. }
  134. export interface IExerciseListData {
  135. user: IUser;
  136. wbw: number;
  137. translation: number;
  138. question: number;
  139. html: string;
  140. }
  141. export interface ICourseExerciseResponse {
  142. ok: boolean;
  143. message: string;
  144. data: {
  145. rows: IExerciseListData[];
  146. count: number;
  147. };
  148. }