Ver Fonte

Merge branch 'feature-3.8' of http://git.dayaedu.com/liushengqiang/classroom-app into feature-3.8

lex há 1 ano atrás
pai
commit
99ba39a4e9

+ 1 - 1
src/views/courseware-play/component/chapter.tsx

@@ -26,7 +26,7 @@ export default defineComponent({
   emits: ['handleSelect'],
   setup(props, { emit }) {
     const { detail, itemActive, active } = toRefs(props);
-    console.log(6666,itemActive.value,active.value,detail.value)
+    // console.log(6666,itemActive.value,active.value,detail.value)
     const pointData = reactive({
       active: active.value,
       coursewareList: [],

+ 15 - 2
src/views/courseware-play/component/points.tsx

@@ -1,4 +1,4 @@
-import { PropType, defineComponent, reactive, watch } from 'vue';
+import { PropType, defineComponent, reactive, watch, onMounted } from 'vue';
 import styles from './point.module.less';
 import iconMulv from '../image/icon-mulv.svg';
 import iconZhibo from '../image/icon-load.gif';
@@ -28,6 +28,10 @@ export default defineComponent({
       type: String,
       default: ''
     },
+    popShow: {
+      type: Boolean,
+      default: false
+    },
     data: {
       type: Array as PropType<any[]>,
       default: () => []
@@ -80,7 +84,16 @@ export default defineComponent({
     watch(
       () => props.allList,
       () => {
-        //console.log('改变了333',props.allList, pointData.allList)
+        pointData.kjId = props.kjId
+        pointData.zsdId = props.zsdId
+      }
+    );
+    watch(
+      () => props.popShow,
+      () => {
+        console.log('刷新123')
+        pointData.kjId = props.kjId
+        pointData.zsdId = props.zsdId
       }
     );
     return () => (

+ 35 - 32
src/views/courseware-play/index.tsx

@@ -244,19 +244,24 @@ export default defineComponent({
           };
         });
       }
+      // 当前章节下的所有资源列表
+      let allResource: any = [];
       data.allList.forEach((item: any) => {
         item.knowledgeList.forEach((material: any) => {
           material.materialInfo.forEach((resource: any) => {
+            resource.zsdId = material.id // 知识点id
+            resource.kjId = item.id // 课件id
             resource.url = resource.type === 'SONG'
             ? 'https://oss.dayaedu.com/ktqy/1698420034679a22d3f7a.png'
             : resource.type === 'PPT'
             ? 'https://oss.dayaedu.com/ktqy/12/1701931810284.png'
             : resource.coverImg
           })
+          allResource = allResource.concat(material.materialInfo)
         })
       })
-      console.log('资源1',data.allList)
-      data.itemList = data.knowledgePointList.map((m: any, index: number) => {
+
+      data.itemList = allResource.map((m: any, index: number) => {
         if (!popupData.itemActive) {
           popupData.itemActive = m.id;
           popupData.itemName = m.name;
@@ -270,7 +275,7 @@ export default defineComponent({
           isRender: false // 是否渲染了
         };
       });
-
+      console.log('资源',data.allList,data.itemList)
       setTimeout(() => {
         data.animationState = 'end';
       }, 500);
@@ -323,34 +328,23 @@ export default defineComponent({
     // 切换素材
     const toggleMaterial = (itemActive: any, zsdId: any, kjId: any) => {
       // 如果切换了知识点或者切换了课件,需要加载新的
-      if (zsdId !== data.zsdId || kjId !== data.kjId) {
-        data.zsdId = zsdId
-        data.kjId = kjId
-        let target = { materialInfo: [] }
-        // 如果是切换了知识点id
-        const kjIndex = data.allList.findIndex((item: any) => item.id === kjId)
-        target = data.allList[kjIndex].knowledgeList.find((item: any) => item.id === zsdId)
-        data.itemList = target?.materialInfo.map((m: any, index: number) => {
-          if (!popupData.itemActive) {
-            popupData.itemActive = m.id;
-            popupData.itemName = m.name;
-          }
-          return {
-            ...m,
-            iframeRef: null,
-            videoEle: null,
-            autoPlay: false, //加载完成是否自动播放
-            isprepare: false, // 视频是否加载完成
-            isRender: false // 是否渲染了
-          };
-        });
-      } else {
-        const index = data.itemList.findIndex((n: any) => n.id == itemActive);
-        if (index > -1) {
-          handleSwipeChange(index);
-        }
+      // if (zsdId !== data.zsdId || kjId !== data.kjId) {
+      //   data.zsdId = zsdId
+      //   data.kjId = kjId
+      //   let target = { materialInfo: [] }
+      //   // 如果是切换了知识点id
+      //   const kjIndex = data.allList.findIndex((item: any) => item.id === kjId)
+      //   target = data.allList[kjIndex].knowledgeList.find((item: any) => item.id === zsdId)
+      // } else {
+      //   const index = data.itemList.findIndex((n: any) => n.id == itemActive);
+      //   if (index > -1) {
+      //     handleSwipeChange(index);
+      //   }
+      // }
+      const index = data.itemList.findIndex((n: any) => n.id == itemActive);
+      if (index > -1) {
+        handleSwipeChange(index);
       }
-
     };
     /** 延迟收起模态框 */
     const setModelOpen = () => {
@@ -450,6 +444,8 @@ export default defineComponent({
       clearTimeout(acitveTimer.value);
       activeData.model = true;
       const item = data.itemList[index];
+      data.kjId = item.kjId;
+      data.zsdId = item.zsdId;
       popupData.activeIndex = index;
       popupData.itemActive = item.id;
       popupData.itemName = item.name;
@@ -467,6 +463,7 @@ export default defineComponent({
 
     // 上一个知识点, 下一个知识点
     const handlePreAndNext = async (type: string) => {
+      // 层级关系:单元〉章节〉知识点〉课件资源
       if (type === 'up') {
         // 判断上面是否还有章节
         if (popupData.activeIndex > 0) {
@@ -575,11 +572,13 @@ export default defineComponent({
           return;
         }
 
-        // 获取当前是哪个章节
+        // 获取当前是哪个单元
         let detailIndex = data.courseDetails.findIndex(
           (item: any) => item.id == activeData.lessonCoursewareDetailId
         );
+        // 当前章节列表  
         const detailItem = data.courseDetails[detailIndex]?.knowledgeList || [];
+        // 获取当前是哪个章节
         let lessonIndex = detailItem.findIndex(
           (item: any) => item.id == activeData.coursewareDetailKnowledgeId
         );
@@ -1016,7 +1015,10 @@ export default defineComponent({
 
                     {/* 新增:RHYTHM:节奏练习,THEORY:乐理知识,MUSIC_WIKI:名曲鉴赏 INSTRUMENT:乐器 MUSICIAN:音乐家 资源类型 */}
                     {m.type === 'RHYTHM' && 
-                      <TempoPractice dataJson={m?.dataJson ? JSON.parse(m?.dataJson) : {}} />
+                      <TempoPractice 
+                        dataJson={m?.dataJson ? JSON.parse(m?.dataJson) : {}} 
+                        modeType={'courseware'}
+                      />
                     }
                     {m.type === 'THEORY' && (
                       <Theory id={m.bizId} />
@@ -1126,6 +1128,7 @@ export default defineComponent({
             itemName={popupData.itemPointName}
             kjId={data.kjId}
             zsdId={data.zsdId}
+            popShow={popupData.open}
             onHandleSelect={(res: any) => {
               popupData.open = false;
               toggleMaterial(res.itemActive, res.zsdId, res.kjId);

+ 23 - 15
src/views/tempo-practice/index.tsx

@@ -33,6 +33,10 @@ export default defineComponent({
     dataJson: {
       type: Object,
       default: () => {}
+    },
+    modeType: {
+      type: String,
+      default: ''
     }
   },
   setup(props) {
@@ -179,24 +183,28 @@ export default defineComponent({
           state.win === 'modal' ? styles.modal : ''
         ]}>
         <div class={styles.head}>
-          <div
-            class={[styles.back, styles.iconBack]}
-            onClick={goback}
-            style={{ cursor: 'pointer' }}>
-            <img src={icon_back} />
-          </div>
+          {props.modeType !== 'courseware' && (
+            <div
+              class={[styles.back, styles.iconBack]}
+              onClick={goback}
+              style={{ cursor: 'pointer' }}>
+              <img src={icon_back} />
+            </div>
+          )}
           <div class={styles.title}>
             <img src={icon_title} />
           </div>
-          <div
-            class={styles.back}
-            style={{ cursor: 'pointer' }}
-            onClick={() => {
-              handleStop();
-              state.settingStatus = true;
-            }}>
-            <img src={icon_setting} />
-          </div>
+          {props.modeType !== 'courseware' && (
+            <div
+              class={styles.back}
+              style={{ cursor: 'pointer' }}
+              onClick={() => {
+                handleStop();
+                state.settingStatus = true;
+              }}>
+              <img src={icon_setting} />
+            </div>
+          )}
         </div>
 
         <div class={styles.conCon}>