Browse Source

Merge branch 'iteration-classroom' into jenkins

lex 1 year ago
parent
commit
abcb58d273

+ 27 - 13
src/views/content-information/content-music/components/list/search-group-resources.tsx

@@ -2,6 +2,7 @@ import { PropType, computed, defineComponent, onMounted, reactive } from 'vue';
 import styles from './index.module.less';
 import { NButton, NForm, NFormItem, NPopselect, NSpace } from 'naive-ui';
 import TheSearch from '/src/components/TheSearch';
+import deepClone from '/src/helpers/deep-clone';
 export default defineComponent({
   name: 'search-group',
   props: {
@@ -45,24 +46,37 @@ export default defineComponent({
       const child = categoryChildList.find(
         (item: any) => item.id === forms.wikiCategoryId
       );
+
       if (child && child.childrenList.length) {
-        child.childrenList.forEach((child: any) => {
-          const i = child.childrenList;
+        const temps: any = [];
+        child.childrenList.forEach((c: any) => {
+          const i = c.childrenList;
+          const childTemp: any = [];
+          // const i = c.childrenList;
           if (i && i.length > 0) {
-            i.forEach((j: any) => {
-              j.label = j.name;
-              j.value = j.id;
-            });
-
-            i.unshift({
+            childTemp.push({
               label: '全部',
-              value: child.id,
-              name: child.name,
-              id: child.id
+              value: c.id,
+              name: c.name,
+              id: c.id
+            });
+            i.forEach((j: any) => {
+              // j.label = j.name;
+              // j.value = j.id;
+              childTemp.push({
+                label: j.name,
+                value: j.id,
+                name: j.name,
+                id: j.id
+              });
             });
           }
-        });
 
+          temps.push({
+            ...c,
+            childrenList: childTemp
+          });
+        });
         return (
           [
             {
@@ -72,7 +86,7 @@ export default defineComponent({
               name: '全部',
               childrenList: []
             },
-            ...child.childrenList
+            ...temps
           ] || []
         );
       }

+ 1 - 0
src/views/prepare-lessons/components/directory-main/index.tsx

@@ -164,6 +164,7 @@ export default defineComponent({
         const subjectId = item.subjectList[0].id
           ? Number(item.subjectList[0].id)
           : '';
+        sessionStorage.removeItem('prepareLessonCourseWareSubjectIsNull');
         prepareStore.setSubjectId(subjectId);
       }
 

+ 22 - 17
src/views/prepare-lessons/components/lesson-main/courseware-presets/index.tsx

@@ -173,20 +173,6 @@ export default defineComponent({
       }
     );
 
-    // 检测数据是否存在
-    // watch(
-    //   () => forms.tableList,
-    //   () => {
-    //     // fromChapterLessonCoursewareId;
-    //     forms.openTableList.forEach((item: any) => {
-    //       const index = forms.tableList.findIndex(
-    //         (i: any) => i.fromChapterLessonCoursewareId === item.id
-    //       );
-    //       item.isAdd = index !== -1 ? true : false;
-    //     });
-    //   }
-    // );
-
     watch(
       () => prepareStore.getSubjectList,
       () => {
@@ -199,6 +185,14 @@ export default defineComponent({
 
       // 并且没有声部时才会更新
       if (subjectList.length > 0) {
+        const prepareLessonCourseWareSubjectIsNull = sessionStorage.getItem(
+          'prepareLessonCourseWareSubjectIsNull'
+        );
+        if (prepareLessonCourseWareSubjectIsNull === 'true') {
+          prepareStore.setSubjectId('');
+          return;
+        }
+
         // 并且声部在列表中
         const localStorageSubjectId = localStorage.getItem(
           'prepareLessonSubjectId'
@@ -235,12 +229,13 @@ export default defineComponent({
             subjectId = Number(localStorageSubjectId);
           }
         }
+        // 判断是否选择为空
         if (subjectId && index >= 0) {
           prepareStore.setSubjectId(subjectId);
           // forms.subjectId = subjectId;
         } else {
           // 判断是否有缓存
-          prepareStore.setSubjectId(subjectList[0].id);
+          // prepareStore.setSubjectId(subjectList[0].id);
           // forms.subjectId = subjectList[0].id;
         }
 
@@ -436,6 +431,13 @@ export default defineComponent({
                 prepareStore.setSubjectId(val);
                 // 保存
                 forms.subjectId = val;
+
+                if (!val) {
+                  sessionStorage.setItem(
+                    'prepareLessonCourseWareSubjectIsNull',
+                    val ? false : true
+                  );
+                }
               }}
             />
             <NButton
@@ -443,7 +445,10 @@ export default defineComponent({
               type="primary"
               onClick={() => {
                 eventGlobal.emit('teacher-slideshow', true);
-                emit('change', { status: true, type: 'create' });
+                emit('change', {
+                  status: true,
+                  type: 'create'
+                });
               }}>
               <NImage
                 class={styles.addBtnIcon}
@@ -489,7 +494,7 @@ export default defineComponent({
                   </div>
                 ))}
                 {!forms.loading && forms.tableList.length <= 0 && (
-                  <TheEmpty class={styles.empty1} />
+                  <TheEmpty class={styles.empty1} description="暂无课件" />
                 )}
               </div>
             </NSpin>

+ 1 - 2
src/views/prepare-lessons/components/lesson-main/courseware/addCourseware.tsx

@@ -424,11 +424,10 @@ export default defineComponent({
             id: props.groupItem.id,
             ...params
           });
-          message.success('修改成功');
         } else {
           await api_teacherChapterLessonCoursewareAdd(params);
-          message.success('添加成功');
         }
+        message.success('保存成功');
 
         if (hasBack) {
           emit('change', { status: false });

+ 1 - 0
src/views/prepare-lessons/index.tsx

@@ -100,6 +100,7 @@ export default defineComponent({
       prepareStore.setIsAddTrain(false);
       prepareStore.setIsEditResource(false);
       prepareStore.setIsEditTrain(false);
+      sessionStorage.removeItem('prepareLessonCourseWareSubjectIsNull');
     });
     onUnmounted(() => {
       prepareStore.setSubjectId('');

+ 2 - 1
src/views/prepare-lessons/model/source-music/components/list/index.module.less

@@ -143,7 +143,8 @@
   flex-flow: row wrap;
   justify-content: flex-start;
   gap: 20px 0;
-  min-height: 232px;
+
+  // min-height: 232px;
   margin-left: -10px;
   margin-right: -10px;
 

+ 25 - 13
src/views/prepare-lessons/model/source-music/components/list/search-group-resources.tsx

@@ -66,23 +66,35 @@ export default defineComponent({
         (item: any) => item.id === forms.wikiCategoryId
       );
       if (child && child.childrenList.length) {
-        child.childrenList.forEach((child: any) => {
-          const i = child.childrenList;
+        const temps: any = [];
+        child.childrenList.forEach((c: any) => {
+          const i = c.childrenList;
+          const childTemp: any = [];
+          // const i = c.childrenList;
           if (i && i.length > 0) {
-            i.forEach((j: any) => {
-              j.label = j.name;
-              j.value = j.id;
-            });
-
-            i.unshift({
+            childTemp.push({
               label: '全部',
-              value: child.id,
-              name: child.name,
-              id: child.id
+              value: c.id,
+              name: c.name,
+              id: c.id
+            });
+            i.forEach((j: any) => {
+              // j.label = j.name;
+              // j.value = j.id;
+              childTemp.push({
+                label: j.name,
+                value: j.id,
+                name: j.name,
+                id: j.id
+              });
             });
           }
-        });
 
+          temps.push({
+            ...c,
+            childrenList: childTemp
+          });
+        });
         return (
           [
             {
@@ -92,7 +104,7 @@ export default defineComponent({
               name: '全部',
               childrenList: []
             },
-            ...child.childrenList
+            ...temps
           ] || []
         );
       }

+ 1 - 1
src/views/prepare-lessons/model/source-musician/components/list/index.tsx

@@ -170,7 +170,7 @@ export default defineComponent({
               {!state.loading && state.tableList.length <= 0 && (
                 <TheEmpty
                   style={{ minHeight: '50vh' }}
-                  description="暂无乐器百科"
+                  description="暂无音乐家"
                 />
               )}
             </div>