history.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. <template v-if="list.length">
  31. <view class="title-exam">考试记录</view>
  32. <view class="exam-history">
  33. <view
  34. class="i"
  35. :class="index !== list.length - 1 && 'no-laster'"
  36. v-for="(item, index) in list"
  37. :id="item.id"
  38. @click="
  39. onClick({
  40. id: item.id,
  41. catalogue_id: item.catalogue_id,
  42. })
  43. "
  44. >
  45. <view>{{ util.timestampToString_day(item.begin_time) }}</view>
  46. <view>{{ item.use_time_str?.split(":")?.[0] }}分钟</view>
  47. <view>{{ item.complete }}/100题</view>
  48. <view class="score"
  49. >{{ item.score }}分<uni-icons type="right"
  50. /></view>
  51. </view>
  52. </view>
  53. </template>
  54. <template #footer>
  55. <button @click="onClick">开始考试</button>
  56. </template>
  57. </Container>
  58. </template>
  59. <script setup name="history">
  60. import { ref } from "vue";
  61. import Container from "../../components/Container/Container.vue";
  62. import { getRoute, router } from "../../utils/router";
  63. import { request } from "../../utils/request";
  64. import { onShow } from "@dcloudio/uni-app";
  65. import util from "@/utils/common";
  66. const userInfo = ref({
  67. userpic: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
  68. username: "Hi, 这里是历史题库",
  69. });
  70. const list = ref([]);
  71. const onClick = (data = {}) => {
  72. router.push({
  73. url: "/pages/real/exam",
  74. params: {
  75. title: "考试",
  76. id: getRoute().params.id, // 考试id
  77. ...data,
  78. },
  79. });
  80. };
  81. onShow(async () => {
  82. const res = await request(
  83. "api/question_bank/question_reception/real_topic/get_user_all_real_paper",
  84. {
  85. catalogue_id: getRoute().params.id, // 考试id
  86. }
  87. );
  88. list.value = res.data;
  89. userInfo.value = uni.getStorageSync("userInfo");
  90. });
  91. </script>
  92. <style scoped lang="scss">
  93. @import "@/uni.scss";
  94. .user {
  95. display: flex;
  96. align-items: center;
  97. gap: 20rpx;
  98. padding: 30rpx 20rpx;
  99. background: #eff4ff;
  100. border-radius: 24rpx;
  101. .avatar {
  102. border-radius: 50%;
  103. height: 96rpx;
  104. width: 96rpx;
  105. }
  106. }
  107. .exam-info {
  108. display: grid;
  109. grid-template-columns: repeat(3, 1fr);
  110. gap: 20rpx;
  111. padding: 20rpx;
  112. background: #eff4ff;
  113. border-radius: 24rpx;
  114. .item {
  115. display: flex;
  116. align-items: center;
  117. flex-direction: column;
  118. gap: 30rpx;
  119. .title {
  120. font-family: PingFang SC, PingFang SC;
  121. font-weight: 500;
  122. font-size: 28rpx;
  123. color: #999999;
  124. }
  125. }
  126. }
  127. .title-exam {
  128. font-family: PingFang SC, PingFang SC;
  129. font-weight: 500;
  130. font-size: 32rpx;
  131. color: #333333;
  132. margin: 32rpx 0 16rpx;
  133. }
  134. .exam-history {
  135. background: #fff;
  136. border-radius: 24rpx;
  137. padding: 16rpx;
  138. .i {
  139. display: flex;
  140. font-family: PingFang SC, PingFang SC;
  141. font-size: 28rpx;
  142. color: #333;
  143. align-items: center;
  144. justify-content: space-between;
  145. .score {
  146. color: $error;
  147. }
  148. }
  149. .no-laster {
  150. padding-bottom: 16rpx;
  151. margin-bottom: 8rpx;
  152. border-bottom: 1rpx solid #dddddd;
  153. }
  154. }
  155. </style>