index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <Container
  3. class="body-content"
  4. title="首页"
  5. bgColor="#F8F8F8"
  6. :showBack="false"
  7. >
  8. <view class="home">
  9. <!-- 倒计时 -->
  10. <view class="time">
  11. <view>倒计时</view>
  12. <view class="tiem-item">1</view>
  13. <view class="tiem-item">0</view>
  14. <view class="tiem-item">0</view>
  15. <view>天</view>
  16. </view>
  17. <!-- 轮播图 -->
  18. <swiper class="swiper" circular autoplay>
  19. <swiper-item v-for="(item, index) in banner_list" :key="index">
  20. <view class="swiper-item"
  21. ><image
  22. class="swiper-item-image"
  23. :src="item.image_url"
  24. mode="aspectFill"
  25. ></image
  26. ></view>
  27. </swiper-item>
  28. </swiper>
  29. <!-- 公告 -->
  30. <view class="notice" v-if="notice_list != '' && notice_list != null">
  31. <view class="title-lable">公告</view>
  32. <view class="notice-title">{{ notice_list[0]["title"] }}</view>
  33. <navigator url="/pages/notice/list">
  34. <view class="notice-more">{{ "更多 >" }}</view>
  35. </navigator>
  36. </view>
  37. <!-- 2025新大纲 -->
  38. <view class="new_outline">
  39. <uni-section title="基础用法" type="line">
  40. <view class="p-20">
  41. <uni-segmented-control
  42. :flex="false"
  43. :current="current"
  44. :values="list.map((item) => item.name)"
  45. style-type="text"
  46. @clickItem="(e) => (current = e.currentIndex)"
  47. />
  48. <!-- 执业药师 -->
  49. <template v-for="(item, index) in list" :key="item.id">
  50. <view v-if="current === index" class="grid">
  51. <view
  52. v-for="i in item?.children"
  53. class="flex"
  54. @click="clickClass(i)"
  55. >
  56. <image :src="i.chapter_image_url" class="img_small"></image>
  57. <view>{{ i.name }}</view>
  58. </view>
  59. </view>
  60. </template>
  61. </view>
  62. </uni-section>
  63. </view>
  64. <view class="p-20">
  65. <uni-section title="往年真题" type="line">
  66. <!-- 往年真题 -->
  67. <view class="grid-3">
  68. <view
  69. v-for="item in 7"
  70. class="flex"
  71. @click="
  72. toReal({
  73. title: '2025真题',
  74. })
  75. "
  76. >
  77. <view class="bg-red">
  78. <view class="text">执业药师{{ item }}</view>
  79. </view>
  80. </view>
  81. </view>
  82. </uni-section>
  83. </view>
  84. </view>
  85. </Container>
  86. </template>
  87. <script setup>
  88. import { ref, onMounted } from "vue";
  89. import Container from "../../components/Container/Container.vue";
  90. import { router } from "../../utils/router";
  91. import { request } from "../../utils/request";
  92. import { arrayToTree } from "../../utils";
  93. const current = ref(0);
  94. const list = ref([]);
  95. const banner_list = ref([]);
  96. const notice_list = ref([]);
  97. const clickClass = ({ id }) => {
  98. router.push({
  99. url: "/pages/regulations/index",
  100. params: {
  101. id,
  102. },
  103. });
  104. };
  105. const toReal = (item) => {
  106. router.push({
  107. url: "/pages/real/index",
  108. params: item,
  109. });
  110. };
  111. onMounted(async () => {
  112. const res = await request(
  113. "api/question_bank/question_reception/chapter/get",
  114. {},
  115. "POST"
  116. );
  117. list.value = arrayToTree({
  118. list: res.data,
  119. });
  120. console.log(list.value);
  121. // 首页轮播
  122. const banner_res = await request(
  123. "api/question_bank/question_reception/banner/list",
  124. { page: 1, limit: 10 },
  125. "POST"
  126. );
  127. banner_list.value = banner_res.data.data;
  128. //系统公告
  129. const notice_res = await request(
  130. "api/question_bank/question_reception/notice/list",
  131. { page: 1, limit: 1 },
  132. "POST"
  133. );
  134. notice_list.value = notice_res.data.data;
  135. console.log(notice_list);
  136. });
  137. </script>
  138. <style scoped lang="scss">
  139. @import "@/uni.scss";
  140. .img_small {
  141. width: 112rpx;
  142. height: 112rpx;
  143. }
  144. .body-content {
  145. background: #f8f8f8;
  146. border-radius: 0rpx 0rpx 0rpx 0rpx;
  147. }
  148. .home {
  149. display: flex;
  150. flex-direction: column;
  151. gap: 20rpx;
  152. .time {
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. font-family: PingFang SC, PingFang SC;
  157. font-weight: 500;
  158. font-size: 24rpx;
  159. color: #333333;
  160. gap: 8rpx;
  161. .tiem-item {
  162. width: 24rpx;
  163. height: 34rpx;
  164. background: #ff3c3c;
  165. border-radius: 2rpx 2rpx 2rpx 2rpx;
  166. font-family: PingFang SC, PingFang SC;
  167. font-weight: 500;
  168. font-size: 24rpx;
  169. color: #ffffff;
  170. display: flex;
  171. align-items: center;
  172. justify-content: center;
  173. }
  174. }
  175. .swiper {
  176. height: 320rpx;
  177. // border: 1rpx solid #000000;
  178. width: 100%;
  179. .swiper-item {
  180. display: block;
  181. height: 320rpx;
  182. line-height: 320rpx;
  183. text-align: center;
  184. // background-color: red;
  185. border-radius: 30rpx;
  186. .swiper-item-image {
  187. // border-radius: 5%;
  188. width: 100%;
  189. }
  190. }
  191. }
  192. .notice {
  193. display: flex;
  194. align-items: center;
  195. gap: 20rpx;
  196. padding-left: 26rpx;
  197. height: 72rpx;
  198. background: #ffffff;
  199. border-radius: 500rpx 500rpx 500rpx 500rpx;
  200. border: 1rpx solid #f8f8f8;
  201. .title-lable {
  202. padding: 5rpx 15rpx;
  203. border-radius: 8rpx 8rpx 8rpx 8rpx;
  204. border: 1rpx solid #3f75ff;
  205. font-weight: 500;
  206. font-size: 26rpx;
  207. color: #3f75ff;
  208. line-height: 32rpx;
  209. text-align: center;
  210. font-style: normal;
  211. text-transform: none;
  212. }
  213. .notice-title {
  214. width: calc(100% - 225rpx);
  215. color: #333;
  216. font-size: 26rpx;
  217. display: -webkit-box;
  218. -webkit-box-orient: vertical;
  219. -webkit-line-clamp: 1;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. }
  223. .notice-more {
  224. font-size: 26rpx;
  225. }
  226. }
  227. }
  228. .title {
  229. font-family: "PingFang SC, PingFang SC";
  230. font-weight: 700;
  231. font-size: 32rpx;
  232. color: #000000;
  233. }
  234. .p-20 {
  235. display: flex;
  236. flex-direction: column;
  237. gap: 20rpx;
  238. }
  239. .grid {
  240. display: grid;
  241. grid-template-columns: repeat(4, 1fr);
  242. background-color: #ffffff;
  243. padding: 24rpx;
  244. gap: 16rpx;
  245. border-radius: 16rpx;
  246. }
  247. .grid-3 {
  248. display: grid;
  249. grid-template-columns: repeat(3, 1fr);
  250. background-color: #ffffff;
  251. padding: 24rpx;
  252. gap: 16rpx;
  253. border-radius: 16rpx;
  254. height: 100%;
  255. }
  256. .flex {
  257. display: flex;
  258. flex-direction: column;
  259. gap: 20rpx;
  260. align-items: center;
  261. justify-content: center;
  262. }
  263. .bg-red {
  264. width: 191.07rpx;
  265. height: 179.61rpx;
  266. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/WmhlbORF2q8A62Ytg1RVac8AYSGPkf7F2pEY6jQP.png")
  267. no-repeat;
  268. background-size: cover;
  269. display: flex;
  270. justify-content: center;
  271. .text {
  272. font-family: jiangxizhuokai, jiangxizhuokai;
  273. font-weight: bold;
  274. font-size: 27rpx;
  275. color: #3f75ff;
  276. text-shadow: 0px 2px 4px #bdcfff;
  277. text-align: left;
  278. font-style: normal;
  279. text-transform: none;
  280. margin-top: 16rpx;
  281. width: 95rpx;
  282. height: 70rpx;
  283. }
  284. }
  285. </style>