index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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="item in list[0]?.children"
  49. class="flex"
  50. @click="clickClass"
  51. >
  52. <view class="bg-red"></view>
  53. <view> {{ item.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 = () => {
  82. router.push({
  83. url: "/pages/regulations/index",
  84. });
  85. };
  86. onMounted(async () => {
  87. const res = await request(
  88. "api/question_bank/question_reception/chapter/get",
  89. {},
  90. "POST"
  91. );
  92. list.value = arrayToTree({
  93. list: res.data,
  94. });
  95. items.value[0] = list.value[0].name;
  96. });
  97. </script>
  98. <style scoped lang="scss">
  99. .home {
  100. display: flex;
  101. flex-direction: column;
  102. gap: 20rpx;
  103. .time {
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. gap: 80rpx;
  108. }
  109. .swiper {
  110. height: 320rpx;
  111. border: 1rpx solid #000000;
  112. width: 100%;
  113. .swiper-item {
  114. display: block;
  115. height: 320rpx;
  116. line-height: 320rpx;
  117. text-align: center;
  118. background-color: red;
  119. }
  120. }
  121. .notice {
  122. display: flex;
  123. align-items: center;
  124. gap: 20rpx;
  125. padding-left: 26rpx;
  126. }
  127. .new_outline {
  128. border: 1rpx solid #000000;
  129. }
  130. }
  131. .title {
  132. font-family: "PingFang SC, PingFang SC";
  133. font-weight: 700;
  134. font-size: 32rpx;
  135. color: #000000;
  136. }
  137. .p-20 {
  138. padding: 0 30rpx 30rpx;
  139. display: flex;
  140. flex-direction: column;
  141. gap: 20rpx;
  142. }
  143. .grid {
  144. display: grid;
  145. grid-template-columns: repeat(4, 1fr);
  146. gap: 20rpx;
  147. }
  148. .grid-3 {
  149. display: grid;
  150. grid-template-columns: repeat(3, 1fr);
  151. gap: 20rpx;
  152. height: 100%;
  153. }
  154. .flex {
  155. display: flex;
  156. flex-direction: column;
  157. gap: 20rpx;
  158. align-items: center;
  159. justify-content: center;
  160. }
  161. .bg-red {
  162. width: 149rpx;
  163. height: 80rpx;
  164. background: #d9d9d9;
  165. }
  166. </style>