1
0
Преглед на файлове

fead:优化小程序首页

lsw преди 10 месеца
родител
ревизия
96d56823ea

+ 1 - 1
app/App.vue

@@ -30,7 +30,7 @@ button::after {
 /**挂载iconfont字体图标*/
 @font-face {
 	font-family: 'iconfont';
-	src: url('https://at.alicdn.com/t/c/font_4620946_zi17cneza5h.ttf?t=1721295443583') format('truetype');
+	src: url('https://at.alicdn.com/t/c/font_4620946_71l23z3aw5o.ttf?t=1721929654519') format('truetype');
 	/* src: url('~@/static/font/iconfont.ttf') format('truetype'); */
 }
 .icon {

+ 179 - 28
app/pages/index/index.vue

@@ -1,36 +1,83 @@
 <template>
 	<view class="main">
-		<image src="https://axure-file.lanhuapp.com/md5__f93627286149f825890eb821ab5d5abb.png" mode="widthFix" class="banner"></image>
+		<image src="https://chenglantimes.com/prod-api/profile/upload/2024/07/26/1721928199437.jpg" mode="widthFix" class="banner"></image>
+		<!--通知公告-->
+		<view class="notice">
+			<u-notice-bar color="#545555" :text="noticeList" :step="true" direction="column" mode="link" bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
+		</view>
+
 		<view class="flow">
-			<view class="item" @click="go('/pages/introduction/index')">
+			<view class="item" @click="go('/pages/doctor/index')">
 				<view class="out">
-					<view class="int">
-						<view class="icon" style="color: rgb(72, 154, 253)">&#xe775;</view>
-						<view class="title">医院介绍</view>
+					<view class="int" style="height: 217px; background-color: #d9e8fd">
+						<view class="icon" style="color: #4687ed">&#xe62d;</view>
+						<view class="title">
+							<view>医生团队</view>
+							<view class="desc">权威团队服务</view>
+						</view>
 					</view>
 				</view>
 			</view>
 			<view class="item" @click="go('/pages/department/index')">
 				<view class="out">
-					<view class="int">
-						<view class="icon" style="color: rgb(72, 154, 253)">&#xe752;</view>
-						<view class="title">科室介绍</view>
+					<view class="int" style="height: 87px; background-color: #ddf8f3">
+						<view class="icon" style="color: #22b789">&#xe606;</view>
+						<view class="title">
+							<view>科室介绍</view>
+							<view class="desc">众多先进设备</view>
+						</view>
 					</view>
 				</view>
-			</view>
-			<view class="item" @click="go('/pages/doctor/index')">
 				<view class="out">
-					<view class="int">
-						<view class="icon" style="color: rgb(72, 154, 253)">&#xe6a3;</view>
-						<view class="title">医生介绍</view>
+					<view class="int" style="height: 87px; background-color: #fff3e3">
+						<view class="icon" style="color: #fe9b01">&#xe636;</view>
+						<view class="title"></view>
+						<view class="title">
+							<view>医院指南</view>
+							<view class="desc">医院简介</view>
+						</view>
 					</view>
 				</view>
 			</view>
-			<view class="item" @click="go('/pages/knowledge/index')">
-				<view class="out">
-					<view class="int">
-						<view class="icon" style="color: rgb(72, 154, 253)">&#xe69a;</view>
-						<view class="title">健康知识</view>
+		</view>
+		<!--权威专家-->
+		<view class="bos">
+			<view class="gg">
+				<view class="title">权威专家</view>
+				<view class="bor"></view>
+				<view class="more" @click="go('/pages/news/index?type=新闻资讯')">
+					<text>更多</text>
+					<text class="icon">&#xe62b;</text>
+				</view>
+			</view>
+			<u-scroll-list :indicator="true" indicatorColor="#e0e0e0">
+				<view class="doctor">
+					<view class="item" v-for="(item, index) in doctorList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
+						<image :src="ip + item.avatar" mode="scaleToFill" class="avatar"></image>
+						<view class="title">{{ item.name }}</view>
+					</view>
+				</view>
+			</u-scroll-list>
+		</view>
+		<!--健康知识-->
+		<view class="bos">
+			<view class="gg">
+				<view class="title">健康知识</view>
+				<view class="bor"></view>
+				<view class="more" @click="go('/pages/news/index?type=新闻资讯')">
+					<text>更多</text>
+					<text class="icon">&#xe62b;</text>
+				</view>
+			</view>
+			<view class="knowledgeList">
+				<view class="item" v-for="(item, index) in knowledgeList" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
+					<view class="title omit">
+						<text class="icon" v-if="item.top === 1">&#xe61f;</text>
+						<text>{{ item.title }}</text>
+					</view>
+					<view class="desc">
+						<text>{{ item.type }}</text>
+						<text>{{ item.createTime.substring(5, 10) }}</text>
 					</view>
 				</view>
 			</view>
@@ -42,15 +89,36 @@ export default {
 	data() {
 		return {
 			ip: this.http.ip,
+			noticeList: ['医院开通线上小程序啦,快来体验吧', '首次使用如何绑定就诊卡'],
+			doctorList: [
+				{ name: '梁红斌', avatar: '/profile/upload/2024/07/23/blob_20240723162841A002.jpeg' },
+				{ name: '戴浩华', avatar: '/profile/upload/2024/07/23/blob_20240723153318A001.jpeg' },
+				{ name: '罗肇林', avatar: '/profile/upload/2024/07/23/blob_20240723145549A005.jpeg' },
+				{ name: '覃勇军', avatar: '/profile/upload/2024/07/23/blob_20240723144505A002.jpeg' },
+				{ name: '阿松大', avatar: '/profile/upload/2024/07/23/blob_20240723153318A001.jpeg' },
+				{ name: '阿松大', avatar: '/profile/upload/2024/07/23/blob_20240723153318A001.jpeg' },
+				{ name: '阿松大', avatar: '/profile/upload/2024/07/23/blob_20240723153318A001.jpeg' }
+			],
+			knowledgeList: [
+				{ title: '啊实打实', type: '阿松大', createTime: '' },
+				{ title: '啊实打实', type: '阿松大', createTime: '' },
+				{ title: '啊实打实', type: '阿松大', createTime: '' }
+			],
 			user: {}
 		};
 	},
-	onShow() {},
 	onLoad() {
 		this.getData();
 	},
 	methods: {
-		getData() {},
+		getData() {
+			this.http.request({
+				url: '/app/home/index',
+				success: (res) => {
+					this.knowledgeList = res.data.data.knowledgeList;
+				}
+			});
+		},
 		go(url) {
 			uni.navigateTo({ url: url });
 		}
@@ -59,13 +127,20 @@ export default {
 </script>
 
 <style lang="scss">
+page {
+	background-color: white;
+}
 .banner {
 	width: 100%;
 	border-radius: 7px;
-	margin-top: -10px;
+}
+.notice {
+	margin-top: 5px;
+	border-radius: 5px;
+	overflow: hidden;
 }
 .flow {
-	padding-top: 10px;
+	padding-top: 5px;
 	overflow: hidden;
 	margin-left: -5px;
 	margin-right: -5px;
@@ -82,19 +157,95 @@ export default {
 				overflow: hidden;
 				border-radius: 9px;
 				text-align: center;
+				position: relative;
 				.icon {
 					margin: 0 auto;
-					width: 40px;
-					height: 40px;
-					padding: 10px;
 					line-height: 39px;
 					color: $main-color;
-					box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-					border-radius: 50%;
-					font-size: 27px;
+					font-size: 57px;
+					position: absolute;
+					right: 10px;
+					bottom: 20px;
 				}
 				.title {
 					padding-top: 8px;
+					float: left;
+					font-size: 18px;
+					text-align: left;
+					font-weight: bold;
+					.desc {
+						font-size: 14px;
+						padding-top: 5px;
+						color: $font-c;
+						font-weight: normal;
+					}
+				}
+			}
+		}
+	}
+}
+.bos {
+	background-color: white;
+	border-radius: 7px;
+	overflow: hidden;
+	padding: 12px 0px 0px 0px;
+	.gg {
+		font-weight: bold;
+		margin-bottom: 5px;
+		color: $font-c;
+		overflow: hidden;
+		.title {
+			margin-left: 10px;
+		}
+		.bor {
+			width: 5px;
+			height: 12px;
+			background-color: $main-color;
+			border-radius: 20px;
+			float: left;
+			margin-top: -16px;
+		}
+		.more {
+			float: right;
+			font-size: 14px;
+			font-weight: normal;
+			margin-top: -20px;
+		}
+	}
+	.doctor {
+		display: flex;
+		.item {
+			padding-top: 10px;
+			font-size: 15px;
+			width: 105px;
+			text-align: center;
+			image {
+				width: 80px;
+				height: 105px;
+				border-radius: 5px;
+			}
+			.title {
+				padding-top: 3px;
+				font-size: 14px;
+			}
+		}
+	}
+	.knowledgeList {
+		.item {
+			padding: 10px 0px 10px 0px;
+			border-bottom: 1px solid $line;
+			&:last-child {
+				border: 0px;
+			}
+			.title {
+				font-size: 15px;
+			}
+			.desc {
+				font-size: 14px;
+				padding-top: 5px;
+				color: #909090;
+				text {
+					padding-right: 25px;
 				}
 			}
 		}

+ 30 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_HomeController.java

@@ -0,0 +1,30 @@
+package com.ruoyi.web.work.api;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.work.service.IKnowledgeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 知识库管理
+ *
+ * @author lsw
+ * @date 2024-07-10
+ */
+@RestController
+@RequestMapping("/app/home")
+public class Api_HomeController extends BaseController {
+    @Autowired
+    private IKnowledgeService knowledgeService;
+
+    @GetMapping("/index")
+    public AjaxResult index() {
+        AjaxResult result = new AjaxResult();
+        result.put("knowledgeList", knowledgeService.indexList());
+        return AjaxResult.success(result);
+    }
+
+}

+ 5 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/mapper/KnowledgeMapper.java

@@ -1,8 +1,9 @@
 package com.ruoyi.web.work.mapper;
 
-import java.util.List;
-import com.ruoyi.web.work.domain.Knowledge;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.web.work.domain.Knowledge;
+
+import java.util.List;
 
 /**
  * @author lsw
@@ -10,4 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KnowledgeMapper extends BaseMapper<Knowledge> {
     List<Knowledge> selectList(Knowledge knowledge);
+
+    List<Knowledge> indexList();
 }

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IKnowledgeService.java

@@ -11,6 +11,8 @@ import java.util.List;
  * @date 2024-07-10
  */
 public interface IKnowledgeService extends IService<Knowledge> {
+    List<Knowledge> indexList();
+
     List<Knowledge> selectList(Knowledge knowledge);
 
     /**

+ 5 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/KnowledgeServiceImpl.java

@@ -20,6 +20,11 @@ public class KnowledgeServiceImpl extends ServiceImpl<KnowledgeMapper, Knowledge
     private KnowledgeMapper knowledgeMapper;
 
     @Override
+    public List<Knowledge> indexList() {
+        return knowledgeMapper.indexList();
+    }
+
+    @Override
     public List<Knowledge> selectList(Knowledge knowledge) {
         knowledge.setState(0);
         return knowledgeMapper.selectList(knowledge);

+ 4 - 0
ruoyi-admin/src/main/resources/mapper/work/KnowledgeMapper.xml

@@ -19,4 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <select id="indexList" resultType="com.ruoyi.web.work.domain.Knowledge">
+        SELECT id, title,type,create_time FROM tb_knowledge WHERE state=0 ORDER BY id DESC LIMIT 5
+    </select>
+
 </mapper>