history.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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">{{t.total_score}}分</view>
  16. <view class="title">总分</view>
  17. </view>
  18. <view class="item">
  19. <view class="score">{{t.topic_num}}题</view>
  20. <view class="title">题量</view>
  21. </view>
  22. <view class="item">
  23. <view class="score">{{t.exam_time}}分钟</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 }}分钟</view>
  47. <view>{{ item.complete }}/{{ item.total_real_topic }}题</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 t = ref({
  71. total_score: 0,
  72. topic_num: 0,
  73. total_score: 0,
  74. })
  75. const list = ref([]);
  76. const onClick = (data = {}) => {
  77. router.push({
  78. url: "/pages/real/exam",
  79. params: {
  80. title: "考试",
  81. id: getRoute().params.id, // 考试id
  82. ...data,
  83. },
  84. });
  85. };
  86. onShow(async () => {
  87. const res = await request(
  88. "api/question_bank/question_reception/real_topic/get_user_all_real_paper",
  89. {
  90. catalogue_id: getRoute().params.id, // 考试id
  91. }
  92. );
  93. const r = await request(
  94. "api/question_bank/question_reception/real_topic/get_real_paper_info",
  95. {
  96. catalogue_id: getRoute().params.id, // 考试id
  97. }
  98. );
  99. t.value = r.data
  100. list.value = res.data;
  101. userInfo.value = uni.getStorageSync("userInfo");
  102. });
  103. </script>
  104. <style scoped lang="scss">
  105. @import "@/uni.scss";
  106. .user {
  107. display: flex;
  108. align-items: center;
  109. gap: 20rpx;
  110. padding: 30rpx 20rpx;
  111. background: #eff4ff;
  112. border-radius: 24rpx;
  113. .avatar {
  114. border-radius: 50%;
  115. height: 96rpx;
  116. width: 96rpx;
  117. }
  118. }
  119. .exam-info {
  120. display: grid;
  121. grid-template-columns: repeat(3, 1fr);
  122. gap: 20rpx;
  123. padding: 20rpx;
  124. background: #eff4ff;
  125. border-radius: 24rpx;
  126. .item {
  127. display: flex;
  128. align-items: center;
  129. flex-direction: column;
  130. gap: 30rpx;
  131. .title {
  132. font-family: PingFang SC, PingFang SC;
  133. font-weight: 500;
  134. font-size: 28rpx;
  135. color: #999999;
  136. }
  137. }
  138. }
  139. .title-exam {
  140. font-family: PingFang SC, PingFang SC;
  141. font-weight: 500;
  142. font-size: 32rpx;
  143. color: #333333;
  144. margin: 32rpx 0 16rpx;
  145. }
  146. .exam-history {
  147. background: #fff;
  148. border-radius: 24rpx;
  149. padding: 16rpx;
  150. .i {
  151. display: flex;
  152. font-family: PingFang SC, PingFang SC;
  153. font-size: 28rpx;
  154. color: #333;
  155. align-items: center;
  156. justify-content: space-between;
  157. .score {
  158. color: $error;
  159. }
  160. }
  161. .no-laster {
  162. padding-bottom: 16rpx;
  163. margin-bottom: 8rpx;
  164. border-bottom: 1rpx solid #dddddd;
  165. }
  166. }
  167. </style>