Browse Source

15分钟提醒一次

y595705120 1 month ago
parent
commit
c8ca830a85

+ 1 - 1
config/index.js

@@ -4,7 +4,7 @@
 //
 //
 // const TARGET = "http://study.ndjsxh.cn:8888/"
 // const TARGET = "http://study.ndjsxh.cn:8888/"
 // const TARGET = "http://localhost:8000/"
 // const TARGET = "http://localhost:8000/"
-const TARGET = "http://jjxh.hqedust.com/"
+const TARGET = "http://edu.jjxh.hqedust.com:8888"
 const path = require('path')
 const path = require('path')
 
 
 module.exports = {
 module.exports = {

+ 17 - 21
src/containers/center/play/components/media.vue

@@ -30,6 +30,7 @@
         tickNum: 0,
         tickNum: 0,
         prevTime:0,
         prevTime:0,
         isReady:false,
         isReady:false,
+        onblurTime: 0,
         onPlay: false
         onPlay: false
       }
       }
     },
     },
@@ -44,24 +45,7 @@
         }
         }
       }
       }
     },
     },
-    props: {
-      media:{
-        type: Object,
-        default: ()=>{
-          return {id: '', percent:0}
-        }
-      },
-      dialog:{
-        type: Boolean,
-        default: true
-      },
-      options: {
-        type: Object,
-        default: () => {
-          return {}
-        }
-      }
-    },
+    props: ['media', 'dialog', 'options'],
     beforeDestroy() {
     beforeDestroy() {
       if (this.timer) {
       if (this.timer) {
         clearInterval(this.timer); //关闭
         clearInterval(this.timer); //关闭
@@ -74,7 +58,7 @@
     },
     },
     created() {
     created() {
       this.timer = setInterval(this.tick, 5 * 1000);
       this.timer = setInterval(this.tick, 5 * 1000);
-      // this.startMonitor();
+      this.startMonitor();
     },
     },
     methods: {
     methods: {
       playerReadied(player) {
       playerReadied(player) {
@@ -123,6 +107,7 @@
         this.onPlay = false
         this.onPlay = false
       },
       },
       doPlay(){
       doPlay(){
+        this.updateBlurtime()
         if( !this.$refs.videoPlayer || !this.$refs.videoPlayer.player ) return;
         if( !this.$refs.videoPlayer || !this.$refs.videoPlayer.player ) return;
         if( !this.dialog ) return this.doPause();
         if( !this.dialog ) return this.doPause();
         let myPlayer = this.$refs.videoPlayer.player;
         let myPlayer = this.$refs.videoPlayer.player;
@@ -133,13 +118,18 @@
       onPlayerStart() {
       onPlayerStart() {
         this.onPlay = true
         this.onPlay = true
       },
       },
+      updateBlurtime(){
+         this.onblurTime = Date.now() + 15*60 * 1000
+      },
       startMonitor() {
       startMonitor() {
         let that = this
         let that = this
         window.onblur = function() {
         window.onblur = function() {
-          that.doPause()
+          that.updateBlurtime()
+          // that.doPause()
         }
         }
         window.onfocus = function () {
         window.onfocus = function () {
-          that.doPlay()
+          that.updateBlurtime()
+          // that.doPlay()
         }
         }
       },
       },
       tickWait(){
       tickWait(){
@@ -164,9 +154,15 @@
       tick( force = false) {
       tick( force = false) {
         let media = this.media;
         let media = this.media;
         this.tickNum ++
         this.tickNum ++
+        console.log("tick", this.onblurTime )
+        if( this.onblurTime < Date.now() ){
+          this.tickWait();
+          return
+        }
         // 已经完成
         // 已经完成
         if( this.media.isFinish )  return;
         if( this.media.isFinish )  return;
 
 
+
         // 主动暂停
         // 主动暂停
         let myPlayer = this.$refs.videoPlayer.player;
         let myPlayer = this.$refs.videoPlayer.player;
         let curTimes = parseInt(myPlayer.currentTime());
         let curTimes = parseInt(myPlayer.currentTime());

+ 1 - 1
src/containers/center/play/index.vue

@@ -110,7 +110,7 @@
     <el-dialog class="fc tc media-dialog" :visible.sync="mediaDialog" append-to-body top="50px" :title="media.name"
     <el-dialog class="fc tc media-dialog" :visible.sync="mediaDialog" append-to-body top="50px" :title="media.name"
       :close-on-click-modal="false" width="640px">
       :close-on-click-modal="false" width="640px">
 
 
-      <Media :options="options" :dialog="mediaDialog" :media="media" :duration="info.duration" @close="mediaDialog=false"
+      <Media :options="options" :dialog="mediaDialog" :media="media" :course="info"  @close="mediaDialog=false"
         @update="update">
         @update="update">
       </Media>
       </Media>
       <span slot="footer" class="dialog-footer mt5">
       <span slot="footer" class="dialog-footer mt5">