mo 1 سال پیش
والد
کامیت
faf5ab3396

+ 11 - 8
src/custom-plugins/guide-page/courseware-detail.tsx

@@ -77,7 +77,7 @@ export default defineComponent({
   //   tipShow.value =true
   //  }
     const getStepELe = () => {
-      console.log(`coursewareDetail-${data.step}`)
+
       const ele: HTMLElement = document.getElementById(`coursewareDetail-${data.step}`)!;
       if (ele) {
         const eleRect = ele.getBoundingClientRect();
@@ -104,7 +104,8 @@ export default defineComponent({
     })
 
     const handleNext = () => {
-      if (data.step >= 2) {
+
+      if (data.step >= 0) {
        endGuide();
         return;
       }
@@ -113,9 +114,10 @@ export default defineComponent({
     };
 
     const endGuide = async()=>{
-      if(! tipShow.value){
-        return
-      }
+      // console.log(`handleNext-${data.step}`)
+      // if(!tipShow.value){
+      //   return
+      // }
       // let guideInfo = JSON.parse(localStorage.getItem('guideInfo')|| '{}') || null
       if(!guideInfo.value){
         guideInfo.value = {coursewareDetail:true}
@@ -132,8 +134,8 @@ export default defineComponent({
       tipShow.value = false
     //  localStorage.setItem('endC')
     }
-    return () => (
-      <Popup teleport="body" overlay={false} closeOnClickOverlay={false} class={["popup-custom", styles.guidePopup]} v-model:show={tipShow.value}>
+    return () => (<>
+      {tipShow.value?  <Popup teleport="body" overlay={false} closeOnClickOverlay={false} class={["popup-custom", styles.guidePopup]} v-model:show={tipShow.value}>
       <div class={styles.content} onClick={() => handleNext()}>
       {data.step!=data.steps.length-1&&<div
           class={styles.backBtn}
@@ -190,7 +192,8 @@ export default defineComponent({
           ))}
         </div>
       </div>
-      </Popup>
+      </Popup>:null}
+      </>
     );
   },
 });

+ 12 - 8
src/views/courseware-list/component/book/index.module.less

@@ -80,9 +80,7 @@
   }
   .name {
     width: 100%;
-    overflow: hidden;
-    white-space: nowrap;
-    text-overflow: ellipsis;
+
     display: flex;
     flex-direction: row;
     align-items: center;
@@ -159,9 +157,15 @@
   .wrapItem {
     padding-left: 20px;
   }
-  .preIcon {
-    width: 22px;
-    height: 13px;
-    margin-right: 5px;
-  }
+}
+.preIcon {
+  width: 22px;
+  height: 13px;
+  margin-right: 5px;
+}
+
+.nameText {
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
 }

+ 14 - 10
src/views/courseware-list/component/book/index.tsx

@@ -55,6 +55,7 @@ export default defineComponent({
     });
     const showGuide = ref(false);
     const isend = ref(false)
+    const step = ref(0)
     const CoursewareDetailRef = ref()
     const handleCreate = (key: string, url: string) => {
       return new Promise((resolve, reject) => {
@@ -127,14 +128,14 @@ export default defineComponent({
         // setTimeout(() => {
         // }, 1000);
 
+        // console.log(page - 1, 'page')
 
+        // const index = (page - 1)
+        // console.log(data.list[index * step.value], data.list)
 
-        setTimeout(() => {
+        nextTick(() => {
           showGuide.value = true;
-        }, 500)
-        // nextTick(() => {
-        //
-        // })
+        })
 
 
         // if (page + 1 === book.turn('pages')) {
@@ -201,6 +202,8 @@ export default defineComponent({
       }
     };
     const handleClose = (gotoOne = true) => {
+      showGuide.value = false
+      book.turn('disabled', false);
       if (isend.value) {
         return
       }
@@ -236,20 +239,19 @@ export default defineComponent({
     });
     const getList = () => {
       if (!props.bookData?.lessonList) return;
-      const step = Math.floor((document.body.clientHeight * 0.8 - 40) / 50);
-      console.log('🚀 ~ step:', step);
+      step.value = Math.floor((document.body.clientHeight * 0.8 - 40) / 50);
       const list = [];
       let listItem = [] as any[];
       for (let i = 0; i < props.bookData.lessonList.length; i++) {
         const item = props.bookData.lessonList[i];
-        if (listItem.length >= step) {
+        if (listItem.length >= step.value) {
           list.push([...listItem]);
           listItem = [{ name: item.name }];
         } else {
           listItem.push({ name: item.name });
         }
         for (let j = 0; j < item.knowledgeList.length; j++) {
-          if (listItem.length >= step) {
+          if (listItem.length >= step.value) {
             list.push([...listItem]);
             listItem = [item.knowledgeList[j]];
           } else {
@@ -331,6 +333,7 @@ export default defineComponent({
         console.log('changeShowGuide禁用')
         book.turn('disabled', true);
       } else {
+
         console.log('changeShowGuide取消禁用')
         book.turn('disabled', false);
       }
@@ -388,7 +391,8 @@ export default defineComponent({
                                   {data.lastTime === item.id && (
                                     <img src={pre} alt="" class={styles.preIcon} />
                                   )}
-                                  {item.name}
+                                  <div class={styles.nameText}> {item.name}</div>
+
                                   {/* <TheNoticeBar text={item.name} isAnimation={isStartAnimate(item)}></TheNoticeBar> */}
 
                                 </div>