page-answer-recruit-result.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="page-exam-item-result-box">
  3. <van-nav-bar title="答题" left-arrow @click-left="handleBackFun" />
  4. <div class="exam-item-result-div">
  5. <div class="exam-item-result-title">本次答对题目数</div>
  6. <div class="exam-item-result-grade">{{ grades }}</div>
  7. <div>正确率:{{ accuracyVal }}</div>
  8. <div>积分+{{ grades }}</div>
  9. <div class="exam-item-detial-button-box">
  10. <van-button
  11. class="exam-item-detial-button"
  12. type="primary"
  13. color="#FE6347"
  14. @click="handleBackFun"
  15. >返回</van-button
  16. >
  17. <van-button
  18. class="exam-item-detial-button"
  19. type="primary"
  20. color="#FE6347"
  21. @click="handleGoOnFun"
  22. >再来一组</van-button
  23. >
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. name: "page-answer-recruit-result",
  31. components: {},
  32. data() {
  33. return {
  34. grades: 0,
  35. allQuestionsNum: 0
  36. };
  37. },
  38. created() {
  39. this.grades = this.$route.params.grades || 0;
  40. this.allQuestionsNum = this.$route.params.allQuestionsNum || 0;
  41. },
  42. mounted() {},
  43. computed: {
  44. accuracyVal() {
  45. let that = this;
  46. if (isNaN(that.grades) || isNaN(that.allQuestionsNum)) {
  47. return "-";
  48. }
  49. return that.allQuestionsNum <= 0
  50. ? "0%"
  51. : Math.round((that.grades / that.allQuestionsNum) * 10000) / 100.0 +
  52. "%";
  53. }
  54. },
  55. methods: {
  56. // 操作:返回
  57. handleBackFun() {
  58. this.$router.back();
  59. },
  60. // 操作:再来一组
  61. handleGoOnFun() {
  62. this.$store.commit("updateAnswerStore", {
  63. field: "answerRecruitId",
  64. value: "daily-questions" // item.id
  65. });
  66. this.$router.replace({ name: "answerRecruit" });
  67. }
  68. }
  69. };
  70. </script>
  71. <style lang="scss" scoped>
  72. @import "~@/styles/mixin";
  73. .page-exam-item-result-box {
  74. width: 100%;
  75. height: 100%;
  76. overflow-y: auto;
  77. overflow-x: hidden;
  78. font-size: 0.6rem;
  79. .exam-item-result-div {
  80. margin: 0.5rem 0.5rem;
  81. border: 1px solid #e4e8eb;
  82. background-color: #fff;
  83. border-radius: 4px;
  84. padding: 0.5rem 0.5rem;
  85. .exam-item-result-title {
  86. font-size: 0.7rem;
  87. }
  88. .exam-item-result-grade {
  89. font-size: 1.5rem;
  90. text-align: center;
  91. margin: 0.5rem 0;
  92. border-bottom: 1px solid #e4e8eb;
  93. }
  94. .exam-item-detial-button-box {
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. margin-top: 0.5rem;
  99. .exam-item-detial-button {
  100. width: 48%;
  101. height: auto;
  102. padding: 0.5rem 0.5rem;
  103. font-size: 0.65rem;
  104. }
  105. }
  106. }
  107. }
  108. </style>