history.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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" v-if="list.length">
  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 } from "vue";
  50. import Container from "../../components/Container/Container.vue";
  51. import { getRoute, router } from "../../utils/router";
  52. import { request } from "../../utils/request";
  53. import { onShow } from "@dcloudio/uni-app";
  54. const userInfo = ref({
  55. userpic: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
  56. username: "Hi, 这里是历史题库",
  57. });
  58. const list = ref([]);
  59. const onClick = () => {
  60. router.push({
  61. url: "/pages/real/exam",
  62. params: {
  63. title: "考试",
  64. id: getRoute().params.id, // 考试id
  65. },
  66. });
  67. };
  68. onShow(async () => {
  69. const res = await request(
  70. "api/question_bank/question_reception/real_topic/get_user_all_real_paper",
  71. {
  72. catalogue_id: getRoute().params.id, // 考试id
  73. }
  74. );
  75. list.value = res.data;
  76. userInfo.value = uni.getStorageSync("userInfo");
  77. });
  78. </script>
  79. <style scoped lang="scss">
  80. @import "@/uni.scss";
  81. .user {
  82. display: flex;
  83. align-items: center;
  84. gap: 20rpx;
  85. padding: 30rpx 20rpx;
  86. background: #eff4ff;
  87. border-radius: 24rpx;
  88. .avatar {
  89. border-radius: 50%;
  90. height: 96rpx;
  91. width: 96rpx;
  92. }
  93. }
  94. .exam-info {
  95. display: grid;
  96. grid-template-columns: repeat(3, 1fr);
  97. gap: 20rpx;
  98. padding: 20rpx;
  99. background: #eff4ff;
  100. border-radius: 24rpx;
  101. .item {
  102. display: flex;
  103. align-items: center;
  104. flex-direction: column;
  105. gap: 30rpx;
  106. .title {
  107. font-family: PingFang SC, PingFang SC;
  108. font-weight: 500;
  109. font-size: 28rpx;
  110. color: #999999;
  111. }
  112. }
  113. }
  114. .title-exam {
  115. font-family: PingFang SC, PingFang SC;
  116. font-weight: 500;
  117. font-size: 32rpx;
  118. color: #333333;
  119. }
  120. .exam-history {
  121. background: #fff;
  122. border-radius: 24rpx;
  123. padding: 16rpx;
  124. .i {
  125. display: flex;
  126. font-family: PingFang SC, PingFang SC;
  127. font-size: 28rpx;
  128. color: #333;
  129. align-items: center;
  130. justify-content: space-between;
  131. .score {
  132. color: $error;
  133. }
  134. }
  135. .no-laster {
  136. padding-bottom: 16rpx;
  137. margin-bottom: 8rpx;
  138. border-bottom: 1rpx solid #dddddd;
  139. }
  140. }
  141. </style>