Browse Source

添加保存上课声部

lex 1 năm trước cách đây
mục cha
commit
9408384189

+ 2 - 0
src/views/classList/index.tsx

@@ -272,12 +272,14 @@ export default defineComponent({
         // 判断是否有声部
         if (row.subjectId) {
           //
+          // 声部先取上次上课的声部,如果没有则取班级上面的声部
           router.push({
             path: '/prepare-lessons',
             query: {
               lastUseCoursewareId: row.lessonCoursewareId,
               unit: row.lessonCoursewareKnowledgeDetailId,
               subjectId: row.subjectId,
+              courseScheduleSubjectId: row.courseScheduleSubjectId,
               name: row.name, // 班级名称
               classGroupId: row.id // 班级编号
             }

+ 2 - 1
src/views/classList/modals/Gotoclass.tsx

@@ -58,7 +58,8 @@ export default defineComponent({
         if (data.rows && data.rows.length > 0) {
           const res = await courseScheduleStart({
             lessonCoursewareKnowledgeDetailId: forms.chapter,
-            classGroupId: props.activeRow.id
+            classGroupId: props.activeRow.id,
+            subjectId: forms.subjectId
           });
 
           emit('close');

+ 2 - 1
src/views/home/modals/chioseModal.tsx

@@ -55,7 +55,8 @@ export default defineComponent({
         if (data.rows && data.rows.length > 0) {
           const res = await courseScheduleStart({
             lessonCoursewareKnowledgeDetailId: forms.chapter,
-            classGroupId: forms.currentClass
+            classGroupId: forms.currentClass,
+            subjectId: forms.subjectId
           });
           emit('close');
           emit('preview', {

+ 16 - 5
src/views/prepare-lessons/components/lesson-main/courseware/index.tsx

@@ -50,6 +50,7 @@ export default defineComponent({
       className: route.query.name as any,
       classGroupId: route.query.classGroupId,
       preStudentNum: route.query.preStudentNum,
+      courseScheduleSubjectId: route.query.courseScheduleSubjectId,
       // 选取参数带的,后取缓存
       subjectId: route.query.subjectId
         ? Number(route.query.subjectId)
@@ -298,9 +299,16 @@ export default defineComponent({
         const localStorageSubjectId = localStorage.getItem(
           'prepareLessonSubjectId'
         );
+        // 先取 上次上课声部,在取班级声部 最后取缓存
         const subjectId =
-          forms.subjectId || localStorageSubjectId
-            ? Number(localStorageSubjectId)
+          forms.courseScheduleSubjectId ||
+          forms.subjectId ||
+          localStorageSubjectId
+            ? Number(
+                forms.courseScheduleSubjectId ||
+                  forms.subjectId ||
+                  localStorageSubjectId
+              )
             : null;
         // 判断浏览器上面是否有
         const index = subjectList.findIndex(
@@ -645,7 +653,8 @@ export default defineComponent({
                     // 开始上课
                     const res = await courseScheduleStart({
                       lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
-                      classGroupId: forms.classGroupId
+                      classGroupId: forms.classGroupId,
+                      subjectId: prepareStore.getSubjectId
                     });
                     if (
                       window.matchMedia('(display-mode: standalone)').matches
@@ -727,10 +736,11 @@ export default defineComponent({
                 forms.classGroupId = item.classGroupId;
                 forms.preStudentNum = item.preStudentNum;
                 forms.subjectId = item.subjectId;
+                forms.courseScheduleSubjectId = item.courseScheduleSubjectId;
                 forms.showAttendClass = false;
 
                 prepareStore.setClassGroupId(item.classGroupId);
-
+                console.log(forms, 'forms', item);
                 checkSubjectIds();
                 // 声部切换时
                 eventGlobal.emit('onChangeClass', {
@@ -740,7 +750,8 @@ export default defineComponent({
               } else {
                 const res = await courseScheduleStart({
                   lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
-                  classGroupId: item.classGroupId
+                  classGroupId: item.classGroupId,
+                  subjectId: prepareStore.getSubjectId
                 });
                 forms.showAttendClass = false;
                 if (window.matchMedia('(display-mode: standalone)').matches) {

+ 4 - 2
src/views/prepare-lessons/model/attend-class/index.tsx

@@ -40,7 +40,7 @@ export default defineComponent({
     const loading = ref(false);
     // 开始上课
     const onAttendClass = async (item: any) => {
-      console.log(item, 'onAttendClass');
+      // console.log(item, 'onAttendClass');
       try {
         // 判断是否是切换班级
         if (props.type == 'change') {
@@ -49,6 +49,7 @@ export default defineComponent({
               lastUseCoursewareId: item.lessonCoursewareId,
               unit: item.lessonCoursewareKnowledgeDetailId,
               subjectId: item.subjectId,
+              courseScheduleSubjectId: item.courseScheduleSubjectId,
               name: item.name, // 班级名称
               classGroupId: item.id, // 班级编号
               preStudentNum: item.preStudentNum
@@ -62,7 +63,8 @@ export default defineComponent({
 
         const res = await courseScheduleStart({
           lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
-          classGroupId: item.id
+          classGroupId: item.id,
+          subjectId: prepareStore.getSubjectId
         });
 
         emit('close');

+ 2 - 2
vite.config.ts

@@ -23,8 +23,8 @@ function resolve(dir: string) {
 }
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
-// const proxyUrl = 'https://dev.kt.colexiu.com/';
-const proxyUrl = 'https://test.lexiaoya.cn';
+const proxyUrl = 'https://dev.kt.colexiu.com/';
+// const proxyUrl = 'https://test.lexiaoya.cn';
 export default defineConfig({
   base: './',
   plugins: [