iCourseInfo.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <el-row class="p20 waphide">
  3. <el-col :lg="6" :md="6" :span="6">
  4. <el-progress class="mprocess" type="circle" :width="150" :format="formatFinish" :stroke-width="18"
  5. :percentage="info.percent">
  6. </el-progress>
  7. </el-col>
  8. <el-col :lg="6" :md="6" :span="6">
  9. <el-progress v-if="tpl.testGroupId>0" class="mprocess" type="circle" :width="150" :format="formatTest"
  10. :stroke-width="18" :percentage="finishCount">
  11. </el-progress>
  12. <el-progress v-else-if="tpl.examGroupId>0" class="mprocess" type="circle" :width="150" :format="formatExam"
  13. :stroke-width="18" :percentage="info.score">
  14. </el-progress>
  15. <el-progress v-else class="mprocess" type="circle" :width="150" :format="formatString('--')" :stroke-width="18"
  16. :percentage="0">
  17. </el-progress>
  18. </el-col>
  19. <el-col :lg="6" :md="6" :span="6">
  20. <img src="../../../../assets/wxapp.jpg" width="150px" />
  21. </el-col>
  22. <el-col :lg="6" :md="6" :span="6">
  23. <div>
  24. <p style="font-size: 24px;"> 说明 </p>
  25. <p class="mt10">岗位名称:{{tpl.name}}<strong style="color: red;">{{tpl.nd}}</strong></p>
  26. <p class="mt10">
  27. 通过条件: <strong style="color: red;" >学满{{tpl.mediaXs/10}}学时 <span v-show="tpl.examGroupId>0">并考试合格</span></strong>
  28. </p>
  29. <p class="mt10" v-if="tpl.testGroupId>0">
  30. 参与练习: <strong style="color: red;"> {{finishCount}}</strong>题,满100题可得
  31. <strong style="color: red;">{{tpl.testXs/10}}</strong>学时
  32. </p>
  33. <div>
  34. <el-button type="primary" class="mt10" style="font-size: 14px;" @click="startExam" v-if="tpl.examGroupId>0"
  35. :disabled="info.score>=60">
  36. 参加考试
  37. </el-button>
  38. <el-button type="primary" class="mt10" style="font-size: 14px;" @click="startExamTest"
  39. v-if="tpl.testGroupId>0" :disabled="info.score>=60">
  40. 在线练习
  41. </el-button>
  42. <el-button type="primary" class="mt10" style="font-size: 14px;" @click="printCert" v-if="info.isPass && tpl.tplId>0">
  43. 学时证明
  44. </el-button>
  45. </div>
  46. </div>
  47. </el-col>
  48. </el-row>
  49. </template>
  50. <script>
  51. import {
  52. toDate
  53. } from "@/utils/date";
  54. export default {
  55. name: "Index",
  56. data() {
  57. return {
  58. finishCount:0
  59. }
  60. },
  61. filters: {
  62. add80Date(date) {
  63. let val = new Date(date).getTime() + 80 * 86400 * 1000;
  64. return toDate(val)
  65. },
  66. testCount(val) {
  67. let finish= (+val.index1) + (+val.index2) + (+val.index3) + (+val.index4) || 0
  68. return finish;
  69. }
  70. },
  71. props: ['tpl', 'info', 'extraXs'],
  72. mounted(){
  73. this.recalcXs()
  74. },
  75. watch:{
  76. extraXs:{
  77. handler(){
  78. this.recalcXs()
  79. },
  80. deep:true
  81. }
  82. },
  83. methods: {
  84. recalcXs(){
  85. this.finishCount = (this.extraXs.index1) + (+this.extraXs.index2) + (+this.extraXs.index3) + (+this.extraXs.index4)||0
  86. },
  87. startExam() {
  88. if (this.tpl.isClosed == 1) {
  89. this.$message.errorMsg("课程已经关闭", 2)
  90. return;
  91. }
  92. this.$emit("startExam", 0)
  93. },
  94. startExamTest() {
  95. this.recalcXs()
  96. this.$emit("startExamTest")
  97. },
  98. printCert() {
  99. this.recalcXs()
  100. this.$emit("printCert")
  101. },
  102. formatFinish() {
  103. let {
  104. gxs,
  105. axs
  106. } = this.info;
  107. let {testXs}= this.tpl
  108. let attrch = this.finishCount>=100?testXs/10:0;
  109. if (!axs) axs = 1;
  110. return `获得${gxs+attrch}学时, 总共${axs+testXs/10}学时`;
  111. },
  112. formatExam() {
  113. let {
  114. score
  115. } = this.info
  116. if (score == -1) return `已答0次,未通过`;
  117. return `最高${score<1?0:score}分, ${score>=60?'通过':'未通过'}`;
  118. },
  119. formatTest() {
  120. let finishCount = this.finishCount
  121. return `练习${finishCount}题, ${finishCount>=100?'完成':'未完成'}`;
  122. },
  123. formatString(val) {
  124. return () => val;
  125. }
  126. }
  127. }
  128. </script>