unitResult.vue 1.7 KB

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