index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <Container class="body-content" title="首页" :showBack="false">
  3. <view class="home">
  4. <!-- 倒计时 -->
  5. <view class="time">
  6. <view>倒计时</view>
  7. <view>151天</view>
  8. </view>
  9. <!-- 轮播图 -->
  10. <swiper class="swiper" circular autoplay>
  11. <swiper-item v-for="(item, index) in banner_list" :key="index">
  12. <view class="swiper-item"><image class="swiper-item-image" :src="item.image_url" mode="aspectFill"></image></view>
  13. </swiper-item>
  14. </swiper>
  15. <!-- 公告 -->
  16. <view class="notice" v-if="notice_list !='' && notice_list != null">
  17. <view class="title-lable">公告</view>
  18. <view class="notice-title">{{notice_list[0]['title']}}</view>
  19. <navigator url="/pages/notice/list">
  20. <view class="notice-more">{{'更多 >'}}</view>
  21. </navigator>
  22. </view>
  23. <!-- 2025新大纲 -->
  24. <view class="new_outline">
  25. <uni-section title="基础用法" type="line">
  26. <view class="p-20">
  27. <uni-segmented-control :flex="false" :current="current" :values="items" style-type="text" @clickItem="(e) => (current = e.currentIndex)" />
  28. <!-- 执业药师 -->
  29. <template v-for="(item, index) in list" :key="item.id">
  30. <view v-if="current === index" class="grid">
  31. <view v-for="i in item?.children" class="flex" @click="clickClass(i)">
  32. <view class="bg-red"></view>
  33. <view>{{ i.name }}</view>
  34. </view>
  35. </view>
  36. </template>
  37. </view>
  38. </uni-section>
  39. </view>
  40. </view>
  41. <uni-section title="往年真题" type="line">
  42. <!-- 往年真题 -->
  43. <view class="grid-3">
  44. <view
  45. v-for="item in 7"
  46. class="flex"
  47. @click="
  48. toReal({
  49. title: '2025真题'
  50. })
  51. "
  52. >
  53. <view class="bg-red"></view>
  54. <view>执业药师{{ item }}</view>
  55. </view>
  56. </view>
  57. </uni-section>
  58. </Container>
  59. </template>
  60. <script setup>
  61. import { ref, onMounted } from 'vue';
  62. import Container from '../../components/Container/Container.vue';
  63. import { router } from '../../utils/router';
  64. import { request } from '../../utils/request';
  65. import { arrayToTree } from '../../utils';
  66. const current = ref(0);
  67. const items = ref(['', '标签2']);
  68. const list = ref([]);
  69. const banner_list = ref([]);
  70. const notice_list=ref([]);
  71. const clickClass = ({ id }) => {
  72. router.push({
  73. url: '/pages/regulations/index',
  74. params: {
  75. id
  76. }
  77. });
  78. };
  79. const toReal = (item) => {
  80. router.push({
  81. url: '/pages/real/index',
  82. params: item
  83. });
  84. };
  85. onMounted(async () => {
  86. const res = await request('api/question_bank/question_reception/chapter/get', {}, 'POST');
  87. list.value = arrayToTree({
  88. list: res.data
  89. });
  90. items.value[0] = list.value[0].name;
  91. // 首页轮播
  92. const banner_res = await request('api/question_bank/question_reception/banner/list', {page:1,limit:10}, 'POST');
  93. banner_list.value = banner_res.data.data;
  94. //系统公告
  95. const notice_res = await request('api/question_bank/question_reception/notice/list', {page:1,limit:1}, 'POST');
  96. notice_list.value = notice_res.data.data;
  97. console.log(notice_list);
  98. });
  99. </script>
  100. <style scoped lang="scss">
  101. .body-content {
  102. background: #f8f8f8;
  103. border-radius: 0rpx 0rpx 0rpx 0rpx;
  104. }
  105. .home {
  106. display: flex;
  107. flex-direction: column;
  108. gap: 20rpx;
  109. .time {
  110. display: flex;
  111. align-items: center;
  112. justify-content: center;
  113. gap: 80rpx;
  114. }
  115. .swiper {
  116. height: 320rpx;
  117. // border: 1rpx solid #000000;
  118. width: 100%;
  119. .swiper-item {
  120. display: block;
  121. height: 320rpx;
  122. line-height: 320rpx;
  123. text-align: center;
  124. // background-color: red;
  125. border-radius: 30rpx;
  126. .swiper-item-image {
  127. // border-radius: 5%;
  128. width: 100%;
  129. }
  130. }
  131. }
  132. .notice {
  133. display: flex;
  134. align-items: center;
  135. gap: 20rpx;
  136. padding-left: 26rpx;
  137. height: 72rpx;
  138. background: #ffffff;
  139. border-radius: 500rpx 500rpx 500rpx 500rpx;
  140. border:1rpx solid #f8f8f8;
  141. .title-lable {
  142. padding: 5rpx 15rpx;
  143. border-radius: 8rpx 8rpx 8rpx 8rpx;
  144. border: 1rpx solid #3f75ff;
  145. font-weight: 500;
  146. font-size: 26rpx;
  147. color: #3f75ff;
  148. line-height: 32rpx;
  149. text-align: center;
  150. font-style: normal;
  151. text-transform: none;
  152. }
  153. .notice-title{
  154. width: calc(100% - 225rpx);
  155. color: #333;
  156. font-size: 26rpx;
  157. display: -webkit-box;
  158. -webkit-box-orient: vertical;
  159. -webkit-line-clamp: 1;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. }
  163. .notice-more{
  164. font-size: 26rpx;
  165. }
  166. }
  167. .new_outline {
  168. border: 1rpx solid #000000;
  169. }
  170. }
  171. .title {
  172. font-family: 'PingFang SC, PingFang SC';
  173. font-weight: 700;
  174. font-size: 32rpx;
  175. color: #000000;
  176. }
  177. .p-20 {
  178. padding: 0 30rpx 30rpx;
  179. display: flex;
  180. flex-direction: column;
  181. gap: 20rpx;
  182. }
  183. .grid {
  184. display: grid;
  185. grid-template-columns: repeat(4, 1fr);
  186. gap: 20rpx;
  187. }
  188. .grid-3 {
  189. display: grid;
  190. grid-template-columns: repeat(3, 1fr);
  191. gap: 20rpx;
  192. height: 100%;
  193. }
  194. .flex {
  195. display: flex;
  196. flex-direction: column;
  197. gap: 20rpx;
  198. align-items: center;
  199. justify-content: center;
  200. }
  201. .bg-red {
  202. width: 149rpx;
  203. height: 80rpx;
  204. background: #d9d9d9;
  205. }
  206. </style>