人生啊人生 vor 1 Monat
Ursprung
Commit
f8b0eefd26
1 geänderte Dateien mit 31 neuen und 2 gelöschten Zeilen
  1. 31 2
      src/view/student/trainChapter/trainChapter.vue

+ 31 - 2
src/view/student/trainChapter/trainChapter.vue

@@ -49,7 +49,7 @@
                     <div class="menuList commonsScrollbarNew" >
 
                         <div class="menuListMain" v-for="(item, index) of state.chapterTree" :key="index" >
-                            <div class="menuListpParent" @click="menuClick($event, index)" >
+                            <div class="menuListpParent" @click="menuClickNew($event, index)" >
                                 <div class="menuListpParentLeft">
                                     <div class="logoMenu" ></div>
                                     <!-- <div class="logoTime" ></div> -->
@@ -61,7 +61,7 @@
                                 </div>
                             </div>
                             <div class="menuListpChildren"
-                            @click="menuClick($event, index, item_1.id)"
+                            @click="menuClickNew($event, index, item_1.id)"
                             v-if="item.children?.length > 0" v-for="(item_1, index_1) of item.children" :key="index_1" >
                                 <div class="menuListpChildrenKong" ></div>
                                 <div class="menuListpChildrenLeft" >
@@ -245,6 +245,35 @@ const menuClick = (evt: Event, step: number, nodeId?: string) => {
     }
     evt.stopPropagation();
 };
+
+/**
+ * 新的左侧菜单点击的逻辑
+ * @param evt 
+ * @param step 
+ * @param nodeId 
+ */
+const menuClickNew = (evt: Event, step: number, nodeId?: string) => {
+
+    console.log("menuClickNew ---", evt, step, nodeId)
+    
+    let chapterNum = step * 100,
+        node = 0;
+    if (nodeId) {
+        node = chapterQueue[step].findIndex((x) => x.id == nodeId);
+        if (node > -1) chapterNum += node;
+    }
+    if (chapterNum <= state.lastChapterNum) {
+        state.currentStep = step;
+        state.currentNode = node;
+        state.currentChapter = chapterQueue[step][node];
+    } else {
+        ElMessage({
+            message: '该章节还未完成学习,请先按顺序完成学习!',
+            type: 'warning',
+        });
+    }
+    
+};
 const hasReadClick = () => {
     state.hasRead = true;
     state.showCnt = true;