prepareLessons.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import { defineStore } from 'pinia';
  2. import { store } from '@/store';
  3. export const usePrepareStore = defineStore('prepare-lessons-store', {
  4. state: () => ({
  5. subjectId: null as any, // 基础声部
  6. baseCourseware: {} as any, // 基础教学课件
  7. selectKey: '', // 选的哪一节课
  8. lessonCoursewareId: '', // 哪个教材分类
  9. subjectList: [] as any, // 教材带的声部列表
  10. lessonCoursewareDetailId: '', // 哪个教材详情
  11. treeList: [] as any[], // 左边教学课件列表
  12. coursewareList: [] as any[], // 课件信息
  13. trainList: [] as any[], // 训练信息
  14. tabType: 'courseware', // 备课 - 课件 | 训练 类型切换 'courseware' | 'train'
  15. selectMusicStatus: false, // 乐谱状态
  16. selectResourceStatus: false, // 资源状态
  17. isAddResource: false, // 是否添加资源
  18. isEditResource: false, // 是否编辑资源
  19. iseditTrain: false, // 是否编辑训练,
  20. isAddTrain: false, // 是否添加训练,
  21. classGroupId: null as any // 班级编号
  22. }),
  23. getters: {
  24. /** 获取资源状态 */
  25. getSubjectId(): [string, number] {
  26. return this.subjectId;
  27. },
  28. /** 获取基础教学课件 */
  29. getBaseCourseware(): any {
  30. return this.baseCourseware;
  31. },
  32. /** 获取选择课的编号 */
  33. getSelectKey(): string {
  34. return this.selectKey;
  35. },
  36. /** 获取教材编号 */
  37. getLessonCoursewareId(): string {
  38. return this.lessonCoursewareId;
  39. },
  40. /** 获取分类编号 */
  41. getLessonCoursewareDetailId(): string {
  42. return this.lessonCoursewareDetailId;
  43. },
  44. /** 获取树形控件 */
  45. getTreeList(): any[] {
  46. return this.treeList;
  47. },
  48. /** 获取课件列表 */
  49. getCoursewareList(): any[] {
  50. return this.coursewareList;
  51. },
  52. /** 获取训练列表 */
  53. getTrainList(): any[] {
  54. return this.trainList;
  55. },
  56. /** 获取课件类型 */
  57. getTabType(): string {
  58. return this.tabType;
  59. },
  60. /** 获取乐谱状态 */
  61. getSelectMusicStatus(): boolean {
  62. return this.selectMusicStatus;
  63. },
  64. /** 获取资源状态 */
  65. getSelectResourceStatus(): boolean {
  66. return this.selectResourceStatus;
  67. },
  68. /** 获取是否添加资源 */
  69. getIsAddResource(): boolean {
  70. return this.isAddResource;
  71. },
  72. /** 获取是否修改资源 */
  73. getIsEditResource(): boolean {
  74. return this.isEditResource;
  75. },
  76. /** 获取是否修改训练 */
  77. getIsEditTrain(): boolean {
  78. return this.iseditTrain;
  79. },
  80. /** 获取是否添加训练 */
  81. getIsAddTrain(): boolean {
  82. return this.isAddTrain;
  83. },
  84. /** 获取声部列表 */
  85. getSubjectList(): any {
  86. return this.subjectList;
  87. },
  88. /** 获取班级编号 */
  89. getClassGroupId(): string | number {
  90. return this.classGroupId;
  91. }
  92. },
  93. actions: {
  94. /** 设置基础声部 */
  95. setSubjectId(subjectId: string | number) {
  96. this.subjectId = subjectId;
  97. },
  98. /** 设置基础教学课件 */
  99. setBaseCourseware(baseCourseware: any) {
  100. this.baseCourseware = baseCourseware;
  101. },
  102. /** 设置课的编号 */
  103. setSelectKey(key: string) {
  104. this.selectKey = key;
  105. },
  106. /** 设置教材的编号 */
  107. setLessonCoursewareId(id: string) {
  108. this.lessonCoursewareId = id;
  109. },
  110. /** 设置分类的编号 */
  111. setLessonCoursewareDetailId(id: string) {
  112. this.lessonCoursewareDetailId = id;
  113. },
  114. /** 设置课的编号 */
  115. setTreeList(list: any[]) {
  116. this.treeList = list;
  117. },
  118. /** 设置课件列表 */
  119. setCoursewareList(list: any[]) {
  120. this.coursewareList = list;
  121. },
  122. /** 设置训练列表 */
  123. setTrainList(list: any[]) {
  124. this.trainList = list;
  125. },
  126. /** 设置tab类型 */
  127. setTabType(type: string) {
  128. this.tabType = type;
  129. },
  130. /** 设置乐谱状态 */
  131. setSelectMusicStatus(status: boolean) {
  132. this.selectMusicStatus = status;
  133. },
  134. /** 设置资源状态 */
  135. setSelectResourceStatus(status: boolean) {
  136. this.selectResourceStatus = status;
  137. },
  138. /** 设置资源状态 */
  139. setIsAddResource(status: boolean) {
  140. this.isAddResource = status;
  141. },
  142. /** 设置训练状态 */
  143. setIsAddTrain(status: boolean) {
  144. this.isAddTrain = status;
  145. },
  146. /** 设置资源状态 */
  147. setIsEditResource(status: boolean) {
  148. this.isEditResource = status;
  149. },
  150. /** 设置训练状态 */
  151. setIsEditTrain(status: boolean) {
  152. this.iseditTrain = status;
  153. },
  154. /** 设置声部列表 */
  155. setSubjectList(subjects: any): any {
  156. this.subjectList = subjects;
  157. },
  158. /** 设置班级编号 */
  159. setClassGroupId(id: string | number): any {
  160. this.classGroupId = id;
  161. }
  162. }
  163. });
  164. // Need to be used outside the setup
  165. export function usePrepareLessonsStoreWidthOut() {
  166. return usePrepareStore(store);
  167. }