yearExam.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <script setup>
  2. import Container from "../../components/Container/Container.vue";
  3. import { ref } from "vue";
  4. import { request } from "../../utils/request";
  5. import { router } from "../../utils/router";
  6. import { onShow } from "@dcloudio/uni-app";
  7. const rightList = ref([]);
  8. onShow(async () => {
  9. // 获取历年真题
  10. const rightListRes = await request(
  11. "api/question_bank/question_reception/real_catalogue/get_year",
  12. {},
  13. "post"
  14. );
  15. rightList.value = rightListRes.data.map((i) => {
  16. const newItem = {
  17. name: i + "年",
  18. originName: i,
  19. };
  20. if (i.includes("(")) {
  21. // 2022(1)变成 2022年(一)
  22. newItem.name = i.replace(/\((\d+)\)/g, (text, number) => {
  23. const chineseNumber = [
  24. "一",
  25. "二",
  26. "三",
  27. "四",
  28. "五",
  29. "六",
  30. "七",
  31. "八",
  32. "九",
  33. ];
  34. return `年(${chineseNumber[number - 1]})`;
  35. });
  36. }
  37. return newItem;
  38. });
  39. });
  40. const toReal = (item) => {
  41. router.push({
  42. url: "/pages/real/index",
  43. params: item,
  44. });
  45. };
  46. </script>
  47. <template>
  48. <Container title="往年真题">
  49. <view class="p-20">
  50. <view class="grid-3">
  51. <view
  52. v-for="item in rightList"
  53. :key="item.originName"
  54. class="flex"
  55. @click="
  56. toReal({
  57. title: item.name + '真题',
  58. origin: item.originName,
  59. })
  60. "
  61. >
  62. <view class="bg-red">
  63. <view class="text">{{ item.name }}真题</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </Container>
  69. </template>
  70. <style scoped lang="scss">
  71. // https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/kPFuCa2RDyoUXbiCzj0MOwcCm7XowJcWqNqs18oB.png 往年真题
  72. // https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/WsEF9w5bs7Gknnf3vUV3EMR0WxqleESpYSVxZtkn.png 高频考点
  73. @import "@/uni.scss";
  74. .p-20 {
  75. display: flex;
  76. flex-direction: column;
  77. gap: 20rpx;
  78. }
  79. .grid {
  80. display: grid;
  81. grid-template-columns: repeat(4, 1fr);
  82. background-color: #ffffff;
  83. padding: 24rpx;
  84. gap: 16rpx;
  85. border-radius: 16rpx;
  86. }
  87. .grid-3 {
  88. display: grid;
  89. grid-template-columns: repeat(3, 1fr);
  90. background-color: #ffffff;
  91. padding: 24rpx;
  92. gap: 16rpx;
  93. border-radius: 16rpx;
  94. height: 100%;
  95. margin-bottom: 20rpx;
  96. }
  97. .flex {
  98. display: flex;
  99. flex-direction: column;
  100. gap: 20rpx;
  101. align-items: center;
  102. justify-content: center;
  103. }
  104. .bg-red {
  105. width: 191.07rpx;
  106. height: 179.61rpx;
  107. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/WmhlbORF2q8A62Ytg1RVac8AYSGPkf7F2pEY6jQP.png")
  108. no-repeat;
  109. background-size: cover;
  110. display: flex;
  111. justify-content: center;
  112. .text {
  113. font-family: jiangxizhuokai, jiangxizhuokai;
  114. font-weight: bold;
  115. font-size: 27rpx;
  116. color: #3f75ff;
  117. text-shadow: 0px 2px 4px #bdcfff;
  118. text-align: left;
  119. font-style: normal;
  120. text-transform: none;
  121. margin-top: 16rpx;
  122. width: 95rpx;
  123. height: 70rpx;
  124. }
  125. }
  126. </style>