unitResult.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
  3. mask-background-color="rgba(0,0,0, 0.76);" class="ezy-popup-width-all">
  4. <view class="dycs-dialog">
  5. <!-- 返回区域 -->
  6. <view class="icon-title-navBar-box">
  7. <view @click="handleBack" class="nav-bar-icon"></view>
  8. <text class="nav-bar-title">单元测试</text>
  9. </view>
  10. <view class="ezy-page-body dycs-body">
  11. <view class="dycs-img"></view>
  12. <view class="dycs-tip">单元测试已完成</view>
  13. <view class="dycs-fenshu-box">
  14. <view class="fenshu-item-box">
  15. <view class="item-number">{{data.right}}</view>
  16. <view>正确</view>
  17. </view>
  18. <view class="item-line"></view>
  19. <view class="fenshu-item-box">
  20. <view class="item-number red-number">{{data.wrong}}</view>
  21. <view>错误</view>
  22. </view>
  23. </view>
  24. <view class="dycs-btn-box">
  25. <view @click="handleRestart" class="cxcs-btn">重新测试</view>
  26. <view @click="handleCheckAnswer" class="ckda-btn">查看答案</view>
  27. </view>
  28. </view>
  29. </view>
  30. </uni-popup>
  31. </template>
  32. <script setup>
  33. import {
  34. ref,
  35. reactive
  36. } from "vue";
  37. const popupRef = ref(null)
  38. const data = reactive({
  39. right: 0,
  40. wrong: 0,
  41. })
  42. const emits = defineEmits(['check-answer', 'do-replay'])
  43. function handleRestart() {
  44. emits('do-replay')
  45. }
  46. function handleCheckAnswer() {
  47. emits('check-answer')
  48. }
  49. function showPopup(options) {
  50. data.right = options.right;
  51. data.wrong = options.wrong;
  52. popupRef.value.open();
  53. }
  54. function closePopup() {
  55. popupRef.value.close();
  56. }
  57. function handleBack() {
  58. closePopup();
  59. }
  60. defineExpose({
  61. showPopup,
  62. closePopup
  63. })
  64. </script>
  65. <style>
  66. </style>