<template>
	<view class="content">
		<view class="bg"></view>
		<view class="cont">
			<view class="doc-box">
				<view class="left">
					<image  @click="showImg()" :src="doctor.avatar" mode="aspectFill"></image>
				</view>
				<view class="right">
					<view class="doc-name-box">
						<view class="doc-name">
							{{doctor.doctorName}}
						</view>
						<view class="doc-ping">
							<u-rate activeColor="#ffc603" count="5" readonly v-model="doctor.pingStar"></u-rate>
						</view>
					</view>
					<view class="doc-dept-box">
						{{department.deptName}}|{{doctor.position}}
					</view>
					<view class="doc-his-box">
						{{hospital.hospitalName}}
					</view>
				</view>
				
			</view>
			<view class="desc-box">
				<view class="title-box">
					<view class="line"></view>
					<view class="title">擅长方向</view>
				</view>
				<view class="desc" >
					{{doctor.speciality}}
				</view>
			</view>			 
			<view class="desc-box">
				<view class="title-box">
					<view class="line"></view>
					<view class="title">医生介绍</view>
				</view>
				<view class="desc" >
					{{doctor.introduction}}
				</view>
			</view>
			<view class="desc-box" v-if="imgs&&imgs.length>0">
				<view class="title-box">
					<view class="line"></view>
					<view class="title">荣誉资质</view>
				</view>
				<view class="desc doc-imgs" >
					<image v-for="i in imgs" :src="i" mode="aspectFill" @click="previewImage"></image>
				</view>
			</view>
			<view class="desc-box" v-if="videoUrl">
				<view class="title-box">
					<view class="line"></view>
					<view class="title">医生风采</view>
				</view>
				<view class="desc" >
					<video :src="videoUrl" :poster="thumbnail" :autoplay='true' class="doc-video"></video>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {checkFollow,doFollow,getDoctorDetails,getDoctorPingList} from '@/api/doctor.js'
	export default {
		data() {
			return {
				isFollow:false,
				doctorId:null,
				doctor:null,
				department:null,
				hospital:null,
				pings:[],
				videoUrl: '',
				imgs: [],
				thumbnail: ''
			}
		},
		onLoad(options) {
			this.doctorId=options.doctorId;
			
		},
		onShow() {
			this.getDoctorDetails();
			 
		},
		methods: {
			showImg(){
				var data=[];
				data.push(this.doctor.avatar)
				uni.previewImage({
					current: 0,
					urls: data
				});
			},
			previewImage() {
				uni.previewImage({
					current: 0,
					urls: this.imgs
				});
			},
			getDoctorDetails() {
				//联网加载数据
				var that = this;
				var data = {
					doctorId: this.doctorId
				};
				getDoctorDetails(data).then(res => {
					if(res.code==200){
						this.doctor=res.data.doctor;
						this.department=res.data.department;
						this.hospital=res.data.hospital;
						this.thumbnail = this.doctor&&this.doctor.thumbnail;
						this.videoUrl = this.doctor&&this.doctor.videoUrl;
						this.imgs = this.doctor&&this.doctor.honorImgUrl? this.doctor.honorImgUrl.split(','):[];
					}else{
						uni.showToast({
							icon:'none',
							title: "请求失败",
						});
					}
				});
			},
		}
	}
</script>
<style scoped lang="scss">
	.content{
		height: 100%;
		position: relative;
		.bg{
			width: 100%;
			height:280rpx;
			background-color: #2583EB;
			background: linear-gradient(#2583EB, #2EDAD4);
			border-radius: 0rpx 0rpx 50rpx 50rpx;
			position: fixed;
			// z-index: 1;
		}
		.cont{
			top:50rpx;
			position: relative;
			padding: 0rpx 20rpx;
			z-index: 999;
			width: 100%;
			display: flex;
			flex-direction: column;
			.doc-box{
				margin-bottom: 20rpx;
				padding: 30rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				display: flex;
				align-items: center;
				justify-content: flex-start;
				.left{
					width: 190upx;
					height: 190upx;
					border-radius: 8upx;
					image{
						width: 190upx;
						height: 190upx;
					}
				}
				.right{
					display: flex;
					flex-direction: column;
					justify-content: flex-start;
					margin-left: 20rpx;
					height:190upx;
					width: calc(100% - 210upx);
					.doc-name-box{
						display: flex;
						align-items: center;
						justify-content: flex-start;
						position: relative;
						.doc-name{
							font-size: 38rpx;
							font-weight: bold;
						}
						.doc-ping{
							margin-left: 10rpx;
						}
						.doc-star{
							position: absolute;
							top:5rpx;
							right:0rpx;
							width:32rpx;
							height:32rpx;
							image{
								width:100%;
								height:100%;
							}
						}
					}
					.doc-dept-box{
						display: flex;
						align-items: center;
						justify-content: flex-start;
						margin-top: 15rpx;
						font-size: 28upx;
						font-family: PingFang SC;
						color: #2d2b36;
						 
					}
					.doc-his-box{
						display: flex;
						align-items: center;
						justify-content: flex-start;
						margin-top: 15rpx;
						font-size: 28upx;
						font-family: PingFang SC;
						color: #9a9a9c;
						 
					}
					.doc-spec-box{
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-top: 15rpx;
						.spec-left{
							width: 80%;
							display: flex;
							align-items: center;
							justify-content: flex-start;
							.title{
								font-size: 28upx;
								font-family: PingFang SC;
								color: #9a9a9c;
							}
							.spec{
								// margin-left: 10rpx;
								font-size: 28upx;
								font-family: PingFang SC;
								color: #9a9a9c;
							}
						}
						.spec-right{
							.btn{
								font-size: 28upx;
								font-family: PingFang SC;
								color: #2583EB;
							}
						}
						
					}
				}
				
			}
			.price-box{
				margin-bottom: 20rpx;
				padding: 15rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				.title-box{
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: flex-start;
					.title{
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #111111;
					}
					.line{
						margin-right: 15rpx;
						height: 30rpx;
						width: 6rpx;
						background-color: #2583EB;
						
					}
					 
				}
				.price-list{
					display: flex;
					flex-direction: column;
					align-items: flex-start;
					justify-content: flex-start;
					margin-top: 15rpx;
					padding: 15rpx;
					.price-item{
						margin-bottom: 15rpx;
						padding: 15rpx;
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: space-between;
						border-radius: 15rpx;
						background-color: #f1f6fc;
						.left{
							.price-name{
								font-size: 32upx;
								font-family: PingFang SC;
								color: #111111;
								display: flex;
								align-items: center;
								justify-content: flex-start;
								.price{
									margin-left: 15rpx;
									font-size: 32upx;
									font-family: PingFang SC;
									color: #fe9460;
									
								}
							}
							.price-desc{
								margin-top: 20rpx;
								font-size: 28upx;
								font-family: PingFang SC;
								color: #9a9a9c;
							}
							
						}
						.right{
							.btn{
								padding: 15rpx 30rpx;
								background-color: #ff9561;
								color: #fff;
								font-size: 28rpx;
								border-radius: 15rpx;
							}
						}
					}
				}
			}
			.his-box{
				margin-bottom: 20rpx;
				padding: 15rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				.title-box{
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: flex-start;
					.title{
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #111111;
					}
					.line{
						margin-right: 15rpx;
						height: 30rpx;
						width: 6rpx;
						background-color: #2583EB;
						
					}
					 
				}
				.his{
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 15rpx;
					.left{
						display: flex;
						flex-direction: column;
						align-items: flex-start;
						justify-content: center;
						.his-name{
							font-size: 32upx;
							font-family: PingFang SC;
							color: #111111;
						}
						.his-desc{
							margin-top: 15rpx;
							font-size: 28upx;
							font-family: PingFang SC;
							color: #9a9a9c;
						}
					}
					.right{
						image{
							width:30rpx;
							height:30rpx;
						}
					}
				}
			}
			.desc-box{
				margin-bottom: 20rpx;
				padding: 15rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				.title-box{
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: flex-start;
					.title{
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #111111;
					}
					.line{
						margin-right: 15rpx;
						height: 30rpx;
						width: 6rpx;
						background-color: #2583EB;
						
					}
					 
				}
				.desc{
					margin-top: 15rpx;
					font-size: 28upx;
					font-family: PingFang SC;
					color: #9a9a9c;
				}
			}
			.ping-box{
				margin-bottom: 20rpx;
				padding: 15rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				.title-box{
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: space-between;
					.left{
						display: flex;
						align-items: center;
						justify-content: center;
						.title{
							font-size: 32upx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #111111;
						}
						.line{
							margin-right: 15rpx;
							height: 30rpx;
							width: 6rpx;
							background-color: #2583EB;
							
						}
					}
					.more{
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 28upx;
						font-family: PingFang SC;
						color: #9a9a9c;
						image{
							margin-left: 10rpx;
							width: 30rpx;
							height:30rpx;
						}
					}
					
					 
				}
				.ping-list{
					display: flex;
					flex-direction: column;
					align-items: flex-start;
					justify-content: flex-start;
					margin-top: 15rpx;
					padding: 15rpx;
					.ping-item{
						padding: 20rpx 0rpx;
						border-bottom: 1rpx solid #efefef;
						width: 100%;
						display: flex;
						align-items: flex-start;
						justify-content: flex-start;
						&:last-child{
							padding-bottom: 0rpx;
							border-bottom: none;
						}
						.left{
							image{
								width:80rpx;
								height:80rpx;
								border-radius: 50%;
							}
						}
						.right{
							width: 100%;
							margin-left: 15rpx;
							.user-name-box{
								display: flex;
								align-items: center;
								justify-content: space-between;
								font-size: 28upx;
								font-family: PingFang SC;
								font-weight: bold;
								color: #111111;
							}
							.ping-cont{
								margin-top: 10rpx;
								font-size: 28upx;
								font-family: PingFang SC;
								color: #9a9a9c;
							}
							.ping-time{
								margin-top: 10rpx;
								font-size: 28upx;
								font-family: PingFang SC;
								color: #9a9a9c;
							}
							 
						}
					}
				}
			}
		}
	}
	.doc-video {
		width: 680rpx;
		height: 382.5rpx;
	}
	.doc-imgs {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		image {
			height: 180rpx;
			width: 320rpx;
			margin: 0 10rpx 20rpx;
		}
	}
</style>
