Browse Source

Merge branch 'iteration-class'

lex 1 year ago
parent
commit
d9e566dfde

+ 2 - 3
src/views/classList/modals/updateSubject.tsx

@@ -45,11 +45,11 @@ export default defineComponent({
       createClassForm.id = props.activeRow.id;
     });
     const submitForms = () => {
-      data.uploading = true;
       foemsRef.value.validate(async (error: any) => {
         if (error) {
           return;
         }
+        data.uploading = true;
         try {
           await resetClass({ ...createClassForm });
           message.success('修改成功');
@@ -62,11 +62,10 @@ export default defineComponent({
             classGroupId: props.activeRow.id // 班级编号
           });
           emit('getList');
-          data.uploading = false;
         } catch (e) {
-          data.uploading = false;
           console.log(e);
         }
+        data.uploading = false;
       });
     };
     return () => (

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

@@ -47,7 +47,7 @@ export default defineComponent({
       coursewareList: [] as any,
       loadingStatus: false,
       showAttendClass: false,
-      attendClassType: 'select', //
+      attendClassType: 'change', //
       removeIds: [] as any, // 临时删除的编号
       drag: false,
       isEdit: false, // 是否更新数据
@@ -503,7 +503,7 @@ export default defineComponent({
               </NButton>
               <NButton
                 {...{ id: 'lessons-3' }}
-                type="primary"
+                type="error"
                 class={styles.btnClassStart}
                 onClick={async () => {
                   let count = 0;
@@ -555,7 +555,7 @@ export default defineComponent({
                     }
                   } else {
                     forms.showAttendClass = true;
-                    forms.attendClassType = 'select';
+                    forms.attendClassType = 'change';
                   }
                 }}>
                 开始上课
@@ -595,19 +595,55 @@ export default defineComponent({
                 window.open(href, +new Date() + '');
               }
             }}
-            onConfirm={(item: any) => {
-              console.log(item, 'confirm');
-              forms.className = item.name;
-              forms.classGroupId = item.classGroupId;
-              forms.subjectId = item.subjectId;
-              forms.showAttendClass = false;
-
-              checkSubjectIds();
-              // 声部切换时
-              eventGlobal.emit('onChangeClass', {
-                lastUseCoursewareId: item.lastUseCoursewareId,
-                unit: item.unit
-              });
+            onConfirm={async (item: any) => {
+              if (forms.classGroupId) {
+                forms.className = item.name;
+                forms.classGroupId = item.classGroupId;
+                forms.subjectId = item.subjectId;
+                forms.showAttendClass = false;
+
+                checkSubjectIds();
+                // 声部切换时
+                eventGlobal.emit('onChangeClass', {
+                  lastUseCoursewareId: item.lastUseCoursewareId,
+                  unit: item.unit
+                });
+              } else {
+                const res = await courseScheduleStart({
+                  lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
+                  classGroupId: item.classGroupId
+                });
+                if (window.matchMedia('(display-mode: standalone)').matches) {
+                  state.application = window.matchMedia(
+                    '(display-mode: standalone)'
+                  ).matches;
+                  forms.previewModal = true;
+                  forms.previewParams = {
+                    type: 'class',
+                    classId: res.data, // 上课编号
+                    classGroupId: item.id,
+                    subjectId: prepareStore.getSubjectId,
+                    detailId: prepareStore.getSelectKey,
+                    lessonCourseId: prepareStore.getBaseCourseware.id
+                  };
+                  setTimeout(() => {
+                    fscreen();
+                  }, 200);
+                } else {
+                  const { href } = router.resolve({
+                    path: '/attend-class',
+                    query: {
+                      type: 'class',
+                      classId: res.data, // 上课编号
+                      classGroupId: item.id,
+                      subjectId: prepareStore.getSubjectId,
+                      detailId: prepareStore.getSelectKey,
+                      lessonCourseId: prepareStore.getBaseCourseware.id
+                    }
+                  });
+                  window.open(href, +new Date() + '');
+                }
+              }
             }}
           />
         </NModal>

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

@@ -28,7 +28,6 @@ export default defineComponent({
   setup(props, { emit }) {
     // const { type } = toRef(props);
     const prepareStore = usePrepareStore();
-    const router = useRouter();
     const forms = reactive({
       showSubjectClass: false,
       activeRow: {} as any,
@@ -117,12 +116,14 @@ export default defineComponent({
           ...forms
         });
         const result = data.rows || [];
+        const temp: any = [];
         result.forEach((item: any) => {
           // 判断班级里面有学生的
           if (item.preStudentNum > 0) {
-            list.value.push(item);
+            temp.push(item);
           }
         });
+        list.value = temp;
       } catch {
         //
       }