lsc 1 개월 전
부모
커밋
1e678c7c88
1개의 변경된 파일30개의 추가작업 그리고 0개의 파일을 삭제
  1. 30 0
      src/components/pptEasyClass/index.vue

+ 30 - 0
src/components/pptEasyClass/index.vue

@@ -83,6 +83,7 @@ export default {
       inviteCode: "",
       startTime: "",
       freeBrowse: true, // 默认自由浏览
+      opertimer: null, // 定时器
     };
   },
   methods: {
@@ -222,8 +223,36 @@ export default {
       console.log('自由浏览模式已切换为1:', this.freeBrowse);
       this.$refs.ppt.contentWindow.PPTistStudent.toggleFollowMode()
     },
+    setOperationTime() {
+      let _this = this;
+      if (_this.opertimer) {
+        clearInterval(_this.opertimer);
+        _this.opertimer = null;
+      }
+      _this.opertimer = setInterval(() => {
+        _this.setoTime("600");
+      }, 600000);
+    },
+    setoTime(time) {
+      let params = [
+        {
+          uid: this.userid,
+          cid: this.id,
+          type: "2",
+          time: time,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "addOperationTimeT2", params)
+        .then((res) => {})
+        .catch((err) => {
+          console.error(err);
+        });
+    },
   },
   destroyed() {
+    clearInterval(this.opertimer);
+    this.opertimer = null;
     if (this.courseDetail.userid == this.userid && this.tcid2 && this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840') {
       let endTime = new Date().toLocaleString("zh-CN", {
         hour12: false,
@@ -248,6 +277,7 @@ export default {
     }).replace(/\//g, "-")
     this.getClassName()
     this.getCourseDetail();
+    this.setOperationTime();
     window.onFreeBrowseChange = (value) => {
       this.freeBrowse = value;
       console.log('自由浏览模式已切换为:', this.freeBrowse);