Browse Source

Merge branch 'iteration-classroom' into iteration-classroom-listen

lex 1 year ago
parent
commit
1d9e1e773c

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1710320157028}
+{ "version": 1710320157028 }

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

@@ -228,14 +228,13 @@ export default defineComponent({
           const childList: any[] = [];
           row.chapterKnowledgeMaterialList.forEach((child: any) => {
             if (!child.removeFlag) {
-              const dataJson = child.dataJson ? JSON.parse(child.dataJson) : {};
               childList.push({
                 id: child.id,
                 materialId: child.bizId,
                 coverImg: child.bizInfo.coverImg,
                 type: child.type,
                 title: child.bizInfo.name,
-                dataJson: dataJson.setting ? dataJson.setting : {},
+                dataJson: child.dataJson,
                 isCollect: !!child.favoriteFlag,
                 isSelected: child.source === 'PLATFORM' ? true : false,
                 content: child.bizInfo.content,
@@ -1798,6 +1797,7 @@ export default defineComponent({
             onConfirm={async (val: any) => {
               popupData.chapterLoading = true;
               try {
+                data.selectClassStatus = false;
                 data.detailId = val.itemActive;
                 data.courseId = val.chapterId;
                 const ids = formatParentId(
@@ -1812,7 +1812,6 @@ export default defineComponent({
                 await getDetail();
                 popupData.activeIndex = 0;
                 popupData.chapterOpen = false;
-                data.selectClassStatus = false;
               } catch {
                 //
               }

+ 3 - 2
src/views/attend-class/model/source-list/index.module.less

@@ -32,7 +32,8 @@
   transition: height 1s ease-in-out;
 
   .cardContainer {
-    margin-bottom: 17px;
+    margin-bottom: 12px;
+    padding-top: 12px;
   }
 }
 
@@ -43,7 +44,7 @@
 .treeItem {
   display: flex;
   align-items: center;
-  line-height: 54px;
+  line-height: 36px;
   border-radius: 10px;
   padding: 0 5px;
   cursor: pointer;

+ 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);
       }
 

+ 23 - 18
src/views/prepare-lessons/components/lesson-main/courseware-presets/index.tsx

@@ -123,7 +123,7 @@ export default defineComponent({
         // 判断是否有选择对应的课件 或声部
         if (!prepareStore.getSelectKey) return (forms.openLoading = false);
         const { data } = await api_queryOpenCoursewareByPage({
-          subjectId: forms.subjectId,
+          subjectId: prepareStore.getSubjectId,
           coursewareDetailKnowledgeId: prepareStore.getSelectKey,
           page: 1,
           rows: 20
@@ -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>

+ 24 - 19
src/views/prepare-lessons/components/lesson-main/courseware/addCourseware.tsx

@@ -141,14 +141,13 @@ export default defineComponent({
           const childList: any[] = [];
           if (Array.isArray(child) && child.length > 0) {
             child.forEach((sub: any) => {
-              const dataJson = sub.dataJson ? JSON.parse(sub.dataJson) : {};
               childList.push({
                 id: sub.id,
                 materialId: sub.bizId,
                 coverImg: sub.bizInfo.coverImg,
                 type: sub.type,
                 title: sub.bizInfo.name,
-                dataJson: dataJson.setting || {},
+                dataJson: sub.dataJson,
                 // isCollect: !!sub.favoriteFlag,
                 isSelected: sub.source === 'PLATFORM' ? true : false,
                 content: sub.bizInfo.content,
@@ -424,11 +423,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 });
@@ -489,10 +487,15 @@ export default defineComponent({
       }
     };
     onMounted(async () => {
+      // 修改时重置默认数据
+      if (props.groupItem?.id) {
+        forms.coursewareList = [];
+        forms.baseCoursewareList = [];
+      }
+
       await getList();
       // 动态添加数据
       eventGlobal.on('onPrepareAddItem', addItem);
-
       eventGlobal.on('pageBeforeLeave', onPageBeforeLeave);
     });
 
@@ -823,20 +826,22 @@ export default defineComponent({
                 </div>
               ))}
 
-              <NButton
-                block
-                type="primary"
-                secondary
-                class={styles.addKnowledgePoint}
-                onClick={() => {
-                  forms.coursewareList.push({
-                    name: '',
-                    list: []
-                  });
-                }}>
-                <i class={styles.iconCAdd}></i>
-                添加知识点
-              </NButton>
+              {!forms.loadingStatus && (
+                <NButton
+                  block
+                  type="primary"
+                  secondary
+                  class={styles.addKnowledgePoint}
+                  onClick={() => {
+                    forms.coursewareList.push({
+                      name: '',
+                      list: []
+                    });
+                  }}>
+                  <i class={styles.iconCAdd}></i>
+                  添加知识点
+                </NButton>
+              )}
             </div>
           </NSpin>
         </NScrollbar>

+ 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('');

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

@@ -14,12 +14,19 @@
 
 
     .swipeControll {
-      height: 25Px;
+      height: 37px;
 
       .leftIcon {
         transform: rotate(180deg);
       }
 
+      :global {
+        .n-image {
+          height: 37px;
+          align-items: center;
+        }
+      }
+
       img {
         cursor: pointer;
         width: 25Px;

+ 2 - 3
src/views/prepare-lessons/model/source-instrument/detail.module.less

@@ -76,7 +76,7 @@
   position: relative;
   flex: 1;
   display: flex;
-  padding: 20px 55px 20px 20px;
+  padding: 20px 50px 20px 26px;
   overflow: hidden;
   gap: 0 32px;
 }
@@ -177,8 +177,7 @@
     display: flex;
     align-items: center;
     justify-content: center;
-    height: 50vh;
-    // height: 100%;
+    height: 40vh;
   }
 }
 

+ 1 - 2
src/views/prepare-lessons/model/source-knowledge/index.module.less

@@ -1,7 +1,7 @@
 .container {
   display: flex;
   flex-direction: column;
-  height: 650px;
+  height: 750px;
   background: #F1F5FF;
   border-radius: 0 0 12Px 12Px;
   padding-left: 27px;
@@ -11,7 +11,6 @@
     height: 36px;
   }
 
-
   .separator {
     width: 9px;
     height: 15px;

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

@@ -14,12 +14,19 @@
 
 
     .swipeControll {
-      height: 25Px;
+      height: 37px;
 
       .leftIcon {
         transform: rotate(180deg);
       }
 
+      :global {
+        .n-image {
+          height: 37px;
+          align-items: center;
+        }
+      }
+
       img {
         cursor: pointer;
         width: 25Px;
@@ -143,7 +150,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
           ] || []
         );
       }

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

@@ -4,7 +4,7 @@
 
 
   .btnType {
-    gap: 0px 24px !important;
+    gap: 0px 10px !important;
     flex-wrap: nowrap !important;
 
     &>div {
@@ -14,12 +14,19 @@
 
 
     .swipeControll {
-      height: 25Px;
+      height: 37px;
 
       .leftIcon {
         transform: rotate(180deg);
       }
 
+      :global {
+        .n-image {
+          height: 37px;
+          align-items: center;
+        }
+      }
+
       img {
         cursor: pointer;
         width: 25Px;

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

@@ -47,8 +47,8 @@ export default defineComponent({
       item: {} as any
     });
 
-    const getList = async () => {
-      state.loading = true;
+    const getList = async (status = true) => {
+      if (status) state.loading = true;
       try {
         const { data } = await api_knowledgeWiki_page({
           ...state.pagination,
@@ -122,7 +122,7 @@ export default defineComponent({
               !state.loading
             ) {
               state.pagination.page = state.pagination.page + 1;
-              getList();
+              getList(false);
             }
           }}>
           <NSpin v-model:show={state.loading} style={{ 'min-height': '50vh' }}>
@@ -170,7 +170,7 @@ export default defineComponent({
               {!state.loading && state.tableList.length <= 0 && (
                 <TheEmpty
                   style={{ minHeight: '50vh' }}
-                  description="暂无乐器百科"
+                  description="暂无音乐家"
                 />
               )}
             </div>

+ 1 - 1
src/views/prepare-lessons/model/source-musician/components/list/search-group-resources.tsx

@@ -163,7 +163,7 @@ export default defineComponent({
           </NSpace>
           <TheSearch
             class={styles.inputSearch}
-            placeholder="请输入乐器关键词"
+            placeholder="请输入音乐家关键词"
             round
             onSearch={(val: string) => {
               forms.keyword = val;