index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <Container :title="title">
  3. <view class="p-20">
  4. <view class="center"
  5. ><uni-segmented-control
  6. :flex="false"
  7. :current="current"
  8. :values="list.map((i) => i.name)"
  9. style-type="text"
  10. @clickItem="(e) => (current = e.currentIndex)"
  11. /></view>
  12. <!-- 执业药师 -->
  13. <template v-for="(item, index) in list" :key="item.id">
  14. <view v-if="current === index" class="grid">
  15. <view v-for="i in item?.children" :key="i.id" class="flex">
  16. <view class="bg-red">
  17. <view class="text">{{ i.name }}</view>
  18. <view
  19. class="button"
  20. :class="i.status === 1 && 'plain'"
  21. @click="clickClass(i)"
  22. >{{ i.status === 1 ? "再次考试" : "开始考试" }}</view
  23. >
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. </view>
  29. </Container>
  30. </template>
  31. <script setup name="real">
  32. import { ref, onMounted } from "vue";
  33. import Container from "../../components/Container/Container.vue";
  34. import { getRoute, router } from "../../utils/router";
  35. import { arrayToTree } from "../../utils";
  36. import { request } from "../../utils/request";
  37. const title = ref("");
  38. const list = ref([]);
  39. const current = ref(0);
  40. const clickClass = (item) => {
  41. router.push({
  42. url: "/pages/real/history",
  43. params: {
  44. id: item.catalogue_id,
  45. title: item.name,
  46. },
  47. });
  48. };
  49. onMounted(async () => {
  50. const params = getRoute().params;
  51. title.value = params.title;
  52. const res = await request(
  53. "api/question_bank/question_reception/real_catalogue/get_by_year",
  54. {
  55. year: params.origin,
  56. },
  57. "POST"
  58. );
  59. list.value = arrayToTree({
  60. list: res.data,
  61. });
  62. });
  63. </script>
  64. <style scoped lang="scss">
  65. @import "@/uni.scss";
  66. .title {
  67. font-family: "PingFang SC, PingFang SC";
  68. font-weight: 700;
  69. font-size: 32rpx;
  70. color: #000000;
  71. }
  72. .center {
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. }
  77. .p-20 {
  78. display: flex;
  79. flex-direction: column;
  80. gap: 20rpx;
  81. }
  82. .grid {
  83. display: grid;
  84. grid-template-columns: repeat(3, 1fr);
  85. gap: 20rpx;
  86. }
  87. .grid-3 {
  88. display: grid;
  89. grid-template-columns: repeat(3, 1fr);
  90. gap: 20rpx;
  91. height: 100%;
  92. }
  93. .flex {
  94. display: flex;
  95. flex-direction: column;
  96. gap: 22rpx;
  97. align-items: center;
  98. justify-content: center;
  99. }
  100. .bg-red {
  101. font-family: PingFang SC, PingFang SC;
  102. font-weight: 500;
  103. font-size: 28rpx;
  104. color: #333333;
  105. display: flex;
  106. flex-direction: column;
  107. width: 214rpx;
  108. height: 282rpx;
  109. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/mrgkegM1h3pgz5taDRfQv5r1DX4DfONhIJtgJXEv.png");
  110. .text {
  111. margin-top: 32rpx;
  112. margin-left: 54rpx;
  113. margin-bottom: 126rpx;
  114. }
  115. .button {
  116. padding: 10rpx 0;
  117. width: 152rpx;
  118. border-radius: 24rpx;
  119. font-family: PingFang SC, PingFang SC;
  120. font-weight: 500;
  121. font-size: 26rpx;
  122. margin: 0 auto;
  123. }
  124. .btn-plain {
  125. color: $primary;
  126. border: 1rpx solid #3f75ff;
  127. background: transparent;
  128. border-radius: 24rpx;
  129. }
  130. }
  131. </style>