<template>
	<view class="main">
		<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/doctor/index')">
				<view class="out">
					<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" 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 class="out">
					<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>
		<!--权威专家-->
		<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>
		</view>
	</view>
</template>
<script>
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: {}
		};
	},
	onLoad() {
		this.getData();
	},
	methods: {
		getData() {
			this.http.request({
				url: '/app/home/index',
				success: (res) => {
					this.knowledgeList = res.data.data.knowledgeList;
				}
			});
		},
		go(url) {
			uni.navigateTo({ url: url });
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: white;
}
.banner {
	width: 100%;
	border-radius: 7px;
}
.notice {
	margin-top: 5px;
	border-radius: 5px;
	overflow: hidden;
}
.flow {
	padding-top: 5px;
	overflow: hidden;
	margin-left: -5px;
	margin-right: -5px;
	.item {
		border-radius: 10px;
		overflow: hidden;
		float: left;
		width: 50%;
		.out {
			padding: 5px;
			.int {
				padding: 15px;
				background-color: white;
				overflow: hidden;
				border-radius: 9px;
				text-align: center;
				position: relative;
				.icon {
					margin: 0 auto;
					line-height: 39px;
					color: $main-color;
					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;
				}
			}
		}
	}
}
</style>
