OverallProgress.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div class="progress-container">
  3. <i-progress
  4. :percent="progressNum"
  5. :stroke-width="20"
  6. status="active"
  7. hide-info
  8. style="color: black"
  9. >
  10. </i-progress>
  11. <span>{{ progress }}</span>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "OverallProgress",
  17. data() {
  18. return {};
  19. },
  20. props: {
  21. examQuestionList: Array,
  22. },
  23. async mounted() {},
  24. computed: {
  25. progressNum() {
  26. return (
  27. 100 *
  28. (this.examQuestionList.filter(q => q.studentAnswer !== null).length /
  29. this.examQuestionList.length)
  30. );
  31. },
  32. progress: function() {
  33. return `${
  34. this.examQuestionList.filter(q => q.studentAnswer !== null).length
  35. } / ${this.examQuestionList.length}`;
  36. },
  37. },
  38. };
  39. </script>
  40. <style scoped>
  41. .progress-container {
  42. display: grid;
  43. justify-self: flex-start;
  44. align-items: center;
  45. justify-items: center;
  46. grid-template-columns: 200px 50px;
  47. width: 250px;
  48. }
  49. </style>
  50. <style>
  51. .progress-container .ivu-progress-inner {
  52. background-color: #02ffff;
  53. background-color: white;
  54. border-radius: 0px;
  55. }
  56. .progress-container .ivu-progress-bg {
  57. border-radius: 0px;
  58. }
  59. </style>