submitMask.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. 您本次模拟考试得{{ correctScore }}分。<span v-if="correctScore >= 90">及格</span
  12. ><span v-else>不及格</span>,祝你下次
  13. </div>
  14. <div class="mid-line3" v-if="correctScore >= 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. props: {
  84. correctScore: {
  85. type: Number,
  86. required: true,
  87. default: 0,
  88. },
  89. },
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. button {
  94. border-radius: 0;
  95. border: none;
  96. }
  97. .mask {
  98. position: fixed;
  99. top: 0;
  100. width: 100vw;
  101. height: 100vh;
  102. background-color: rgb(0, 0, 0, 0.65);
  103. z-index: 10;
  104. display: flex;
  105. align-content: center;
  106. align-items: center;
  107. justify-content: center;
  108. .dialog {
  109. width: 400px;
  110. height: 205px;
  111. background: #fff;
  112. .title {
  113. width: 100%;
  114. line-height: 40px;
  115. height: 40px;
  116. background: #306ace;
  117. color: #fff;
  118. font-size: 12px;
  119. }
  120. .mid {
  121. width: 100%;
  122. background: #fff;
  123. height: 100px;
  124. padding-left: 10px;
  125. padding-right: 10px;
  126. font-size: 14px;
  127. .mid-line1 {
  128. line-height: 25px;
  129. height: 25px;
  130. text-align: left;
  131. }
  132. .mid-line2 {
  133. text-align: left;
  134. line-height: 30px;
  135. }
  136. .mid-line3 {
  137. text-align: left;
  138. line-height: 30px;
  139. }
  140. .mid-line4 {
  141. text-align: left;
  142. line-height: 30px;
  143. }
  144. }
  145. .bottom {
  146. background: #306ace;
  147. width: 100%;
  148. height: 70px;
  149. display: flex;
  150. justify-content: center;
  151. flex-wrap: wrap;
  152. align-items: flex-start;
  153. align-content: flex-start;
  154. button:nth-child(1) {
  155. height: 30px;
  156. margin-top: 10px;
  157. }
  158. .bottom-line {
  159. width: 100%;
  160. text-align: center;
  161. color: #fff;
  162. font-size: 12px;
  163. margin-top: 5px;
  164. }
  165. button:nth-child(2) {
  166. height: 30px;
  167. }
  168. }
  169. }
  170. }
  171. </style>