y595705120 il y a 3 mois
Parent
commit
45ca890d33

+ 4 - 6
src/containers/center/play/components/iCourseInfoTest.vue

@@ -64,12 +64,11 @@
     <el-col :span="9">
       <div>
         <p style="font-size: 24px;"> 考试情况 </p>
-
-        <section v-for="(item,index) in setting.examList">
+        <section v-for="(item,index) in examList">
           <span style="width:240px;margin: 0px;padding: 0px;">
-            {{item}}: <strong style="color: red;">{{info['score'+index]}} </strong>分
+            {{item.name}}: <strong style="color: red;">{{info['score'+(index+1)]}} </strong>分
           </span>
-          <el-button v-if="info['score'+index]<60" @click="startExam(index)" type="text">开始考试</el-button>
+          <el-button v-if="info['score'+index]<60" @click="startExam(item.id)" type="text">开始考试</el-button>
           <el-button v-else type="text" style="color: #006600;">考试通过</el-button>
         </section>
       </div>
@@ -87,7 +86,6 @@
 </template>
 
 <script>
-  import setting from '@/setting';
   import { getTime,packTime,toDate } from "@/utils/date";
   export default {
     name: "iCourseInfoTest",
@@ -103,7 +101,7 @@
         }
       }
     },
-    props: ['tpl', 'info'],
+    props: ['tpl', 'info', "examList"],
     destroyed(){
       this.timer &&  window.clearInterval(this.timer)
     },

+ 154 - 0
src/containers/center/play/components/iCourseInfoTranExam.vue

@@ -0,0 +1,154 @@
+<template>
+  <el-row class="p20 waphide">
+    <el-col :span="6">
+      <img :src="tpl.tb" width="200px" style="border-radius: 20px;" />
+    </el-col>
+    <el-col :span="6">
+      <div>
+        <p style="font-size: 24px;"> 课程信息 </p>
+        <p class="mt10">岗位名称:{{tpl.name}} </p>
+        <p class="mt10">课程学时:<strong style="color: red;">{{tpl.xs/10}} </strong>学时
+        </p>
+        <p class="mt10" v-if="tpl.examGroupId">课程年度:
+          <strong style="color: red;">{{tpl.nd}} </strong>
+        </p>
+        <p class="mt10">学习情况:
+          完成 <strong style="color: red;">{{info.getXs/10}} </strong>
+          共计 <strong style="color: red;">{{info.totalXs/10}}</strong>
+        </p>
+        <p class="mt10" v-if="tpl.examGroupId">最高分数:
+          <strong style="color: red;">{{info.score}} </strong>
+          分
+        </p>
+        <p class="mt10" v-if="tpl.examGroupId">开始时间:
+          <strong style="color: red;">{{info.startDate}} </strong>
+        </p>
+        <p class="mt10" >考试备注:<br>
+          <span style="padding:0 2rem;color: red;">
+            考试开始,三天内必须完成
+          </span>
+          <span style="padding:0 2rem;color: red;">
+            报名成功,80天内完成学习
+          </span>
+        </p>
+        <p class="mt10">
+          学习截至时间:
+          <strong style="color: red;">
+          {{info.canStudyDate}}
+          </strong>
+        </p>
+        <p class="mt10">
+          剩余考试时间:
+          <span  v-if="info.examTime>0">
+            <span v-if="end.d>0">
+              <span style="color: red;">{{end.d}}</span>
+              天
+            </span>
+            <span style="color: red;">{{end.h}}</span>
+            时
+            <span style="color: red;">{{end.m}}</span>
+            分
+            <span v-if="end.d==0">
+              <span style="color: red;">{{end.s}}</span>
+              秒
+            </span>
+          </span>
+          <span v-else>
+            还未开考
+          </span>
+        </p>
+
+      </div>
+    </el-col>
+
+    <el-col :span="9">
+      <div>
+        <p style="font-size: 24px;"> 考试情况 </p>
+
+        <section v-for="(item,index) in setting.examList">
+          <span style="width:240px;margin: 0px;padding: 0px;">
+            {{item}}: <strong style="color: red;">{{info['score'+index]}} </strong>分
+          </span>
+          <el-button v-if="info['score'+index]<60" @click="startExam(index)" type="text">开始考试</el-button>
+          <el-button v-else type="text" style="color: #006600;">考试通过</el-button>
+        </section>
+      </div>
+    </el-col>
+
+    <el-col :span="3">
+      <div>
+        <el-button type="primary" style="font-size: 14px;margin-top: ;" @click="printCert" v-if="tpl.tplId>0">
+          学时证明
+        </el-button>
+      </div>
+    </el-col>
+
+  </el-row>
+</template>
+
+<script>
+  import setting from '@/setting';
+  import { getTime,packTime,toDate } from "@/utils/date";
+  export default {
+    name: "iCourseInfoTest",
+    data() {
+      return {
+        setting,
+        timer: 0,
+        end: {
+          d: 0,
+          h: 0,
+          m: 0,
+          s: 0
+        }
+      }
+    },
+    props: ['tpl', 'info'],
+    destroyed(){
+      this.timer &&  window.clearInterval(this.timer)
+    },
+    created(){
+      this.initTimer()
+    },
+    filters:{
+      add80Date( date ){
+        let val = new Date(date).getTime() + 80*86400*1000;
+        return toDate( val )
+
+      }
+    },
+    methods: {
+      initTimer() {
+        if (this.timer) {
+          window.clearInterval(this.timer);
+        }
+        this.tickTimer();
+        this.timer = window.setInterval(() => {
+          this.tickTimer();
+        }, 1000);
+      },
+      tickTimer(  ) {
+        let nowSec = getTime();
+        let timeLast =  this.info.examTime -nowSec;
+        this.end = packTime(timeLast);
+        if (timeLast < 0) {
+          window.clearInterval(this.timer);
+        }
+      },
+      startExam(index) {
+        if( this.end.v <=0 && this.info.examTime>0 ) {
+          this.$message.errorMsg("开考超过三天,不能继续考试")
+          return;
+        }
+        if( this.tpl.isClosed ==1 ) {
+          this.$message.errorMsg("课程已经关闭", 2)
+          return;
+        }
+        this.$emit("startExam", +index)
+      },
+      printCert() {
+        this.$emit("printCert")
+      }
+    }
+  }
+</script>

+ 41 - 8
src/containers/center/play/components/media.vue

@@ -3,9 +3,9 @@
     <!--  -->
 
     <div class="v-wrap-marks"></div>
-    <video-player id="myVideo" class="video-player-box" ref="videoPlayer" :playsinline="true" @pause="onPlayerPause($event)"
-      @timeupdate="onPlayerTimeupdate($event)" @play="onPlayerStart($event)" @ready="playerReadied" @ended="onPlayerEnded($event)"
-      :globalOptions="{controls:true}" :options="options">
+    <video-player id="myVideo" class="video-player-box" ref="videoPlayer" :playsinline="true"
+      @pause="onPlayerPause($event)" @timeupdate="onPlayerTimeupdate($event)" @play="onPlayerStart($event)"
+      @ready="playerReadied" @ended="onPlayerEnded($event)" :globalOptions="{controls:true}" :options="options">
     </video-player>
     <div class="dialog-footer pt30">
       <el-row class="media-footer">
@@ -15,14 +15,16 @@
           <span>{{media.duration|useTime}}</span>
         </el-col>
         <el-col :span="4" class="media-center">
-          <el-button class="bicon" v-if="!onPlay" type="primary" @click="doPlay" icon="el-icon-video-play" circle></el-button>
+          <el-button class="bicon" v-if="!onPlay" type="primary" @click="doPlay" icon="el-icon-video-play"
+            circle></el-button>
           <el-button class="bicon" v-else type="warning" @click="doPause" icon="el-icon-video-pause" circle></el-button>
         </el-col>
         <el-col :span="10" class="media-select">
           <el-button class="bicon" type="danger" icon="el-icon-close" @click="onClose" style="float: right;">
           </el-button>
           <div style="margin-top:0px;float: right;">
-            <el-select placeholder="流畅" :value="mediaType" class="media-el-select" @change="(val)=>{$emit('changeMedia', val)}">
+            <el-select placeholder="流畅" :value="mediaType" class="media-el-select"
+              @change="(val)=>{$emit('changeMedia', val)}">
               <el-option label="流畅" value="ld"></el-option>
               <el-option label="标清" value="hls"></el-option>
             </el-select>
@@ -132,7 +134,7 @@
     methods: {
       setMarks() {
         console.log("setMarks")
-        if( !this.options.marks ) return;
+        if (!this.options.marks) return;
         var div = document.getElementById('myVideo')
         var div1 = div.firstChild
         var div3 = document.createElement("div");
@@ -166,14 +168,14 @@
         console.log("playerReadied", audio)
         let that = this;
         // if (this.media.position) {
-          // this.setposition(this.media.position);
+        // this.setposition(this.media.position);
         if (this.media.position > 5 && this.media.position < this.media.duration) {
           setTimeout(() => {
             this.setposition(this.media.position)
           }, 2000)
         }
         this.isReady = true
-        setTimeout(()=> this.setMarks(), 600);
+        setTimeout(() => this.setMarks(), 600);
       },
       onPlayerTimeupdate(player) {
         let myPlayer = this.$refs.videoPlayer.player;
@@ -242,6 +244,33 @@
             // that.doPlay()
           }
         });
+        // 监听F12
+        document.addEventListener("keydown", function(e) {
+          if (e.key == "F12") {
+            that.reportErr("play", 'keydownF12');
+            e.preventDefault();
+          }
+        });
+
+        setInterval(function() { check() }, 1000);
+
+        var check = function() {
+          function doCheck(a) {
+            if (("" + a / a)["length"] !== 1 || a % 20 === 0) {
+              (function() {}
+                ["constructor"]("debugger")())
+            } else {
+              (function() {}
+                ["constructor"]("debugger")())
+            }
+            doCheck(++a)
+          }
+          try {
+            doCheck(0)
+          } catch (err) {}
+        };
+
+
       },
       // startMonitor() {
       //   let that = this
@@ -301,6 +330,10 @@
         if (!isFinish) {
           if (!this.onPlay) return;
         }
+        if(window.navigator.webdriver){
+          this.doPause()
+          return
+        }
         // 强制完成
         let param = {
           id: media.id,

+ 15 - 3
src/containers/center/play/index.vue

@@ -1,11 +1,15 @@
 <template>
   <div class="m-right-block mh576">
-    <ICourseInfoTest  v-if="tpl.type=='检测试验人员'" :info="info" :tpl="tpl" @printCert="printCert" @startExam="startExam"></ICourseInfoTest>
-    <ICourseInfoXsExtra v-else-if="tpl.testXs>0"
+
+
+    <ICourseInfoXsExtra v-if="tpl.isTranExam==2"
     :extraXs="extraXs"  :info="info"
     @updateInfo="updateInfo"
     :tpl="tpl" @startExamTest="startExamTest" @startExam="startExam"></ICourseInfoXsExtra>
 
+    <ICourseInfoTest  v-else-if="tpl.isTranExam>0" :examList="examList" :info="info" :tpl="tpl" @printCert="printCert" @startExam="startExam"></ICourseInfoTest>
+
+
     <ICourseInfo v-else :info="info" :tpl="tpl" @printCert="printCert" @startExam="startExam"></ICourseInfo>
 
     <div class="right-block-bd ng-scope" ui-view="myStudyContent" style="position: relative;">
@@ -166,6 +170,7 @@
           }
         },
         list: [],
+        examList:[],
         showList:[],
       };
     },
@@ -299,10 +304,17 @@
         let param = { courseId: this.courseId }
         httpServer("course.getCourse", param).then(res => {
           if (res.code == 200) {
-            let {info, extra, list, tpl, extraXs} = res.data;
+            let {info, extra, list, tpl, extraXs, examList} = res.data;
             this.info =  Object.assign( info, extra||{});
+            this.info.score1 = +this.info.score1||0
+            this.info.score2 = +this.info.score2||0
+            this.info.score3 = +this.info.score3||0
+            this.info.score4 = +this.info.score4||0
+            this.info.score5 = +this.info.score5||0
+            this.info.score6 = +this.info.score6||0
             this.tpl = tpl||{};
             this.extraXs = extraXs||{};
+            this.examList = examList||[];
             this.list = list.map( (item)=>{
               item.percent = getPercent(item)||0;
               return item;