Browse Source

添加0人可以上课

lex 1 year ago
parent
commit
c05cf91090

+ 6 - 5
src/components/layout/layoutTop.tsx

@@ -92,13 +92,13 @@ export default defineComponent({
                   <div
                     class={styles.optons}
                     onClick={() => (showSuggestionViseble.value = true)}>
-                    <img src={opinionIcon}></img>
+                    <NImage src={opinionIcon} previewDisabled></NImage>
                   </div>
                 ),
                 default: '意见反馈'
               }}
             </NTooltip>
-
+            {/* </div> */}
             <div onClick={() => (showImGroup.value = true)}>
               <NBadge
                 value={noReadCount.value}
@@ -245,11 +245,12 @@ export default defineComponent({
           </NModal>
 
           <NModal
-            class={['modalTitle', 'background', styles.suggestWrap]}
-            style={{ width: '730px' }}
+            class={['modalTitle', 'background']}
+            style={{ width: '910px' }}
             v-model:show={showSuggestionViseble.value}
             preset="card"
-            showIcon={false}>
+            showIcon={false}
+            title="意见反馈">
             <SuggestionOption
               onClose={() =>
                 (showSuggestionViseble.value = false)

+ 12 - 5
src/views/attend-class/index.tsx

@@ -154,6 +154,7 @@ export default defineComponent({
       detailId: '' as any, // 编号 - 课程编号
       classGroupId: '' as any, // 上课时需要 班级编号
       classId: '' as any, // 上课编号
+      preStudentNum: '' as any, // 班上学生
       // detail: null,
       knowledgePointList: [] as any,
       itemList: [] as any,
@@ -281,6 +282,7 @@ export default defineComponent({
       data.lessonCourseId = props.lessonCourseId || query.lessonCourseId;
       data.classGroupId = props.classGroupId || query.classGroupId;
       data.classId = props.classId || query.classId;
+      data.preStudentNum = props.preStudentNum || query.preStudentNum;
 
       window.addEventListener('message', iframeHandle);
       getDetail();
@@ -1017,10 +1019,10 @@ export default defineComponent({
             clearTimeout(activeData.timer);
             activeData.model = !activeData.model;
             Object.values(data.videoRefs).map((n: any) =>
-              n.toggleHideControl(activeData.model)
+              n?.toggleHideControl(activeData.model)
             );
             Object.values(data.audioRefs).map((n: any) =>
-              n.toggleHideControl(activeData.model)
+              n?.toggleHideControl(activeData.model)
             );
           }}>
           <div
@@ -1068,10 +1070,10 @@ export default defineComponent({
                         activeData.timer = setTimeout(() => {
                           activeData.model = !activeData.model;
                           Object.values(data.videoRefs).map((n: any) =>
-                            n.toggleHideControl(activeData.model)
+                            n?.toggleHideControl(activeData.model)
                           );
                           Object.values(data.audioRefs).map((n: any) =>
-                            n.toggleHideControl(activeData.model)
+                            n?.toggleHideControl(activeData.model)
                           );
                           if (activeData.model) {
                             setModelOpen();
@@ -1199,8 +1201,13 @@ export default defineComponent({
             </div>
             {data.type !== 'preview' && (
               <div
-                class={styles.btnItem}
+                class={[
+                  styles.btnItem,
+                  data.preStudentNum <= 0 ? styles.btnsDisabled : ''
+                ]}
                 onClick={async () => {
+                  // 学生人数必须大于0,才可以布置作业
+                  if (data.preStudentNum <= 0) return;
                   const res = await lessonPreTrainingPage({
                     coursewareKnowledgeDetailId: data.detailId,
                     subjectId: data.subjectId,

+ 14 - 6
src/views/prepare-lessons/components/lesson-main/courseware/index.tsx

@@ -49,6 +49,7 @@ export default defineComponent({
     const forms = reactive({
       className: route.query.name as any,
       classGroupId: route.query.classGroupId,
+      preStudentNum: route.query.preStudentNum,
       // 选取参数带的,后取缓存
       subjectId: route.query.subjectId
         ? Number(route.query.subjectId)
@@ -247,11 +248,12 @@ export default defineComponent({
       }
     };
     const fscreen = () => {
-      const el = document.documentElement;
+      const el: any = document.documentElement;
+      const documentDom: any = document;
       const isFullscreen =
-        document.fullScreen ||
-        document.mozFullScreen ||
-        document.webkitIsFullScreen;
+        documentDom.fullScreen ||
+        documentDom.mozFullScreen ||
+        documentDom.webkitIsFullScreen;
       if (!isFullscreen) {
         //进入全屏
         (el.requestFullscreen && el.requestFullscreen()) ||
@@ -325,6 +327,7 @@ export default defineComponent({
       async () => {
         forms.className = route.query.name as any;
         forms.classGroupId = route.query.classGroupId as any;
+        forms.preStudentNum = route.query.preStudentNum as any;
         forms.subjectId = route.query.subjectId
           ? Number(route.query.subjectId)
           : null;
@@ -658,7 +661,8 @@ export default defineComponent({
                         subjectId: prepareStore.getSubjectId,
                         detailId: prepareStore.getSelectKey,
                         classId: res.data,
-                        lessonCourseId: prepareStore.getBaseCourseware.id
+                        lessonCourseId: prepareStore.getBaseCourseware.id,
+                        preStudentNum: forms.preStudentNum
                       };
                     } else {
                       const { href } = router.resolve({
@@ -669,7 +673,8 @@ export default defineComponent({
                           subjectId: prepareStore.getSubjectId,
                           detailId: prepareStore.getSelectKey,
                           classId: res.data,
-                          lessonCourseId: prepareStore.getBaseCourseware.id
+                          lessonCourseId: prepareStore.getBaseCourseware.id,
+                          preStudentNum: forms.preStudentNum
                         }
                       });
                       window.open(href, +new Date() + '');
@@ -720,6 +725,7 @@ export default defineComponent({
               if (forms.classGroupId) {
                 forms.className = item.name;
                 forms.classGroupId = item.classGroupId;
+                forms.preStudentNum = item.preStudentNum;
                 forms.subjectId = item.subjectId;
                 forms.showAttendClass = false;
 
@@ -746,6 +752,7 @@ export default defineComponent({
                     type: 'class',
                     classId: res.data, // 上课编号
                     classGroupId: item.classGroupId,
+                    preStudentNum: item.preStudentNum,
                     subjectId: prepareStore.getSubjectId,
                     detailId: prepareStore.getSelectKey,
                     lessonCourseId: prepareStore.getBaseCourseware.id
@@ -760,6 +767,7 @@ export default defineComponent({
                       type: 'class',
                       classId: res.data, // 上课编号
                       classGroupId: item.classGroupId,
+                      preStudentNum: item.preStudentNum,
                       subjectId: prepareStore.getSubjectId,
                       detailId: prepareStore.getSelectKey,
                       lessonCourseId: prepareStore.getBaseCourseware.id

+ 15 - 14
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') {
@@ -51,7 +51,7 @@ export default defineComponent({
               subjectId: item.subjectId,
               name: item.name, // 班级名称
               classGroupId: item.id, // 班级编号
-              preStudentNum:item.preStudentNum
+              preStudentNum: item.preStudentNum
             });
           } else {
             forms.showSubjectClass = true;
@@ -73,7 +73,7 @@ export default defineComponent({
           subjectId: prepareStore.getSubjectId,
           detailId: prepareStore.getSelectKey,
           lessonCourseId: prepareStore.getBaseCourseware.id,
-          preStudentNum:item.preStudentNum
+          preStudentNum: item.preStudentNum
         });
         if (window.matchMedia('(display-mode: standalone)').matches) {
           state.application = window.matchMedia(
@@ -88,11 +88,12 @@ export default defineComponent({
       }
     };
     const fscreen = () => {
-      const el = document.documentElement;
+      const el: any = document.documentElement;
+      const documentDom: any = document;
       const isFullscreen =
-        document.fullScreen ||
-        document.mozFullScreen ||
-        document.webkitIsFullScreen;
+        documentDom.fullScreen ||
+        documentDom.mozFullScreen ||
+        documentDom.webkitIsFullScreen;
       if (!isFullscreen) {
         //进入全屏
         (el.requestFullscreen && el.requestFullscreen()) ||
@@ -101,12 +102,12 @@ export default defineComponent({
           (el.msRequestFullscreen && el.msRequestFullscreen());
       } else {
         //退出全屏
-        document.exitFullscreen
-          ? document.exitFullscreen()
-          : document.mozCancelFullScreen
-          ? document.mozCancelFullScreen()
-          : document.webkitExitFullscreen
-          ? document.webkitExitFullscreen()
+        documentDom.exitFullscreen
+          ? documentDom.exitFullscreen()
+          : documentDom.mozCancelFullScreen
+          ? documentDom.mozCancelFullScreen()
+          : documentDom.webkitExitFullscreen
+          ? documentDom.webkitExitFullscreen()
           : '';
       }
     };
@@ -123,7 +124,7 @@ export default defineComponent({
         result.forEach((item: any) => {
           // 判断班级里面有学生的
           // if (item.preStudentNum > 0) {
-            temp.push(item);
+          temp.push(item);
           // }
         });
         list.value = temp;