submitMask.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div class="mask">
  3. <div>
  4. <div class="dialog">
  5. <div class="title">
  6. <span>信息提示</span>
  7. </div>
  8. <div class="mid">
  9. <div class="mid-line1">亲爱的考生:</div>
  10. <div class="mid-line2">
  11. 您本次模拟考试得{{ score }}分。<span v-if="score >= 90">及格</span
  12. ><span v-else>不及格</span>,祝你下次
  13. </div>
  14. <div class="mid-line3" v-if="score >= 90">再接再励</div>
  15. <div class="mid-line3" v-else>考试成功</div>
  16. </div>
  17. <div class="bottom">
  18. <button
  19. @click="
  20. () => {
  21. router.push({
  22. name: 'examBegin',
  23. query: {
  24. ...router.currentRoute.value.query,
  25. },
  26. });
  27. }
  28. "
  29. >
  30. 关闭
  31. </button>
  32. <div class="bottom-line">页面将在{{ time }}s内返回</div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import { defineProps, reactive, toRefs, ref } from 'vue';
  40. import router from '@/router/';
  41. import Phone from '@/utils/phone';
  42. export default {
  43. setup(props, { emit }) {
  44. const state = reactive({
  45. count: 0,
  46. });
  47. const phone = new Phone();
  48. const backView = phone.backView.bind(phone);
  49. const time = ref(8);
  50. const timer = window.setInterval((e) => {
  51. time.value = time.value - 1;
  52. if (time.value === 0) {
  53. window.clearInterval(timer);
  54. // backView()
  55. router.push({
  56. name: 'examBegin',
  57. query: {
  58. ...router.currentRoute.value.query,
  59. },
  60. });
  61. }
  62. }, 1000);
  63. const sendPaper = () => {
  64. emit('confirm');
  65. };
  66. const cancelSubmit = () => {
  67. emit('cancel');
  68. };
  69. return {
  70. ...toRefs(state),
  71. props,
  72. sendPaper,
  73. cancelSubmit,
  74. time,
  75. timer,
  76. router,
  77. backView,
  78. };
  79. },
  80. beforeUnmount() {
  81. window.clearInterval(this.timer);
  82. },
  83. computed: {
  84. score() {
  85. console.log(router.currentRoute.value.query)
  86. if (router.currentRoute.value.query.subject == "4") {
  87. return this.correctScore * 2;
  88. }
  89. return this.correctScore;
  90. },
  91. },
  92. props: {
  93. correctScore: {
  94. type: Number,
  95. required: true,
  96. default: 0,
  97. },
  98. },
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. button {
  103. border-radius: 0;
  104. border: none;
  105. }
  106. .mask {
  107. position: fixed;
  108. top: 0;
  109. width: 100vw;
  110. height: 100vh;
  111. background-color: rgb(0, 0, 0, 0.65);
  112. z-index: 10;
  113. display: flex;
  114. align-content: center;
  115. align-items: center;
  116. justify-content: center;
  117. .dialog {
  118. width: 400px;
  119. height: 205px;
  120. background: #fff;
  121. .title {
  122. width: 100%;
  123. line-height: 40px;
  124. height: 40px;
  125. background: #306ace;
  126. color: #fff;
  127. font-size: 12px;
  128. }
  129. .mid {
  130. width: 100%;
  131. background: #fff;
  132. height: 100px;
  133. padding-left: 10px;
  134. padding-right: 10px;
  135. font-size: 14px;
  136. .mid-line1 {
  137. line-height: 25px;
  138. height: 25px;
  139. text-align: left;
  140. }
  141. .mid-line2 {
  142. text-align: left;
  143. line-height: 30px;
  144. }
  145. .mid-line3 {
  146. text-align: left;
  147. line-height: 30px;
  148. }
  149. .mid-line4 {
  150. text-align: left;
  151. line-height: 30px;
  152. }
  153. }
  154. .bottom {
  155. background: #306ace;
  156. width: 100%;
  157. height: 70px;
  158. display: flex;
  159. justify-content: center;
  160. flex-wrap: wrap;
  161. align-items: flex-start;
  162. align-content: flex-start;
  163. button:nth-child(1) {
  164. height: 30px;
  165. margin-top: 10px;
  166. }
  167. .bottom-line {
  168. width: 100%;
  169. text-align: center;
  170. color: #fff;
  171. font-size: 12px;
  172. margin-top: 5px;
  173. }
  174. button:nth-child(2) {
  175. height: 30px;
  176. }
  177. }
  178. }
  179. }
  180. </style>