Bläddra i källkod

Merge branch 'dev' of http://120.79.166.78:19005/zhongzheng-edu/saas_pc into dev

Tang 3 år sedan
förälder
incheckning
ccdd6ad9d0

+ 9 - 3
src/components/header/index.vue

@@ -23,7 +23,7 @@
 
       <div class="userinfo" v-if="userInfo">
         <a class="msg" @click="go('/person-center/my-message')">
-          <i class="pi"></i>
+          <i class="pi" v-if="msgCount > 0"></i>
           <i class="el-icon-message-solid icon"></i>
         </a>
         <a
@@ -83,7 +83,7 @@
 </template>
 
 <script>
-import { mapGetters } from "vuex";
+import { mapGetters, mapMutations } from "vuex";
 export default {
   name: "Header",
   data() {
@@ -95,7 +95,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(["header", "userInfo"]),
+    ...mapGetters(["header", "userInfo", "msgCount"]),
     showNav: function () {
       return function (list) {
         var newList = [];
@@ -108,7 +108,13 @@ export default {
       };
     },
   },
+  mounted() {
+    if (this.$tools.isLogin()) {
+      this.getMsgCount();
+    }
+  },
   methods: {
+    ...mapMutations(["getMsgCount"]),
     go(path, query) {
       this.$router.push({
         path,

+ 128 - 94
src/pages/course-detail/index.vue

@@ -4314,29 +4314,50 @@ export default {
           return;
         }
 
-        //提交保存观看历史
-        if (this.playSectionId) {
-          this.postStudyRecord(0, this.playSectionId);
-        }
+        if (this.businessData.goodsLearningOrder == 2 && !section.isRebuild) {
+          //要按从头到尾顺序学习, 且不是重修课程
 
-        this.player &&
-          this.player.HTML5.video.removeEventListener(
-            "timeupdate",
-            this.timeEvent
-          );
-        //播放视频
-        this.showRecordStatus = false; //隐藏播放记录提示
-        this.sectionItem = section;
-        console.log(section, "section");
-        this.isPlayRebuild = section.rebuild;
-        this.moduleId = section.moduleId || 0;
-        this.chapterId = section.chapterId || 0;
-        this.playSectionId = section.sectionId || section.menuId;
-        // console.log(this.moduleId, this.chapterId, this.playSectionId);
-        await this.getPhotoLastRecord();
-        this.recordObj = await this.getRecordLast();
-        this.getNoteList();
-        this.initVideo(section);
+          let rows = await this.studyRecordMenuAllList();
+          if (!this.hasPreItem(rows, section)) {
+            //判断是否有上一节
+            let newRows = [];
+            for (let i = 0; i < rows.length; i++) {
+              let moduleTrue =
+                rows[i].moduleId == section.moduleId || rows[i].moduleId == 0;
+              let chapterTrue =
+                rows[i].chapterId == section.chapterId ||
+                rows[i].chapterId == 0;
+              let sectionTrue =
+                rows[i].sectionId == section.sectionId ||
+                rows[i].sectionId == section.menuId;
+              if (moduleTrue && chapterTrue && sectionTrue) {
+                break;
+              } else {
+                if (rows[i].sectionType != 2) {
+                  newRows.push(rows[i]);
+                }
+              }
+            }
+
+            let isAllLearn = newRows.every((item) => {
+              return item.studyStatus == 1;
+            });
+
+            if (isAllLearn) {
+              this.initVideo(section);
+            } else {
+              this.$message({
+                type: "warning",
+                message: "请按顺序学习视频课程",
+              });
+            }
+          } else {
+            //第一章第一节
+            this.initVideo(section);
+          }
+        } else {
+          this.initVideo(section);
+        }
       }
     },
 
@@ -4383,71 +4404,6 @@ export default {
       }
     },
     async initVideo(option) {
-      if (this.businessData.goodsLearningOrder == 2 && !option.isRebuild) {
-        //要按从头到尾顺序学习, 且不是重修课程
-
-        let rows = await this.studyRecordMenuAllList();
-        if (!this.hasPreItem(rows, option)) {
-          //判断是否有上一节
-          let newRows = [];
-          for (let i = 0; i < rows.length; i++) {
-            let moduleTrue =
-              rows[i].moduleId == option.moduleId || rows[i].moduleId == 0;
-            let chapterTrue =
-              rows[i].chapterId == option.chapterId || rows[i].chapterId == 0;
-            let sectionTrue =
-              rows[i].sectionId == option.sectionId ||
-              rows[i].sectionId == option.menuId;
-            if (moduleTrue && chapterTrue && sectionTrue) {
-              break;
-            } else {
-              if (rows[i].sectionType != 2) {
-                newRows.push(rows[i]);
-              }
-            }
-          }
-
-          let isAllLearn = newRows.every((item) => {
-            return item.studyStatus == 1;
-          });
-
-          if (isAllLearn) {
-            this.playVideo(option);
-          } else {
-            this.$message({
-              type: "warning",
-              message: "请按顺序学习视频课程",
-            });
-          }
-        } else {
-          //第一章第一节
-          this.playVideo(option);
-        }
-      } else {
-        this.playVideo(option);
-      }
-
-      return;
-    },
-    /**
-     * 判断是否是当前播放的节
-     */
-    isActive(section) {
-      let moduleId = section.moduleId || 0;
-      let chapterId = section.chapterId || 0;
-      let sectionId = section.sectionId || section.menuId;
-      if (
-        moduleId == this.moduleId &&
-        chapterId == this.chapterId &&
-        sectionId == this.playSectionId
-      ) {
-        return true;
-      } else {
-        return false;
-      }
-    },
-
-    async playVideo(option) {
       if (option.sectionType == 1 || option.sectionType == 3) {
         //录播
 
@@ -4481,13 +4437,8 @@ export default {
           // let oldSectionId = this.playSectionId;
           // uni.$emit("changeSection", oldSectionId);
         }
-        //设置播放的节ID
-        await this.clears();
-        this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
-        // uni.$emit("levelId", this.levelId);
-        // uni.$emit("getSection", this.menuItem);
-        // uni.$emit("isRebuild", this.isRebuild);
+
+        this.playVideo(option);
       }
       if (option.sectionType == 2) {
         //直播
@@ -4511,6 +4462,89 @@ export default {
           });
         }
 
+        this.playVideo(option);
+      }
+
+      return;
+    },
+    /**
+     * 判断是否是当前播放的节
+     */
+    isActive(section) {
+      let moduleId = section.moduleId || 0;
+      let chapterId = section.chapterId || 0;
+      let sectionId = section.sectionId || section.menuId;
+      if (
+        moduleId == this.moduleId &&
+        chapterId == this.chapterId &&
+        sectionId == this.playSectionId
+      ) {
+        return true;
+      } else {
+        return false;
+      }
+    },
+
+    async playVideo(option) {
+      if (option.sectionType == 1 || option.sectionType == 3) {
+        //录播
+
+        //设置播放的节ID
+
+        //提交保存观看历史
+        if (this.playSectionId) {
+          this.postStudyRecord(0, this.playSectionId);
+        }
+
+        this.player &&
+          this.player.HTML5.video.removeEventListener(
+            "timeupdate",
+            this.timeEvent
+          );
+        //播放视频
+        this.showRecordStatus = false; //隐藏播放记录提示
+        this.sectionItem = option;
+        console.log(option, "option");
+        this.isPlayRebuild = option.rebuild;
+        this.moduleId = option.moduleId || 0;
+        this.chapterId = option.chapterId || 0;
+        this.playSectionId = option.sectionId || option.menuId;
+        // console.log(this.moduleId, this.chapterId, this.playSectionId);
+        await this.getPhotoLastRecord();
+        this.recordObj = await this.getRecordLast();
+        this.getNoteList();
+        await this.clears();
+        this.vid = option.recordingUrl;
+        this.loadPlayerScript(this.loadPlayer);
+        // uni.$emit("levelId", this.levelId);
+        // uni.$emit("getSection", this.menuItem);
+        // uni.$emit("isRebuild", this.isRebuild);
+      }
+      if (option.sectionType == 2) {
+        //直播
+
+        //提交保存观看历史
+        if (this.playSectionId) {
+          this.postStudyRecord(0, this.playSectionId);
+        }
+
+        this.player &&
+          this.player.HTML5.video.removeEventListener(
+            "timeupdate",
+            this.timeEvent
+          );
+        //播放视频
+        this.showRecordStatus = false; //隐藏播放记录提示
+        this.sectionItem = option;
+        console.log(section, "section");
+        this.isPlayRebuild = option.rebuild;
+        this.moduleId = option.moduleId || 0;
+        this.chapterId = option.chapterId || 0;
+        this.playSectionId = option.sectionId || option.menuId;
+        // console.log(this.moduleId, this.chapterId, this.playSectionId);
+        await this.getPhotoLastRecord();
+        this.recordObj = await this.getRecordLast();
+        this.getNoteList();
         //设置播放的节ID
         await this.clears();
         this.vidzb = option.liveUrl;

+ 3 - 0
src/pages/person-center/my-course/index.vue

@@ -412,6 +412,9 @@
           :key="index"
           class="radio"
           v-model="gradeValue"
+          :disabled="
+            item.studentNum > 0 && item.studentNum == item.studentUpper
+          "
         >
           <div>
             {{ item.className }}

+ 4 - 0
src/pages/person-center/my-message/index.vue

@@ -278,6 +278,7 @@
 </template>
 
 <script>
+import { mapMutations } from "vuex";
 export default {
   name: "MyMessage",
   data() {
@@ -317,6 +318,7 @@ export default {
     this.getappinformUserlist();
   },
   methods: {
+    ...mapMutations(["getMsgCount"]),
     getreceiptStatus() {
       this.$request
         .getappinformUserlist({
@@ -338,6 +340,7 @@ export default {
               systemStatus: this.formData.systemStatusList,
             })
             .then((res) => {
+              this.getMsgCount();
               this.$message.success("成功");
               this.getappinformUserlist();
             });
@@ -375,6 +378,7 @@ export default {
       this.$confirm("清空消息吗?")
         .then((_) => {
           this.$request.appInformUserRemoveAll().then((res) => {
+            this.getMsgCount();
             this.formData.pageNum = 1;
             this.getappinformUserlist();
           });

+ 12 - 1
src/store/index.js

@@ -9,6 +9,7 @@ Vue.use(Vuex);
 export default new Vuex.Store({
   //所有的数据都放在state中
   state: {
+    msgCount:0,
     cartCount:0,
     applyData: {}, //预约考试数据存放
     currentRouter:{},
@@ -34,7 +35,8 @@ export default new Vuex.Store({
     getApplyData: state => state.applyData,
     examResult: state => state.examResult,
     currentRouter: state => state.currentRouter,
-    cartCount: state => state.cartCount
+    cartCount: state => state.cartCount,
+    msgCount: state => state.msgCount
   },
 
   //操作数据,唯一的通道是mutations
@@ -74,6 +76,15 @@ export default new Vuex.Store({
       user.cartList().then((res) => {
         state.cartCount = res.total;
       });
+    },
+
+    getMsgCount(state) {
+      user.getappinformUserlist({
+        systemStatusList:'1,2',
+        receiptStatus: 0,
+      }).then(res => {
+        state.msgCount = res.total
+      })
     }
   },