<template>
	<view class="page">
		<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
			:title-bold='true' height='45' id="navbar">
		</u-navbar>
		<view class="tipbox">
			<view class="tip_cont">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uwO70CUV98b3maj6bfCF" mode=""></image>
				<view class="txt">
					中华蜂
				</view>
			</view>
			<view class="tip_cont" style="margin-top: 28rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uQQym033Pvs3rirm9kP5" mode=""></image>
				<view class="txt">
					枣花蜜
				</view>
			</view>
			<view class="tip_cont" style="margin-top: 28rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/u9wAWh1AIzSDGgKDKsKY" mode=""></image>
				<view class="txt">
					22.0 ℃
				</view>
			</view>
			<view class="tip_cont" style="margin-top: 28rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uBIctX6qJ9yMtAZYuY0R" mode=""></image>
				<view class="txt">
					60.0 %
				</view>
			</view>
		</view>
		<view class="info_box">
			<view class="cont_img" style="margin-top: 25rpx;" @click="showtqs()">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uuDdvHXyO9xuWd3DqCLU" mode=""></image>

			</view>
			<view class="cont_img" style="margin-top: 15rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/urhdebIu3K8vqRb8leoH" mode=""></image>
			</view>
			<view class="cont_img" style="margin-top: 15rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uTcBaMpmiZwS63GPCMBZ" mode=""></image>
				<view class="tip">
					1
				</view>
			</view>
			<view class="cont_img" style="margin-top: 25rpx;">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uZVc2GgYQoUmn6aJwVeR" mode=""></image>
			</view>
		</view>
		<view class="tit">
			具体位置
		</view>
		<view class="mapbox">
			<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
				:show-location='true'> </map>
			<view class="num">
				<view class="txt">
					在线：1001
				</view>
				<view class="txt" style="color:#FF473E ;margin-top: 10rpx;">
					在线：100
				</view>
			</view>
			<view class="btn" @click="showwl = true">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uaGU0mFvFqbgAxAsFlUP" mode=""></image>
			</view>
		</view>
		<view class="tit">
			具体位置
		</view>
		<view class="setbox">
			<view class="setcard">
				<view class="top">
					<view class="left">
						视频监控
					</view>
					<view class="right iconfont icon-xiangyou1">

					</view>
				</view>
				<view class="bot">
					更好查看蜂场情况
				</view>
				<view class="img">
					<image src="https://api.ccttiot.com/smartmeter/img/static/ukN0K37DEPQQxFJ03Qi9" mode=""></image>
				</view>
			</view>
			<view class="setcard">
				<view class="top">
					<view class="left">
						预警设置
					</view>
					<view class="right iconfont icon-xiangyou1">

					</view>
				</view>
				<view class="bot">
					时刻注意蜂箱变化
				</view>
				<view class="img">
					<image src="https://api.ccttiot.com/smartmeter/img/static/uxDnt5rGbJcc6mU6W3cE" mode=""></image>
				</view>
			</view>
		</view>
		<u-mask :show="showtq" @click="showtq = false" :z-index='100' duration='0' />
		<view class="weather_info" v-show="showtq">
			<view class="top">
				<view class="weather_info_tit">
					未来7日天气预知
				</view>
				<image src="https://api.ccttiot.com/smartmeter/img/static/uQK4q99a1Qb7LFD6O3Hw" mode="" @click="showtq = false"></image>
			</view>
			<view class="top" style="margin-top: 14rpx;">
				<view class="weather_add">
					蜂场位置：<span style="color: #42A5F5;">福鼎市</span>
				</view>
				<view class="up_time">
					1小时前更新
				</view>
			</view>
			<view class="weather_cont">
				<view class="weather_li" v-for="imte in 7 " :key="item">
					<view class="data">
						5/16
					</view>
					<view class="week">
						今天
					</view>
					<view class="week_weather">
						多云
					</view>
					<view class="week_weather_img">
						<image src="https://api.ccttiot.com/smartmeter/img/static/u6wWpgZOuId6JSX8LGmz" mode=""></image>
					</view>
				</view>
			</view>
			<view class="echarts_box">
				<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas" canvas-id="uni-ec-canvas" :ec="ec">
				</uni-ec-canvas>
			</view>
		</view>
		<u-mask :show="showwl" @click="showwl = false" :z-index='100' duration='0' />
		<view class="pops" v-if='showwl'>
			<image class="bgimg" src="https://api.ccttiot.com/smartmeter/img/static/uImWgTlNYBAv4SO02gSL" mode=""></image>
			<view class="tit">
				电子围栏（Km）
			</view>
			<view class="cont">
				最大距离 <view class="ipt"><input type="text" class="ips" v-model="code" placeholder=" "
				placeholder-class="my-placeholder" /></view>
			</view>
			<view class="btn">
				确定
			</view>
		</view>
	</view>
</template>

<script>
	import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
	import * as echarts from '@/components/uni-ec-canvas/echarts'
	let chart = null
	export default {
		components: {
			uniEcCanvas
		},
		data() {
			return {
				ec: {
					lazyLoad: true
				},
				bgc: {
					backgroundColor: " #F4FAF8",
				},
				title: "福鼎蜂场",
				latitude: '39.916527',
				longitude: ' 116.397128',
				isMap: false,
				zoomSize: 15,
				markers: [{
					id: 1,
					latitude: 39.90469,
					longitude: 116.40717,
					title: 'Marker1'
				}, {
					id: 2,
					latitude: 39.90969,
					longitude: 116.41217,
					title: 'Marker2'
				}],
				showtq: false,
				showwl:true

			}
		},
		onLoad() {
			
		},
		onShow() {

		},
		methods: {
			showtqs(){
				setTimeout(() => {
				
					this.$refs.canvas.init(this.initChart)
				}, 200);
				this.showtq=true
			},
			initChart(canvas, width, height, canvasDpr) {
				let that = this

				const option = {
					grid: {
						left: '4%',
						right: '4%',
						bottom: '3%',
						top:'0%',
						containLabel: true
					},
					tooltip: {
						trigger: 'axis'
					},
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
						axisLine: {
							show: false // 隐藏X轴线
						},
						axisTick: {
							show: false // 隐藏X轴刻度
						},
						axisLabel: {
							show: false // 隐藏X轴标签
						},
						 splitLine: {
						        show: true, // 显示X轴网格线
						        lineStyle: {
						            type: 'dashed', // 设置网格线为虚线
						            color: '#ccc', // 可以设置虚线的颜色
						            width: 1 // 可以设置虚线的宽度
						        }
						    }
					},
					yAxis: {
						type: 'value',
						  max: 40, // 设置Y轴的最大值为40
						axisLabel: {
							show: false // 隐藏Y轴标签
						},
						axisLine: {
							show: false // 隐藏Y轴线
						},
						axisTick: {
							show: false // 隐藏Y轴刻度
						},
						splitLine: {
							show: false // 隐藏Y轴背景网格线
						}
					},
					  dataZoom: [
					    {
					      show: true,
					      type: 'inside',
					      filterMode: 'none',
					      xAxisIndex: [0],
					      startValue: -20,
					      endValue: 20
					    },
					    {
					      show: true,
					      type: 'inside',
					      filterMode: 'none',
					      yAxisIndex: [0],
					      startValue: -20,
					      endValue: 20
					    }
					  ],
					series: [{
					    name: '最高温度',
					    type: 'line',
					    data: [25, 29, 29, 29, 27, 24, 26],
					    smooth: true,
					    symbol: 'circle',
					    symbolSize: 8,
					    lineStyle: {
					        width: 3
					    },
					    itemStyle: {
					        color: '#42A5F5'
					    },
					    label: {
					        show: true,
					        position: 'top',
					        formatter: '{c}°',
					        color: '#42A5F5'
					    },
					    markLine: {
					        silent: true, // 不响应鼠标事件
					        symbol: ['none', 'none'], // 不显示标记
					        lineStyle: {
					            color: 'red', // 使虚线更明显
					            type: 'dashed'
					        },
					        // data: [
					        //     { yAxis: 'min' },
					        //     { yAxis: 'max' }
					        // ]
					    },
					},
					{
					    name: '最低温蒂',
					    type: 'line',
					    data: [15, 18, 19, 19, 21, 20, 20],
					    smooth: true,
					    symbol: 'circle',
					    symbolSize: 8,
					    lineStyle: {
					        width: 3
					    },
					    itemStyle: {
					        color: '#42A5F5'
					    },
					    label: {
					        show: true,
					        position: 'bottom',
					        formatter: '{c}°',
					        color: '#42A5F5'
					    },
					}]
				};

				chart = echarts.init(canvas, null, {
					width: width,
					height: height,
					devicePixelRatio: canvasDpr
				})


				canvas.setChart(chart)
				chart.setOption(option)
				return chart
			},

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FAFDFD;
		background-image: url('https://api.ccttiot.com/smartmeter/img/static/uzH4CBTO95bjOrhGDpAe');
		background-size: cover;
		/* 确保背景图覆盖整个区域 */
		background-repeat: no-repeat;
		/* 防止背景图重复 */
		background-position: center;
	}

	.page {
		// position: relative;
		width: 750rpx;
		.pops{
			position: fixed;
			left: 98rpx;
			top: 400rpx;
			z-index: 101;
			width: 554rpx;
			height: 420rpx;
			background: #FFFFFF;
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			.bgimg{
				z-index: -1;
				position: absolute;
				top: 12rpx;
				right: 16rpx;
				width: 210rpx;
				height: 172rpx;
			}
			.tit{
				width: 100%;
				text-align: center;
				margin: 40rpx auto 0;
				font-weight: 600;
				font-size: 36rpx;
				color: #3D3D3D;
			}
			.cont{
				display: flex;
				align-items: center;
				justify-content: center;
				flex-wrap: nowrap;
				margin-top: 42rpx;
				width: 100%;
				
				font-weight: 400;
				font-size: 28rpx;
				color: #3D3D3D;
				.ipt{
					margin-left: 18rpx;
					width: 178rpx;
					height: 76rpx;
					border-radius: 10rpx 10rpx 10rpx 10rpx;
					border: 2rpx solid #808080;
					.ips{
						padding: 14rpx;
					}
					.my-placeholder {
						font-weight: 400;
						font-size: 32rpx;
						color: #808080;
					}
				}
				
			}
			.btn{
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 60rpx;
				margin-left: 74rpx;
				width: 406rpx;
				height: 90rpx;
				background: #FFC107;
				border-radius: 54rpx 54rpx 54rpx 54rpx;
				
				font-weight: 500;
				font-size: 40rpx;
				color: #FFFFFF;
			}
		}
		.weather_info {
			position: fixed;
			padding: 30rpx 50rpx;
			bottom: 0;
			right: 0;
			width: 750rpx;
			height: 820rpx;
			background: #FFFFFF;
			z-index: 200;

			border-radius: 20rpx 20rpx 0rpx 0rpx;

			.echarts_box {

				margin-top: 24rpx;
				// width: 100%;
				// height: 80%;
				width: 646rpx;
				height: 344rpx;
			}

			.weather_cont {
				margin-top: 42rpx;
				width: 100%;
				display: flex;
				flex-wrap: nowrap;
				align-items: center;
				justify-content: space-between;

				.weather_li {
					.data {
						text-align: center;
						width: 72rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #50565A;
					}

					.week {
						margin-top: 4rpx;
						text-align: center;
						width: 72rpx;
						font-weight: 600;
						font-size: 36rpx;
						color: #50565A;
					}

					.week_weather {
						margin-top: 14rpx;
						text-align: center;
						width: 72rpx;
						font-weight: 500;
						font-size: 28rpx;
						color: #50565A;
					}

					.week_weather_img {
						margin-top: 4rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						width: 72rpx;

						image {
							width: 48rpx;
							height: 48rpx;
						}
					}
				}

			}

			.top {
				display: flex;
				flex-wrap: nowrap;

				justify-content: space-between;
				align-items: center;

				.weather_info_tit {
					font-weight: 600;
					font-size: 36rpx;
					color: #3D3D3D;
				}

				image {
					width: 42rpx;
					height: 42rpx;
				}

				.weather_add {
					font-weight: 600;
					font-size: 32rpx;
					color: #50565A;
				}

				.up_time {
					font-weight: 400;
					font-size: 32rpx;
					color: #808080;
				}
			}
		}

		.setbox {
			margin: 0 auto;
			margin-top: 34rpx;
			width: 674rpx;
			display: flex;
			flex-wrap: nowrap;
			justify-content: space-between;

			.setcard {
				position: relative;
				padding: 14rpx 22rpx;
				width: 320rpx;
				height: 132rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
				border-radius: 20rpx 20rpx 20rpx 20rpx;

				.top {
					display: flex;
					flex-wrap: nowrap;
					align-items: center;
					justify-content: space-between;

					.left {
						font-weight: 600;
						font-size: 28rpx;
						color: #3D3D3D;
					}

					.right {
						font-size: 24rpx;
						color: #808080;
					}
				}

				.bot {
					margin-top: 14rpx;
					font-weight: 400;
					font-size: 24rpx;
					color: #808080;
				}

				.img {
					position: absolute;
					right: 24rpx;
					bottom: 24rpx;
					width: 82rpx;
					height: 82rpx;

					image {
						width: 82rpx;
						height: 82rpx;

					}
				}
			}
		}

		.tit {
			margin-top: 40rpx;
			margin-left: 38rpx;
			font-weight: 600;
			font-size: 32rpx;
			color: #3D3D3D;
		}

		.mapbox {
			position: relative;
			margin: 0 auto;
			margin-top: 34rpx;
			width: 674rpx;
			height: 372rpx;
			border-radius: 20rpx;
			overflow: hidden;

			.num {
				width: 180rpx;
				position: absolute;
				top: 24rpx;
				left: 30rpx;

				.txt {
					width: 180rpx;
					font-weight: 600;
					font-size: 32rpx;
					color: #FFC107;
				}
			}

			.btn {
				position: absolute;
				right: 0rpx;
				bottom: 0rpx;

				// width: 70rpx;
				// height: 70rpx;
				image {
					width: 90rpx;
					height: 90rpx;
				}
			}

			.map {
				width: 672rpx;
				height: 372rpx;
				// border-radius:20rpx;
			}
		}

		.info_box {
			padding-left: 40rpx;
			margin: 138rpx auto 0;
			display: flex;
			flex-wrap: nowrap;
			width: 680rpx;
			height: 184rpx;

			.cont_img {
				position: relative;
				margin-right: 50rpx;

				image {

					width: 112rpx;
					height: 124rpx;
				}

				.tip {
					position: absolute;
					right: 0;
					top: 6rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 50%;
					background: #FF473E;
					width: 32rpx;
					height: 32rpx;
					font-weight: 500;
					font-size: 24rpx;
					color: #FAFDFD;

				}
			}
		}

		.tipbox {
			width: 300rpx;
			display: flex;
			flex-wrap: wrap;
			// position: relative;
			margin-top: 42rpx;
			margin-left: 38rpx;

			.tip_cont {
				display: flex;
				flex-wrap: nowrap;
				align-items: center;

				image {
					margin-right: 6rpx;
					width: 38rpx;
					height: 38rpx;
				}

				// display: inline-flexbox;
				flex-wrap: nowrap;
				padding: 8rpx 22rpx;
				background: rgba(61, 61, 61, 0.5);
				box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
				border-radius: 20rpx 20rpx 20rpx 20rpx;

				font-weight: 500;
				font-size: 32rpx;
				color: #FAFDFD;

			}
		}




	}
</style>