Przeglądaj źródła

课程树结构超出优化+动态显示移动端二维码+首页课程导航排列改造显示增多

Tang 2 lat temu
rodzic
commit
b39c5890da

+ 3 - 3
src/components/toolbar/index.vue

@@ -7,9 +7,9 @@
             style="text-align: center; font-weight: bold; color: #222"
             class="text"
           >
-            扫码进入小程序
+            扫码进入移动端
           </div>
-          <img style="width: 150px; height: 150px" :src="WEAPP_LOGO" alt="" />
+          <img style="width: 150px; height: 150px" :src="$tools.splitImgHost(mobile.mobileImage)" alt="" />
         </div>
         <div slot="reference">
           <img src="@/assets/qr.png" class="img" alt="" />
@@ -116,7 +116,7 @@ export default {
   data() {
     return {
       scrollTimer: null,
-      WEAPP_LOGO: require(process.env.WEAPP_LOGO),
+      // WEAPP_LOGO: require(process.env.WEAPP_LOGO),
     };
   },
   mounted() {

+ 1 - 0
src/mixin/index.js

@@ -141,6 +141,7 @@ export default {
         doQuestionIds: doQuestionIds.join(","),
         rightQuestionIds: rightQuestionIds.join(","),
         rightQuestionNum: rightQuestionIds.length,
+        rightRate:(rightQuestionIds.length / totalQuestionNum).toFixed(2),
         historyExamJson: JSON.stringify(data),
         questionIds: doWrongQuestionIds,
         totalQuestionNum,

+ 13 - 13
src/pages/course-detail/components/CourseTree.vue

@@ -107,7 +107,7 @@
                                   (isDay = false)
                                 )
                               }}</span
-                              >-
+                              > -
                               <span>{{
                                 $tools.timestampToTime(
                                   section.liveEndTime,
@@ -324,7 +324,7 @@
                                 (isDay = false)
                               )
                             }}</span
-                            >-
+                            > -
                             <span>{{
                               $tools.timestampToTime(
                                 section.liveEndTime,
@@ -476,7 +476,7 @@
                             (isDay = false)
                           )
                         }}</span
-                        >-
+                        > -
                         <span>{{
                           $tools.timestampToTime(
                             menu.liveEndTime,
@@ -628,13 +628,7 @@ export default {
         this.toPlay(sectionItem);
       }
       //生成唯一ID定位Start
-      document
-        .getElementsByClassName("lear-state")[0]
-        .setAttribute("id", "onlyGif");
-      var a = document.createElement("a");
-      a.setAttribute("href", `#onlyGif`);
-      document.body.appendChild(a);
-      a.click();
+      document.getElementsByClassName("lear-state")[0].scrollIntoView(true);
       //生成唯一ID定位End
     },
     activeFunc(courseId, index) {
@@ -770,6 +764,7 @@ export default {
             query.chapterId = chapterId;
             query.sectionId = sectionId;
             query.skipPort = undefined;
+            console.log("route",{ path: this.$route.path, query })
             this.$router.push({ path: this.$route.path, query });
           }
           this.allSectionList = res.data;
@@ -907,7 +902,6 @@ export default {
       if (!(await this.exceedLearnNum(section))) {
         return false;
       }
-
       section.type == 2
         ? this.toCourseExam(section, type, courseIndex)
         : this.toPlay(section);
@@ -1188,7 +1182,9 @@ export default {
     },
     isLastVideo() {
       try {
-        let { sectionId, chapterId, courseId } = this.sectionItem;
+        let sectionId = this.sectionItem.sectionId || this.sectionItem.menuId || 0
+        let chapterId = this.sectionItem.chapterId || 0
+        let courseId = this.sectionItem.courseId || 0
         let lastVideo = this.allSectionList.slice(-1)[0];
         return (
           sectionId == lastVideo.sectionId &&
@@ -1294,7 +1290,8 @@ export default {
           &__text {
             flex: 1;
             padding: 8px 8px 8px 12px;
-            height: 40px;
+            // height: 40px;
+            max-height: 70px;
             display: flex;
             flex-direction: column;
             justify-content: center;
@@ -1304,6 +1301,9 @@ export default {
             .el-icon-caret-bottom {
               color: #999;
             }
+            & > div > span  {
+              font-size: 12px!important;
+            }
           }
 
           .test-btn {

+ 40 - 19
src/pages/course-detail/index.vue

@@ -1238,21 +1238,26 @@ export default {
   watch: {
     takePhotoModal(val, oldVal) {
       if (val) {
-        this.takeSetInt = setTimeout(() => {
-          this.$confirm("检测拍照停留时间过长,刷新当前页面", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            showCancelButton: false,
-            closeOnClickModal: false,
-            closeOnPressEscape: false,
-            showClose: false,
-            type: "warning"
-          })
-            .then(() => {
-              this.$router.go(0);
+        if (this.sectionItem.learning != 1 && this.goodsData.erJianErZao) {
+          this.takeSetInt = setTimeout(() => {
+            if (this.isFullScreen()) {
+              this.exitFullscreen();
+            }
+            this.$confirm("检测拍照停留时间过长,刷新当前页面", "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              showCancelButton: false,
+              closeOnClickModal: false,
+              closeOnPressEscape: false,
+              showClose: false,
+              type: "warning"
             })
-            .catch(() => {});
-        }, 900000);
+              .then(() => {
+                this.$router.go(0);
+              })
+              .catch(() => {});
+          }, 900000);
+        }
       } else {
         clearTimeout(this.takeSetInt);
       }
@@ -1304,6 +1309,7 @@ export default {
     }
   },
   async mounted() {
+    console.log(this.$route.params);
     this.courseId = +this.$route.query.courseId || "";
     this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
     this.goodsId = this.$route.params.goodsId;
@@ -3100,7 +3106,7 @@ export default {
           showClose: false
         }
       ).then(() => {
-        this.$router.go(-1);
+        this.$router.back(-1);
       });
     },
     isVirtualCamera(stream) {
@@ -3387,6 +3393,17 @@ export default {
         }
       }
       if (option.sectionType == 1) {
+        let query = {
+          goodsId: this.goodsId,
+          courseId: this.courseId,
+          gradeId: this.gradeId,
+          orderGoodsId: this.orderGoodsId,
+          moduleId: option.moduleId || 0,
+          chapterId: option.chapterId || 0,
+          sectionId: option.sectionId || option.menuId || 0,
+          sectionType: 1
+        };
+        this.$router.replace({ path: this.$route.path, query });
         //提交保存观看历史
         if (this.playSectionId) {
           this.postStudyRecord(0, this.playSectionId);
@@ -3572,9 +3589,12 @@ export default {
 
         this.player.on("s2j_onVideoPause", () => {
           clearInterval(this.postTimer);
-          if (this.sectionItem.learning != 1) {
+          if (this.sectionItem.learning != 1 && this.goodsData.erJianErZao) {
             this.videoPause = setTimeout(() => {
               if (!this.takePhotoModal) {
+                if (this.isFullScreen()) {
+                  this.exitFullscreen();
+                }
                 this.confirmStatus = true;
                 this.$confirm("检测暂停时间过长,刷新当前页面", "提示", {
                   confirmButtonText: "确定",
@@ -3619,6 +3639,7 @@ export default {
             this.$refs["courseTree"][
               this.playTabIndex
             ].dialogPalyVisible = true;
+            clearTimeout(this.videoPause);
           }
 
           if (this.isFullScreen()) {
@@ -3686,9 +3707,7 @@ export default {
     },
 
     getPhotoLastRecord() {
-      if (this.goodsData.erJianErZao) {
-        return;
-      }
+      clearTimeout(this.videoPause);
       return new Promise(resolve => {
         let self = this;
         this.photoConfig = false;
@@ -3803,6 +3822,7 @@ export default {
         this.photoConfig = true;
         if (this.goodsData.erJianErZao) {
           this.photoList = this.randomConfig(totalVideoTime, duration);
+        console.log("拍摄时间组:(秒)",this.photoList)
           return;
         }
         //没有历史拍照间隔数据
@@ -3844,6 +3864,7 @@ export default {
               this.photoList.push(endTakeTime);
             }
           }
+        console.log("拍摄时间组:(秒)",this.photoList)
           this.postCoursePhotoRecord(true); //提交随机拍照时间数组
         }
         console.log(this.photoList, "随机拍照时间数组");

+ 44 - 5
src/pages/home/index.vue

@@ -182,6 +182,10 @@
                           ? "继教"
                           : item.educationName
                       }}
+                      <i
+                        class="el-icon-arrow-right"
+                        style="float: right;margin-right: 10px;"
+                      ></i>
                     </div>
                     <div class="text__desc">
                       <a
@@ -1334,10 +1338,10 @@ export default {
               length = length + str.length;
             });
 
-            if (length >= 17) {
-              this.$set(this.typeList[index], "list", rows.slice(0, 1));
+            if (length >= 7) {
+              this.$set(this.typeList[index], "list", rows.slice(0, 6));
             } else {
-              this.$set(this.typeList[index], "list", rows.slice(0, 2));
+              this.$set(this.typeList[index], "list", rows.slice(0, length));
             }
           } else {
             this.$set(this.typeList[index], "list", rows);
@@ -1970,10 +1974,37 @@ export default {
               position: relative;
               z-index: 22;
               padding-left: 16px;
+              height: 100%;
+              overflow-y: auto;
+              &::-webkit-scrollbar {
+                width: 5px;
+                height: 9px;
+              }
+
+              /*定义滚动条轨道 内阴影+圆角*/
+              &::-webkit-scrollbar-track {
+                background-color: inherit;
+                border: none;
+                /* margin: 6px; */
+                border-radius: 10px;
+                /* -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
+    background-color: #F5F5F5; */
+              }
 
+              /*定义滑块 内阴影+圆角*/
+              &::-webkit-scrollbar-thumb {
+                border-radius: 10px;
+                position: relative;
+                right: 2px;
+                /*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);*/
+                background-color: #c6c6cd;
+                width: 6px;
+              }
               li {
                 padding: 12px 0;
-                height: 80px;
+                min-height: 80px;
+                max-height: 200px;
+                // overflow-y: auto;
                 border-bottom: 1px solid rgba(255, 255, 255, 0.6);
                 display: flex;
 
@@ -1993,14 +2024,22 @@ export default {
                   }
 
                   &__desc {
+                    display: flex;
+                    align-items: center;
+                    flex-wrap: wrap;
                     margin-top: 16px;
 
                     .item {
+                      flex-shrink: 0;
                       font-size: 14px;
                       font-family: Microsoft YaHei;
                       font-weight: 400;
-                      color: #ffffff;
+                      color: rgba(225, 225, 225, 0.8);
                       margin-right: 30px;
+                      margin-bottom: 10px;
+                      &:hover {
+                        color: #fff;
+                      }
                     }
                   }
                 }

+ 10 - 7
src/pages/person-center/index.vue

@@ -19,13 +19,13 @@
             <div class="title">{{ userInfo && userInfo.realname }}</div>
             <div class="desc">你好</div>
           </div>
-          <div class="float_right_top">
-            <!-- <img src="@/assets/xcxqrcode.jpg" alt="" />
+          <div class="float_right_top" v-if="mobile.smallQrCodeShow">
+            <!-- <img src="@/assets/xcxqrcode.jpg" alt="" /> -->
             <div class="cla_s">
               <h2>手机刷题学习</h2>
               <h2 class="link_two">随时随地提升分数</h2>
-            </div> -->
-            <img  v-if="mobile.smallQrCodeShow" src="@/assets/ggFirst.png" alt="" />
+            </div>
+            <img :src="$tools.splitImgHost(mobile.mobileImage)" alt="" />
             
           </div>
         </div>
@@ -240,12 +240,14 @@ export default {
       .float_right_top {
         width: 456px;
         height: 138px;
+        display: flex;
+        align-items: center;
         & > img {
-          width: 100%;
-          height: 100%;
+          width: 100px;
+          height: 100px;
         }
         & > .cla_s {
-          margin: 0px 20px;
+          margin: 0px 20px 0px;
           display: inline-block;
           h2 {
             font-size: 22px;
@@ -253,6 +255,7 @@ export default {
           .link_two {
             text-indent: 3rem;
           }
+
         }
       }
     }

+ 15 - 11
src/router/index.js

@@ -640,8 +640,13 @@ const originalPush = Router.prototype.push
 Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch((err) => err)
 }
+const originalReplace = Router.prototype.replace
 
+Router.prototype.replace = function replace(location){
+return originalReplace.call(this , location).catch(err=>err)
+}
 router.beforeEach(async (to, from, next) => {
+  console.error("页面进入")
   if (!store.state.TENANT_NANE) {
     await store.dispatch('findTenantId')
   }
@@ -655,7 +660,6 @@ router.beforeEach(async (to, from, next) => {
       res.msg && (window.location.href = res.msg);
     });
   }
-  console.log(5)
   if (to.meta.content) {
     let head = document.getElementsByTagName('head');
     let meta = document.createElement('meta');
@@ -664,7 +668,6 @@ router.beforeEach(async (to, from, next) => {
     meta.content = to.meta.content;
     head[0].appendChild(meta)
   }
-
   if (to.meta.title) {
     document.title = store.state.header.companyName + to.meta.title;
   }
@@ -701,8 +704,7 @@ router.beforeEach(async (to, from, next) => {
         store.dispatch('getUserInfo')
         store.dispatch('getbusinessList')
       }
-
-      // //题库页面要检测是否需要锁定
+      //题库页面要检测是否需要锁定
       let isBankLock = bankAdmin.some(item => {
         return to.path.indexOf(item) != -1
       })
@@ -771,15 +773,15 @@ router.beforeEach(async (to, from, next) => {
           })
         }
       }
-
+      //课程页面要检测是否需要锁定
       let isCourseLock = courseAdmin.some(item => {
         return to.path.indexOf(item) != -1
       })
+      console.log(3, isCourseLock, canToCourse)
       if (isCourseLock) {
-
         //没有执行定时器,开启锁定
         if (!canToCourse) {
-
+          console.log("x1")
           request.goodsDetail(to.params.goodsId).then(res => {
             //继续教育锁定
             // if(res.data.educationName == '继续教育') {
@@ -798,7 +800,6 @@ router.beforeEach(async (to, from, next) => {
                 if (from.path == '/') {
                   next('/')
                 }
-
               }).catch(err => {
                 //可以学习,开启锁定
                 canToCourse = 1;
@@ -815,19 +816,20 @@ router.beforeEach(async (to, from, next) => {
 
                   })
                 }, 10000);
+                console.log("学习")
                 next()
               })
           })
-
-
           return;
+          console.log("继续跑")
         } else {
+          console.log("x2")
           //正在执行定时器,可以直接进入
           next()
         }
-
         return;
       } else {
+        console.log("x5")
         //非题库页面删除锁定
         let isLeaveCouese = courseAdmin.some(item => {
           return from.path.indexOf(item) != -1
@@ -845,12 +847,14 @@ router.beforeEach(async (to, from, next) => {
           })
         }
       }
+      console.log(4)
       if (!to.path.includes('/person-center/my-info')) {
         checkFunc()
       }
       console.log(11123)
       next()
     } else {
+      console.log(8)
       next()
     }