completed-progress.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="fx-col gap-20">
  3. <view class="flex fx-bet-cen">
  4. <view class="text-2xs text-main">刷题进度</view>
  5. <view class="text-2xs">
  6. <text class="text-success">{{ completed || '-' }}</text>
  7. <text class="text-content mx-5">/</text>
  8. <text class="text-tips">{{ total || '-' }}</text>
  9. </view>
  10. </view>
  11. <mx-progress :progress="progress" class="h-20 mt-10"/>
  12. <view class="mt-40 flex gap-30">
  13. <view class="card flex-1 fx-col fx-cen-cen rounded">
  14. <view class="value font-bold">{{ total || '-' }}</view>
  15. <view class="label text-2xs">总题量</view>
  16. </view>
  17. <view class="card flex-1 fx-col fx-cen-cen rounded">
  18. <view class="value font-bold">{{ completed || '-' }}</view>
  19. <view class="label text-2xs">已刷题</view>
  20. </view>
  21. <view class="card flex-1 fx-col fx-cen-cen rounded">
  22. <view class="value font-bold">{{ accuracy || '-' }}%</view>
  23. <view class="label text-2xs">正确率</view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: "completed-progress",
  31. props: {
  32. completed: {
  33. type: Number,
  34. default: 0
  35. },
  36. total: {
  37. type: Number,
  38. default: 0
  39. },
  40. accuracy: {
  41. type: Number,
  42. default: null
  43. }
  44. },
  45. computed: {
  46. progress() {
  47. if (!this.total) return 0
  48. return this.completed / this.total
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .card {
  55. padding: 17px 0;
  56. background-color: #FBFCFF;
  57. .label {
  58. color: #a9a9a9;
  59. position: relative;
  60. &::before {
  61. content: "";
  62. position: absolute;
  63. width: 5px;
  64. height: 5px;
  65. left: -10px;
  66. top: 44%;
  67. }
  68. }
  69. }
  70. .card:nth-child(1) .label {
  71. &::before {
  72. background-color: #FBB62D;
  73. }
  74. }
  75. .card:nth-child(2) .label {
  76. &::before {
  77. background-color: #0FD296;
  78. }
  79. }
  80. .card:nth-child(3) .label {
  81. &::before {
  82. background-color: #FF5E48;
  83. }
  84. }
  85. </style>