index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <Container
  3. title="首页"
  4. :showBack="false"
  5. :scrollStyle="{
  6. paddingLeft: 0,
  7. paddingRight: 0,
  8. }"
  9. >
  10. <view class="home">
  11. <!-- 倒计时 -->
  12. <view class="time">
  13. <view>倒计时</view>
  14. <view>151天</view>
  15. </view>
  16. <!-- 轮播图 -->
  17. <swiper class="swiper" circular autoplay>
  18. <swiper-item>
  19. <view class="swiper-item">A</view>
  20. </swiper-item>
  21. <swiper-item>
  22. <view class="swiper-item">B</view>
  23. </swiper-item>
  24. <swiper-item>
  25. <view class="swiper-item">C</view>
  26. </swiper-item>
  27. </swiper>
  28. <!-- 公告 -->
  29. <view class="notice">
  30. <view class="title">公告</view>
  31. <view>这是公告</view>
  32. </view>
  33. <!-- 2025新大纲 -->
  34. <view class="new_outline">
  35. <uni-section title="基础用法" type="line">
  36. <view class="p-20">
  37. <uni-segmented-control
  38. :flex="false"
  39. :current="current"
  40. :values="items"
  41. style-type="text"
  42. @clickItem="(e) => (current = e.currentIndex)"
  43. />
  44. <!-- 执业药师 -->
  45. <template v-for="(item, index) in list" :key="item.id">
  46. <view v-if="current === index" class="grid">
  47. <view
  48. v-for="i in list[0]?.children"
  49. class="flex"
  50. @click="clickClass(i)"
  51. >
  52. <view class="bg-red"></view>
  53. <view> {{ i.name }} </view>
  54. </view>
  55. </view>
  56. </template>
  57. </view>
  58. </uni-section>
  59. </view>
  60. </view>
  61. <uni-section title="往年真题" type="line">
  62. <!-- 往年真题 -->
  63. <view class="grid-3">
  64. <view v-for="item in 7" class="flex">
  65. <view class="bg-red"></view>
  66. <view> 执业药师{{ item }} </view>
  67. </view>
  68. </view>
  69. </uni-section>
  70. </Container>
  71. </template>
  72. <script setup>
  73. import { ref, onMounted } from "vue";
  74. import Container from "../../components/Container/Container.vue";
  75. import { router } from "../../utils/router";
  76. import { request } from "../../utils/request";
  77. import { arrayToTree } from "../../utils";
  78. const current = ref(0);
  79. const items = ref(["标签1", "标签2"]);
  80. const list = ref([]);
  81. const clickClass = ({ id }) => {
  82. router.push({
  83. url: "/pages/regulations/index",
  84. params: {
  85. id
  86. }
  87. });
  88. };
  89. onMounted(async () => {
  90. const res = await request(
  91. "api/question_bank/question_reception/chapter/get",
  92. {},
  93. "POST"
  94. );
  95. list.value = arrayToTree({
  96. list: res.data,
  97. });
  98. items.value[0] = list.value[0].name;
  99. });
  100. </script>
  101. <style scoped lang="scss">
  102. .home {
  103. display: flex;
  104. flex-direction: column;
  105. gap: 20rpx;
  106. .time {
  107. display: flex;
  108. align-items: center;
  109. justify-content: center;
  110. gap: 80rpx;
  111. }
  112. .swiper {
  113. height: 320rpx;
  114. border: 1rpx solid #000000;
  115. width: 100%;
  116. .swiper-item {
  117. display: block;
  118. height: 320rpx;
  119. line-height: 320rpx;
  120. text-align: center;
  121. background-color: red;
  122. }
  123. }
  124. .notice {
  125. display: flex;
  126. align-items: center;
  127. gap: 20rpx;
  128. padding-left: 26rpx;
  129. }
  130. .new_outline {
  131. border: 1rpx solid #000000;
  132. }
  133. }
  134. .title {
  135. font-family: "PingFang SC, PingFang SC";
  136. font-weight: 700;
  137. font-size: 32rpx;
  138. color: #000000;
  139. }
  140. .p-20 {
  141. padding: 0 30rpx 30rpx;
  142. display: flex;
  143. flex-direction: column;
  144. gap: 20rpx;
  145. }
  146. .grid {
  147. display: grid;
  148. grid-template-columns: repeat(4, 1fr);
  149. gap: 20rpx;
  150. }
  151. .grid-3 {
  152. display: grid;
  153. grid-template-columns: repeat(3, 1fr);
  154. gap: 20rpx;
  155. height: 100%;
  156. }
  157. .flex {
  158. display: flex;
  159. flex-direction: column;
  160. gap: 20rpx;
  161. align-items: center;
  162. justify-content: center;
  163. }
  164. .bg-red {
  165. width: 149rpx;
  166. height: 80rpx;
  167. background: #d9d9d9;
  168. }
  169. </style>