Browse Source

style: 修改首页样式

huangziyang 1 week ago
parent
commit
7e4f2bc921

+ 5 - 6
App.vue

@@ -1,9 +1,7 @@
 <script>
 export default {
   onLaunch: function () {
-    console.warn(
-      "当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!"
-    );
+
     console.log("App Launch");
   },
   onShow: function () {
@@ -19,9 +17,10 @@ export default {
 @import "@/uni.scss";
 /*每个页面公共css */
 @import "@/uni_modules/uni-scss/index.scss";
-/* #ifndef APP-NVUE */
-@import "@/static/customicons.css";
-/* #endif */
+@font-face {
+  font-family: PingFang SC;
+  src: url('./static/PingFangBold.ttf');
+}
 button {
   background-color: $primary;
   font-weight: 500;

+ 2 - 2
components/Container/Container.vue

@@ -150,7 +150,7 @@ defineExpose({
       class="title"
       :style="{
         paddingTop: `${safeArea.top}px`,
-        background: bgColor,
+        background: 'transparent',
       }"
       v-if="showTitle"
     >
@@ -202,7 +202,7 @@ defineExpose({
       class="bottom-button"
       :style="{
         width: `${safeArea.width}px`,
-        background: bgColor,
+        background: 'transparent',
       }"
     >
       <slot name="footer" :footer-height="footerHeight" />

+ 1 - 1
components/Tree/Tree.vue

@@ -116,7 +116,7 @@ const emit = defineEmits(["onChnage", "onClickButton"]);
     font-family: "PingFang SC, PingFang SC";
     font-weight: 500;
     font-size: 28rpx;
-    color: #002fa7;
+    color: $primary;
     border-radius: 4rpx;
   }
 

+ 261 - 180
pages/index/index.vue

@@ -1,224 +1,305 @@
 <template>
-	<Container class="body-content" title="首页" :showBack="false">
-		<view class="home">
-			<!-- 倒计时 -->
-			<view class="time">
-				<view>倒计时</view>
-				<view>151天</view>
-			</view>
-			<!-- 轮播图 -->
-			<swiper class="swiper" circular autoplay>
-				<swiper-item v-for="(item, index) in banner_list" :key="index">
-					<view class="swiper-item"><image class="swiper-item-image" :src="item.image_url" mode="aspectFill"></image></view>
-				</swiper-item>
-			</swiper>
-			<!-- 公告 -->
-			<view class="notice" v-if="notice_list !='' && notice_list != null">
-				<view class="title-lable">公告</view>
-				<view class="notice-title">{{notice_list[0]['title']}}</view>
-				<navigator url="/pages/notice/list">
-					<view class="notice-more">{{'更多 >'}}</view>
-				</navigator>
-			</view>
-			<!-- 2025新大纲 -->
-			<view class="new_outline">
-				<uni-section title="基础用法" type="line">
-					<view class="p-20">
-						<uni-segmented-control :flex="false" :current="current" :values="items" style-type="text" @clickItem="(e) => (current = e.currentIndex)" />
-						<!-- 执业药师 -->
-						<template v-for="(item, index) in list" :key="item.id">
-							<view v-if="current === index" class="grid">
-								<view v-for="i in item?.children" class="flex" @click="clickClass(i)">
-									<view class="bg-red"></view>
-									<view>{{ i.name }}</view>
-								</view>
-							</view>
-						</template>
-					</view>
-				</uni-section>
-			</view>
-		</view>
-		<uni-section title="往年真题" type="line">
-			<!-- 往年真题 -->
-			<view class="grid-3">
-				<view
-					v-for="item in 7"
-					class="flex"
-					@click="
-						toReal({
-							title: '2025真题'
-						})
-					"
-				>
-					<view class="bg-red"></view>
-					<view>执业药师{{ item }}</view>
-				</view>
-			</view>
-		</uni-section>
-	</Container>
+  <Container
+    class="body-content"
+    title="首页"
+    bgColor="#F8F8F8"
+    :showBack="false"
+  >
+    <view class="home">
+      <!-- 倒计时 -->
+      <view class="time">
+        <view>倒计时</view>
+        <view class="tiem-item">1</view>
+        <view class="tiem-item">0</view>
+        <view class="tiem-item">0</view>
+        <view>天</view>
+      </view>
+      <!-- 轮播图 -->
+      <swiper class="swiper" circular autoplay>
+        <swiper-item v-for="(item, index) in banner_list" :key="index">
+          <view class="swiper-item"
+            ><image
+              class="swiper-item-image"
+              :src="item.image_url"
+              mode="aspectFill"
+            ></image
+          ></view>
+        </swiper-item>
+      </swiper>
+      <!-- 公告 -->
+      <view class="notice" v-if="notice_list != '' && notice_list != null">
+        <view class="title-lable">公告</view>
+        <view class="notice-title">{{ notice_list[0]["title"] }}</view>
+        <navigator url="/pages/notice/list">
+          <view class="notice-more">{{ "更多 >" }}</view>
+        </navigator>
+      </view>
+      <!-- 2025新大纲 -->
+      <view class="new_outline">
+        <uni-section title="基础用法" type="line">
+          <view class="p-20">
+            <uni-segmented-control
+              :flex="false"
+              :current="current"
+              :values="list.map((item) => item.name)"
+              style-type="text"
+              @clickItem="(e) => (current = e.currentIndex)"
+            />
+            <!-- 执业药师 -->
+            <template v-for="(item, index) in list" :key="item.id">
+              <view v-if="current === index" class="grid">
+                <view
+                  v-for="i in item?.children"
+                  class="flex"
+                  @click="clickClass(i)"
+                >
+                  <image :src="i.chapter_image_url" class="img_small"></image>
+                  <view>{{ i.name }}</view>
+                </view>
+              </view>
+            </template>
+          </view>
+        </uni-section>
+      </view>
+      <view class="p-20">
+        <uni-section title="往年真题" type="line">
+          <!-- 往年真题 -->
+          <view class="grid-3">
+            <view
+              v-for="item in 7"
+              class="flex"
+              @click="
+                toReal({
+                  title: '2025真题',
+                })
+              "
+            >
+              <view class="bg-red">
+                <view class="text">执业药师{{ item }}</view>
+              </view>
+            </view>
+          </view>
+        </uni-section>
+      </view>
+    </view>
+  </Container>
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue';
+import { ref, onMounted } from "vue";
 
-import Container from '../../components/Container/Container.vue';
-import { router } from '../../utils/router';
-import { request } from '../../utils/request';
-import { arrayToTree } from '../../utils';
+import Container from "../../components/Container/Container.vue";
+import { router } from "../../utils/router";
+import { request } from "../../utils/request";
+import { arrayToTree } from "../../utils";
 
 const current = ref(0);
-const items = ref(['', '标签2']);
 const list = ref([]);
 const banner_list = ref([]);
-const notice_list=ref([]);
+const notice_list = ref([]);
 
 const clickClass = ({ id }) => {
-	router.push({
-		url: '/pages/regulations/index',
-		params: {
-			id
-		}
-	});
+  router.push({
+    url: "/pages/regulations/index",
+    params: {
+      id,
+    },
+  });
 };
 
 const toReal = (item) => {
-	router.push({
-		url: '/pages/real/index',
-		params: item
-	});
+  router.push({
+    url: "/pages/real/index",
+    params: item,
+  });
 };
 
 onMounted(async () => {
-	const res = await request('api/question_bank/question_reception/chapter/get', {}, 'POST');
-	list.value = arrayToTree({
-		list: res.data
-	});
-	items.value[0] = list.value[0].name;
-
-	// 首页轮播
-	const banner_res = await request('api/question_bank/question_reception/banner/list', {page:1,limit:10}, 'POST');
-	banner_list.value = banner_res.data.data;
-	//系统公告
-	const notice_res = await request('api/question_bank/question_reception/notice/list', {page:1,limit:1}, 'POST');
-	notice_list.value = notice_res.data.data;
-	console.log(notice_list);
+  const res = await request(
+    "api/question_bank/question_reception/chapter/get",
+    {},
+    "POST"
+  );
+  list.value = arrayToTree({
+    list: res.data,
+  });
+
+  console.log(list.value);
+
+  // 首页轮播
+  const banner_res = await request(
+    "api/question_bank/question_reception/banner/list",
+    { page: 1, limit: 10 },
+    "POST"
+  );
+  banner_list.value = banner_res.data.data;
+  //系统公告
+  const notice_res = await request(
+    "api/question_bank/question_reception/notice/list",
+    { page: 1, limit: 1 },
+    "POST"
+  );
+  notice_list.value = notice_res.data.data;
+  console.log(notice_list);
 });
 </script>
 
 <style scoped lang="scss">
+@import "@/uni.scss";
+.img_small {
+  width: 112rpx;
+  height: 112rpx;
+}
 .body-content {
-	background: #f8f8f8;
-	border-radius: 0rpx 0rpx 0rpx 0rpx;
+  background: #f8f8f8;
+  border-radius: 0rpx 0rpx 0rpx 0rpx;
 }
 .home {
-	display: flex;
-	flex-direction: column;
-	gap: 20rpx;
-
-	.time {
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		gap: 80rpx;
-	}
-
-	.swiper {
-		height: 320rpx;
-		// border: 1rpx solid #000000;
-		width: 100%;
-		.swiper-item {
-			display: block;
-			height: 320rpx;
-			line-height: 320rpx;
-			text-align: center;
-			// background-color: red;
-			border-radius: 30rpx;
-			.swiper-item-image {
-				// border-radius: 5%;
-				width: 100%;
-			}
-		}
-	}
-
-	.notice {
-		display: flex;
-		align-items: center;
-		gap: 20rpx;
-		padding-left: 26rpx;
-		height: 72rpx;
-		background: #ffffff;
-		border-radius: 500rpx 500rpx 500rpx 500rpx;
-		border:1rpx solid #f8f8f8;
-		.title-lable {
-			padding: 5rpx 15rpx;
-			border-radius: 8rpx 8rpx 8rpx 8rpx;
-			border: 1rpx solid #3f75ff;
-			font-weight: 500;
-			font-size: 26rpx;
-			color: #3f75ff;
-			line-height: 32rpx;
-			text-align: center;
-			font-style: normal;
-			text-transform: none;
-		}
-		.notice-title{
-			width: calc(100% - 225rpx);
-			color: #333;
-			font-size: 26rpx;
-			display: -webkit-box;
-			-webkit-box-orient: vertical;
-			-webkit-line-clamp: 1;
-			overflow: hidden;
-			text-overflow: ellipsis;
-		}
-		.notice-more{
-			font-size: 26rpx;
-		}
-	}
-
-	.new_outline {
-		border: 1rpx solid #000000;
-	}
+  display: flex;
+  flex-direction: column;
+  gap: 20rpx;
+
+  .time {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 500;
+    font-size: 24rpx;
+    color: #333333;
+    gap: 8rpx;
+
+    .tiem-item {
+      width: 24rpx;
+      height: 34rpx;
+      background: #ff3c3c;
+      border-radius: 2rpx 2rpx 2rpx 2rpx;
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 500;
+      font-size: 24rpx;
+      color: #ffffff;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+    }
+  }
+
+  .swiper {
+    height: 320rpx;
+    // border: 1rpx solid #000000;
+    width: 100%;
+    .swiper-item {
+      display: block;
+      height: 320rpx;
+      line-height: 320rpx;
+      text-align: center;
+      // background-color: red;
+      border-radius: 30rpx;
+      .swiper-item-image {
+        // border-radius: 5%;
+        width: 100%;
+      }
+    }
+  }
+
+  .notice {
+    display: flex;
+    align-items: center;
+    gap: 20rpx;
+    padding-left: 26rpx;
+    height: 72rpx;
+    background: #ffffff;
+    border-radius: 500rpx 500rpx 500rpx 500rpx;
+    border: 1rpx solid #f8f8f8;
+    .title-lable {
+      padding: 5rpx 15rpx;
+      border-radius: 8rpx 8rpx 8rpx 8rpx;
+      border: 1rpx solid #3f75ff;
+      font-weight: 500;
+      font-size: 26rpx;
+      color: #3f75ff;
+      line-height: 32rpx;
+      text-align: center;
+      font-style: normal;
+      text-transform: none;
+    }
+    .notice-title {
+      width: calc(100% - 225rpx);
+      color: #333;
+      font-size: 26rpx;
+      display: -webkit-box;
+      -webkit-box-orient: vertical;
+      -webkit-line-clamp: 1;
+      overflow: hidden;
+      text-overflow: ellipsis;
+    }
+    .notice-more {
+      font-size: 26rpx;
+    }
+  }
 }
 
 .title {
-	font-family: 'PingFang SC, PingFang SC';
-	font-weight: 700;
-	font-size: 32rpx;
-	color: #000000;
+  font-family: "PingFang SC, PingFang SC";
+  font-weight: 700;
+  font-size: 32rpx;
+  color: #000000;
 }
 
 .p-20 {
-	padding: 0 30rpx 30rpx;
-	display: flex;
-	flex-direction: column;
-	gap: 20rpx;
+  display: flex;
+  flex-direction: column;
+  gap: 20rpx;
 }
 
 .grid {
-	display: grid;
-	grid-template-columns: repeat(4, 1fr);
-	gap: 20rpx;
+  display: grid;
+  grid-template-columns: repeat(4, 1fr);
+  background-color: #ffffff;
+  padding: 24rpx;
+  gap: 16rpx;
+  border-radius: 16rpx;
 }
 
 .grid-3 {
-	display: grid;
-	grid-template-columns: repeat(3, 1fr);
-	gap: 20rpx;
-	height: 100%;
+  display: grid;
+  grid-template-columns: repeat(3, 1fr);
+  background-color: #ffffff;
+  padding: 24rpx;
+  gap: 16rpx;
+  border-radius: 16rpx;
+  height: 100%;
 }
 
 .flex {
-	display: flex;
-	flex-direction: column;
-	gap: 20rpx;
-	align-items: center;
-	justify-content: center;
+  display: flex;
+  flex-direction: column;
+  gap: 20rpx;
+  align-items: center;
+  justify-content: center;
 }
 
 .bg-red {
-	width: 149rpx;
-	height: 80rpx;
-	background: #d9d9d9;
+  width: 191.07rpx;
+  height: 179.61rpx;
+  background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/WmhlbORF2q8A62Ytg1RVac8AYSGPkf7F2pEY6jQP.png")
+    no-repeat;
+  background-size: cover;
+  display: flex;
+  justify-content: center;
+
+  .text {
+    font-family: jiangxizhuokai, jiangxizhuokai;
+    font-weight: bold;
+    font-size: 27rpx;
+    color: #3f75ff;
+    text-shadow: 0px 2px 4px #bdcfff;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+    margin-top: 16rpx;
+    width: 95rpx;
+    height: 70rpx;
+  }
 }
 </style>

+ 50 - 21
pages/real/index.vue

@@ -1,24 +1,22 @@
 <template>
   <Container :title="title">
     <view class="p-20">
-      <uni-segmented-control
-        :flex="false"
-        :current="current"
-        :values="list.map((i) => i.name)"
-        style-type="text"
-        @clickItem="(e) => (current = e.currentIndex)"
-      />
+      <view class="center"
+        ><uni-segmented-control
+          :flex="false"
+          :current="current"
+          :values="list.map((i) => i.name)"
+          style-type="text"
+          @clickItem="(e) => (current = e.currentIndex)"
+      /></view>
       <!-- 执业药师 -->
       <template v-for="(item, index) in list" :key="item.id">
         <view v-if="current === index" class="grid">
-          <view v-for="i in item?.children" class="flex" @click="clickClass(i)">
-            <view
-              class="bg-red"
-              :style="{
-                background: '#d9d9d9',
-              }"
-              >{{ i.name }}</view
-            >
+          <view v-for="i in item?.children" class="flex">
+            <view class="bg-red">
+              <view class="text">{{ i.name }}</view>
+              <view class="button" @click="clickClass(i)">开始考试</view>
+            </view>
           </view>
         </view>
       </template>
@@ -45,7 +43,7 @@ const clickClass = (item) => {
       title: item.name,
     },
   });
-}
+};
 
 onMounted(async () => {
   const params = getRoute().params;
@@ -62,6 +60,7 @@ onMounted(async () => {
 </script>
 
 <style scoped lang="scss">
+@import "@/uni.scss";
 .title {
   font-family: "PingFang SC, PingFang SC";
   font-weight: 700;
@@ -69,6 +68,12 @@ onMounted(async () => {
   color: #000000;
 }
 
+.center {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
 .p-20 {
   padding: 0 30rpx 30rpx;
   display: flex;
@@ -92,16 +97,40 @@ onMounted(async () => {
 .flex {
   display: flex;
   flex-direction: column;
-  gap: 20rpx;
+  gap: 22rpx;
   align-items: center;
   justify-content: center;
 }
 
 .bg-red {
-  width: 146rpx;
-  height: 198rpx;
+  font-family: PingFang SC, PingFang SC;
+  font-weight: 500;
+  font-size: 28rpx;
+  color: #333333;
   display: flex;
-  align-items: center;
-  justify-content: center;
+  flex-direction: column;
+  width: 214rpx;
+  height: 282rpx;
+  background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/mrgkegM1h3pgz5taDRfQv5r1DX4DfONhIJtgJXEv.png");
+  .text {
+    margin-top: 32rpx;
+    margin-left: 54rpx;
+    margin-bottom: 126rpx;
+  }
+  .button {
+    padding: 10rpx 0;
+    width: 152rpx;
+    border-radius: 24rpx;
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 500;
+    font-size: 26rpx;
+    margin: 0 auto;
+  }
+  .btn-plain {
+    color: $primary;
+    border: 1rpx solid #3f75ff;
+    background: transparent;
+    border-radius: 24rpx;
+  }
 }
 </style>

+ 1 - 1
pages/regulations/index.vue

@@ -202,7 +202,7 @@ onMounted(async () => {
     font-family: "PingFang SC, PingFang SC";
     font-weight: 500;
     font-size: 28rpx;
-    color: #002fa7;
+    color: $primary;
     border-radius: 4rpx;
   }
 

+ 0 - 20
static/customicons.css

@@ -1,20 +0,0 @@
-@font-face {
-  font-family: "customicons"; /* Project id 2878519 */
-  src:url('/static/customicons.ttf') format('truetype');
-}
-
-.customicons {
-  font-family: "customicons" !important;
-}
-
-.youxi:before {
-  content: "\e60e";
-}
-
-.wenjian:before {
-  content: "\e60f";
-}
-
-.zhuanfa:before {
-  content: "\e610";
-}

BIN
static/customicons.ttf


+ 2 - 2
uni.scss

@@ -1,10 +1,10 @@
 @import '@/uni_modules/uni-scss/variables.scss';
 
-$uni-primary: #002FA7;
+$uni-primary: #3F75FF;
 $uni-primary-disable:#94bcff;
 $uni-primary-light: #F3F6FF;
 
-$primary: #002FA7;
+$primary: #3F75FF;
 
 $success: #00be00;
 $error: #f00;

+ 4 - 6
uni_modules/uni-section/components/uni-section/uni-section.vue

@@ -112,7 +112,6 @@ export default {
 $uni-primary: #2979ff !default;
 
 .uni-section {
-  background-color: #fff;
   .uni-section-header {
     position: relative;
     /* #ifndef APP-NVUE */
@@ -120,16 +119,15 @@ $uni-primary: #2979ff !default;
     /* #endif */
     flex-direction: row;
     align-items: center;
-    padding: 12px 10px;
+    padding: 12px 0;
     font-weight: normal;
 
     &__decoration {
       margin-right: 6px;
-      background: #d9d9d9;
+      background: #3f75ff;
       &.line {
-        width: 4rpx;
-        height: 27rpx;
-        border-radius: 10px;
+        width: 8rpx;
+        height: 40rpx;
       }
 
       &.circle {