index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 } from "vue";
  33. import { onShow } from "@dcloudio/uni-app";
  34. import Container from "../../components/Container/Container.vue";
  35. import { getRoute, router } from "../../utils/router";
  36. import { arrayToTree } from "../../utils";
  37. import { request } from "../../utils/request";
  38. const title = ref("");
  39. const list = ref([]);
  40. const current = ref(0);
  41. const clickClass = (item) => {
  42. router.push({
  43. url: "/pages/real/history",
  44. params: {
  45. id: item.catalogue_id,
  46. title: item.name,
  47. },
  48. });
  49. };
  50. onShow(async () => {
  51. const params = getRoute().params;
  52. title.value = params.title;
  53. const res = await request(
  54. "api/question_bank/question_reception/real_catalogue/get_by_year",
  55. {
  56. year: params.origin,
  57. },
  58. "POST"
  59. );
  60. list.value = arrayToTree({
  61. list: res.data,
  62. });
  63. });
  64. </script>
  65. <style scoped lang="scss">
  66. @import "@/uni.scss";
  67. .title {
  68. font-family: "PingFang SC, PingFang SC";
  69. font-weight: 700;
  70. font-size: 32rpx;
  71. color: #000000;
  72. }
  73. .center {
  74. display: flex;
  75. align-items: center;
  76. justify-content: center;
  77. }
  78. .p-20 {
  79. display: flex;
  80. flex-direction: column;
  81. gap: 20rpx;
  82. }
  83. .grid {
  84. display: grid;
  85. grid-template-columns: repeat(3, 1fr);
  86. gap: 20rpx;
  87. }
  88. .grid-3 {
  89. display: grid;
  90. grid-template-columns: repeat(3, 1fr);
  91. gap: 20rpx;
  92. height: 100%;
  93. }
  94. .flex {
  95. display: flex;
  96. flex-direction: column;
  97. gap: 22rpx;
  98. align-items: center;
  99. justify-content: center;
  100. }
  101. .bg-red {
  102. font-family: PingFang SC, PingFang SC;
  103. font-weight: 500;
  104. font-size: 28rpx;
  105. color: #333333;
  106. display: flex;
  107. flex-direction: column;
  108. width: 214rpx;
  109. height: 282rpx;
  110. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/mrgkegM1h3pgz5taDRfQv5r1DX4DfONhIJtgJXEv.png");
  111. background-size: 100% 100%;
  112. .text {
  113. margin-top: 32rpx;
  114. margin-left: 54rpx;
  115. margin-bottom: 126rpx;
  116. }
  117. .button {
  118. padding: 10rpx 0;
  119. width: 152rpx;
  120. border-radius: 24rpx;
  121. font-family: PingFang SC, PingFang SC;
  122. font-weight: 500;
  123. font-size: 26rpx;
  124. margin: 0 auto;
  125. }
  126. .btn-plain {
  127. color: $primary;
  128. border: 1rpx solid #3f75ff;
  129. background: transparent;
  130. border-radius: 24rpx;
  131. }
  132. }
  133. </style>