history.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <Container title="往年真题" bgColor="#f8f8f8">
  3. <view class="user">
  4. <image
  5. class="avatar"
  6. :src="userInfo.userpic"
  7. width="40"
  8. height="40"
  9. v-if="userInfo.userpic"
  10. />
  11. <view class="name">{{ userInfo.username }}</view>
  12. </view>
  13. <view class="exam-info">
  14. <view class="item">
  15. <view class="score">100分</view>
  16. <view class="title">总分</view>
  17. </view>
  18. <view class="item">
  19. <view class="score">100题</view>
  20. <view class="title">题量</view>
  21. </view>
  22. <view class="item">
  23. <view class="score">150分钟</view>
  24. <view class="title">时长</view>
  25. </view>
  26. </view>
  27. <view class="tip"
  28. >注:题型可能会含有单选题、多选题、配伍题、综合分析题;请注意考试时长,无论答题是否完全,到时自动交卷。</view
  29. >
  30. <view class="title-exam">考试记录</view>
  31. <view class="exam-history">
  32. <view
  33. class="i"
  34. :class="index !== list.length - 1 && 'no-laster'"
  35. v-for="(item, index) in list"
  36. >
  37. <view>2025-05-31</view>
  38. <view>90分钟</view>
  39. <view>50/100题</view>
  40. <view class="score">100分<uni-icons type="right" /></view>
  41. </view>
  42. </view>
  43. <template #footer>
  44. <button @click="onClick">开始考试</button>
  45. </template>
  46. </Container>
  47. </template>
  48. <script setup name="history">
  49. import { ref, onMounted } from "vue";
  50. import Container from "../../components/Container/Container.vue";
  51. import { getRoute, router } from "../../utils/router";
  52. import { request } from "../../utils/request";
  53. const userInfo = ref({
  54. userpic: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
  55. username: "Hi, 这里是历史题库",
  56. });
  57. const list = ref([]);
  58. const onClick = () => {
  59. router.push({
  60. url: "/pages/real/exam",
  61. params: {
  62. title: "考试",
  63. id: getRoute().params.id, // 考试id
  64. },
  65. });
  66. };
  67. onMounted(async () => {
  68. const res = await request(
  69. "api/question_bank/question_reception/real_topic/get_user_all_real_paper",
  70. {
  71. catalogue_id: getRoute().params.id, // 考试id
  72. }
  73. );
  74. list.value = res.data;
  75. userInfo.value = uni.getStorageSync("userInfo");
  76. });
  77. </script>
  78. <style scoped lang="scss">
  79. @import "@/uni.scss";
  80. .user {
  81. display: flex;
  82. align-items: center;
  83. gap: 20rpx;
  84. padding: 30rpx 20rpx;
  85. background: #eff4ff;
  86. border-radius: 24rpx;
  87. .avatar {
  88. border-radius: 50%;
  89. height: 96rpx;
  90. width: 96rpx;
  91. }
  92. }
  93. .exam-info {
  94. display: grid;
  95. grid-template-columns: repeat(3, 1fr);
  96. gap: 20rpx;
  97. padding: 20rpx;
  98. background: #eff4ff;
  99. border-radius: 24rpx;
  100. .item {
  101. display: flex;
  102. align-items: center;
  103. flex-direction: column;
  104. gap: 30rpx;
  105. .title {
  106. font-family: PingFang SC, PingFang SC;
  107. font-weight: 500;
  108. font-size: 28rpx;
  109. color: #999999;
  110. }
  111. }
  112. }
  113. .title-exam {
  114. font-family: PingFang SC, PingFang SC;
  115. font-weight: 500;
  116. font-size: 32rpx;
  117. color: #333333;
  118. }
  119. .exam-history {
  120. background: #fff;
  121. border-radius: 24rpx;
  122. padding: 16rpx;
  123. .i {
  124. display: flex;
  125. font-family: PingFang SC, PingFang SC;
  126. font-size: 28rpx;
  127. color: #333;
  128. align-items: center;
  129. justify-content: space-between;
  130. .score {
  131. color: $error;
  132. }
  133. }
  134. .no-laster {
  135. padding-bottom: 16rpx;
  136. margin-bottom: 8rpx;
  137. border-bottom: 1rpx solid #dddddd;
  138. }
  139. }
  140. </style>