Browse Source

sm_ubuntu

y595705120 2 years ago
parent
commit
e43bb82669

+ 9 - 2
src/containers/center/exam/index.vue

@@ -139,6 +139,7 @@ export default {
     return {
       uuid:0,
       examId:0,
+      groupId:0,
       startExam: false,
       dialogVisible: false,
       info: {},
@@ -296,6 +297,7 @@ export default {
       this.loadQuestion(index);
     },
     doStartExam( info ){
+      info.groupId = this.groupId||0;
       this.info = info
       this.questionList = info.answers
       this.loadQuestion(0);
@@ -311,15 +313,20 @@ export default {
 
   beforeMount() {
     let courseId = +this.$route.params.courseId
+    let groupId = +this.$route.query.groupId;
+    this.groupId = groupId;
+    this.courseId = courseId;
     let info = getExam()
     let nowSec = getTime()
-    if( info.courseId == courseId && info.startTime + info.duration > nowSec){
+
+    if( info.courseId == courseId &&  info.groupId == groupId&&
+    info.questionList.length>0 &&info.startTime + info.duration > nowSec){
       this.doStartExam( info )
       return;
     }
     let that = this;
     //
-    httpServer("course.StartExam", {courseId} ).then(res => {
+    httpServer("course.StartExam", {courseId, groupId} ).then(res => {
       if( res.code != 200) return;
       let info = res.data||{}
       info.questionList = info.answers.map( v =>{

+ 95 - 0
src/containers/center/play/components/iCourseInfo.vue

@@ -0,0 +1,95 @@
+
+<template>
+    <el-row class="p20">
+      <el-col :lg="6" :md="6" :span="6">
+        <el-progress
+          class="mprocess"
+          type="circle"
+          :width="150"
+          :format="formatFinish"
+          :stroke-width="18"
+          :percentage="info.percent"
+          >
+        </el-progress>
+
+      </el-col>
+
+      <el-col :lg="6"  :md="6" :span="6">
+        <el-progress v-if="tpl.examGroupId>0"
+           class="mprocess"
+           type="circle"
+           :width="150"
+           :format="formatExam"
+           :stroke-width="18"
+           :percentage="info.score"
+           >
+        </el-progress>
+
+        <el-progress v-else
+           class="mprocess"
+           type="circle"
+           :width="150"
+           :format="formatString('--')"
+           :stroke-width="18"
+           :percentage="0"
+           >
+        </el-progress>
+      </el-col>
+
+      <el-col :lg="6" :md="6" :span="6">
+        <img src="../../../../assets/wxapp.jpg"  width="150px"  />
+      </el-col>
+
+      <el-col :lg="6" :md="6" :span="6">
+        <div>
+          <p style="font-size: 24px;"> 说明 </p>
+          <p class="mt10" >岗位名称:{{tpl.name}} </p>
+          <p class="mt10" v-if="tpl.examGroupId>0" >考试不限次数,获得60分即合格</p>
+
+          <p class="mt10" v-if="tpl.examGroupId==0" >学完所有课程,即可打印学时证明</p>
+
+          <div>
+              <el-button type="primary" class="mt10" style="font-size: 14px;" @click="startExam" v-if="tpl.examGroupId>0">
+                参加考试
+              </el-button>
+              <el-button type="primary" class="mt10" style="font-size: 14px;" @click="printCert">
+                学时证明
+              </el-button>
+          </div>
+         </div>
+      </el-col>
+
+    </el-row>
+    </template>
+
+    <script>
+  export default {
+    name: "Index",
+    data() {
+      return {
+      }
+    },
+    props:['tpl', 'info'],
+     methods: {
+         startExam(){
+             this.$emit("startExam",  0)
+         },
+        printCert(){
+            this.$emit("printCert")
+         },
+         formatFinish() {
+        let {gxs,axs} = this.info;
+        if( !axs ) axs = 1;
+        return `获得${gxs}学时, 总共${axs}学时`;
+      },
+      formatExam() {
+        let {score} = this.info
+        if( score == -1 ) return `已答0次,未通过`;
+        return `最高${score<1?0:score}分, ${score>=60?'通过':'未通过'}`;
+      },
+      formatString(val){
+        return ()=> val;
+      }
+     }
+  }
+  </script>

+ 74 - 0
src/containers/center/play/components/iCourseInfoTest.vue

@@ -0,0 +1,74 @@
+
+<template>
+     <el-row class="p20">
+      <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>
+          
+        </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 @click="startExam(index)" type="text">开始考试</el-button>
+          </section>
+        </div>
+      </el-col>
+
+      <el-col :span="3">
+        <div>
+          <el-button type="primary"   style="font-size: 14px;margin-top: ;" @click="printCert">
+            学时证明
+          </el-button>
+         </div>
+      </el-col>
+
+    </el-row>
+    </template>
+
+    <script>
+    import setting  from '@/setting';
+  export default {
+    name: "iCourseInfoTest",
+    data() {
+      return {
+          setting
+      }
+    },
+    props:['tpl', 'info'],
+     methods: {
+         startExam(index){
+             this.$emit("startExam",  +index)
+         },
+        printCert(){
+            this.$emit("printCert")
+         }
+     }
+  }
+  </script>

+ 11 - 69
src/containers/center/play/index.vue

@@ -1,74 +1,14 @@
 <template>
   <div class="m-right-block fr mh576">
-
-    <el-row class="p20">
-      <el-col :lg="6" :md="6" :span="6">
-        <el-progress
-          class="mprocess"
-          type="circle"
-          :width="150"
-          :format="formatFinish"
-          :stroke-width="18"
-          :percentage="info.percent"
-          >
-        </el-progress>
-
-      </el-col>
-
-      <el-col :lg="6"  :md="6" :span="6">
-        <el-progress v-if="tpl.examGroupId>0"
-           class="mprocess"
-           type="circle"
-           :width="150"
-           :format="formatExam"
-           :stroke-width="18"
-           :percentage="info.score"
-           >
-        </el-progress>
-
-        <el-progress v-else
-           class="mprocess"
-           type="circle"
-           :width="150"
-           :format="formatString('--')"
-           :stroke-width="18"
-           :percentage="0"
-           >
-        </el-progress>
-      </el-col>
-
-      <el-col :lg="6" :md="6" :span="6">
-        <img src="../../../assets/wxapp.jpg"  width="150px"  />
-      </el-col>
-
-      <el-col :lg="6" :md="6" :span="6">
-        <div>
-          <p style="font-size: 24px;"> 说明 </p>
-          <p class="mt10" >岗位名称:{{tpl.name}} </p>
-          <p class="mt10" v-if="tpl.examGroupId>0" >考试不限次数,获得60分即合格</p>
-
-          <p class="mt10" v-if="tpl.examGroupId==0" >学完所有课程,即可打印学时证明</p>
-
-          <div>
-              <el-button type="primary" class="mt10" style="font-size: 14px;" @click="startExam" v-if="tpl.examGroupId>0">
-                参加考试
-              </el-button>
-              <el-button type="primary" class="mt10" style="font-size: 14px;" @click="printCert">
-                学时证明
-              </el-button>
-          </div>
-         </div>
-      </el-col>
-
-    </el-row>
+    <ICourseInfoTest  v-if="tpl.type=='检测试验人员'" :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;">
-
       <div class="m-account">
         <div class="account-tit" style="height:30px">
           <a :class="{'current':show===1}"  @click="show=1" class="">正在学习</a>
           <a :class="{'current':show===2}"  @click="show=2" class="">已经完成</a>
-          <a :class="{'current':show===3}"  @click="show=3" class="" v-if="tpl.examGroupId>0">考试记录</a>
+          <a :class="{'current':show===3}"  @click="show=3" class="" v-if="tpl.examGroupId>0||tpl.type=='检测试验人员'">考试记录</a>
         </div>
 
         <div v-if="show <3" class="lwh-ul-form mt20">
@@ -163,6 +103,8 @@
   import {httpServer } from "@/components/httpServer/httpServer.js";
   import Media from "./components/media.vue";
   import ExamList from "./components/ExamList.vue";
+  import ICourseInfo from "./components/iCourseInfo.vue";
+   import ICourseInfoTest from "./components/iCourseInfoTest.vue";
   import {getPercent} from '@/utils/index.js'
    import {delExam} from '../exam/components/util.js'
   import md5 from 'js-md5';
@@ -207,7 +149,7 @@
         showList:[],
       };
     },
-    components:{Media,ExamList},
+    components:{Media,ExamList,ICourseInfo,ICourseInfoTest},
     beforeMount() {
       this.courseId = +this.$route.params.courseId
       this.getData()
@@ -256,10 +198,10 @@
         this.options.autoplay = this.options.playtimes>0;
         this.mediaDialog = true;
       },
-      startExam( ){
+      startExam( groupId ){
         let courseId = this.courseId
         delExam()
-        this.$router.push(`/center/exam/${courseId}`);
+        this.$router.push({path:`/center/exam/${courseId}`, query:{groupId}});
       },
       printCert( ){
         if( this.info.getXs < this.info.totalXs ){
@@ -317,9 +259,9 @@
         let param = { courseId: this.courseId }
         httpServer("course.getCourse", param).then(res => {
           if (res.code == 200) {
-            this.info = res.data.info;
-            let list = res.data.list;
-            this.tpl = res.data.tpl||{};
+            let {info, extra, list, tpl} = res.data;
+            this.info =  Object.assign( info, extra||{});
+            this.tpl = tpl||{};
             this.list = list.map( (item)=>{
               item.percent = getPercent(item)||0;
               return item;