<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="top">
			<view class="top_left">
				福鼎蜂场
			</view>
			<view class="top_right">
				其他蜂场 <view class="iconfont icon-xiangyou1" style="font-size: 40rpx;">
					
				</view>
			</view>
		</view>
		<view class="cont_box">
			<view class="left">
				<view class="left_cont_box" v-for="(item, index) in tabs" :key="index" @click="changeTag(index)"
					:class="currentIndex === index ? 'act4' : ''">
					<view class="left_cont" :class="[
						  index===  currentIndex? 'act1' : '',
						index + 1 ===   currentIndex? 'act2' : '',
						 index- 1 ===  currentIndex? 'act3' : ''
					]">
						{{item.title}}
					</view>
				</view>
			</view>
			<view class="right">
				<view class="right_cont">
					<view class="right_cont_top">
						<view class="cont_left">
							
							<image src="https://api.ccttiot.com/smartmeter/img/static/uKzdmSTqoFrM6nlxTLGr" mode=""></image>
							<view class="txt">
								4%
							</view>
						</view>
						<view class="cont_right">
							<!-- <view class="btn1">
								知道了
							</view> -->
							<view class="btn2">
								已读
							</view>
						</view>
						
					</view>
					<view class="cont">
						<image src="https://api.ccttiot.com/smartmeter/img/static/uelHshjG1nuq3RacsYEY" mode=""></image>
						<view class="txt1">
							福鼎蜂场-001
						</view>
					</view>
					<view class="cont">
						
						<view class="txt2">
							温度过低
						</view>
					</view>
					<view class="cont" style="margin-top: 26rpx;">
						<view class="">
							
						</view>
						<view class="txt3">
							2024-05-15 15:23:56
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgc: {
					backgroundColor: " #F4FAF8",
				},
				title: "福鼎蜂场",
				currentIndex: 0,
				imglist: [],
				token: '',
				sn:'',
				upurl:'',
				tabs: [{
						title: '京东超市',
					},
					{
						title: '男装',
					},
					{
						title: '奢侈品',
					},
					{
						title: '女装',
					},
					{
						title: '鞋靴',
					},
					{
						title: '内衣饰品',
						imageSrc: ''
					},
					{
						title: '箱包',
						imageSrc: ''
					},
					{
						title: '美妆护肤',
						imageSrc: ''
					},

				],
			}
		},
		onLoad() {

		},
		onShow() {

		},
		methods: {
			changeTag(idx){
				this.currentIndex=idx
			},
			btn() {
				let _this = this
				let math = 'static/' + _this.$u.guid(20)
				uni.chooseImage({
					count: 9,
					type: 'all',
					success(res) {
						// tempFilePath可以作为img标签的src属性显示图片
						const tempFilePaths = res.tempFiles
						// let tempFilePaths = chooseImageRes.tempFilePaths;
						// console.log(tempFilePaths)
						// tempFilePaths.forEach(item=>{
						// 	// 上传图片到七牛云
						
						// })
						wx.uploadFile({
							url: 'https://up-z2.qiniup.com',
							name: 'file',
							filePath: tempFilePaths[0].path,
							formData: {
								token: _this.token, //后端返回的token
								key: 'smartmeter/img/' + math
							},
							success: function(res) {
								console.log(res,'resres');
								let str = JSON.parse(res.data)
								console.log(str.key)
								_this.userImgs = _this.upurl +'/'+ str.key
								console.log(_this.userImgs)
								_this.imglist.push(_this.userImgs)
							}
						});
					}
				})
			
			},

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F4FAF8;
	}

	.page {
		// position: relative;
		width: 750rpx;
		.top{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 22rpx;
			margin: 0 auto;
			width: 658rpx;
			height: 106rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.15);
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			.top_left{
				font-weight: 600;
				font-size: 36rpx;
				color: #3D3D3D;
			}
			.top_right{
				display: flex;
				align-items: center;
				flex-wrap: nowrap;
				font-weight: 500;
				font-size: 36rpx;
				color: #808080;
			}
		}
		.cont_box {
			margin-top: 26rpx;
			display: flex;
			flex-wrap: nowrap;

			.left {
				margin-left: 48rpx;
				width: 216rpx;

				.left_cont_box {
					width: 216rpx;
					height: 100rpx;
					background: #fff;

					.left_cont {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 216rpx;
						height: 100rpx;
						font-weight: 600;
						font-size: 36rpx;
						color: #3D3D3D;
						background-color: #F4FAF8;

						// border-radius: 0rpx 40rpx 40rpx 0rpx;
						// border: 1rpx solid #fff;
						
					}

					.act1 {
						background: #fff;
						border-radius: 40rpx 0 0 40rpx;
						// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
					}

					.act2 {
						border-radius: 0rpx 0rpx 40rpx 0rpx;
					}

					.act3 {
						border-radius: 0rpx 40rpx 0rpx 0rpx;
					}
				}

				.act4 {
					background-color: #F4FAF8;
					border-radius: 40rpx 0 0 40rpx;
				}

			}
			.right{
				padding: 16rpx;
				margin-left: -10rpx;
				width: 100%;
				height: 100vn;
				background: #fff;
				.right_cont{
					padding: 20rpx 26rpx;
					width: 462rpx;
					height: 242rpx;
					background: #F6F6F6;
					border-radius: 20rpx 20rpx 20rpx 20rpx;
					.cont{
						margin-top: 10rpx;
						display: flex;
						flex-wrap: nowrap;
						align-items: center;
						width: 100%;
						padding-left: 80rpx;
						image{
							width: 18rpx;
							height: 22rpx;
						}
						.txt1{
							margin-left: 8rpx;
							font-weight: 400;
							font-size: 26rpx;
							color: #4D4D4D;
						}
						.txt2{
							font-weight: 600;
							font-size: 28rpx;
							color: #3D3D3D;
						}
						.txt3{
							margin-left: auto;
							font-weight: 400;
							font-size: 24rpx;
							color: #808080;
						}
					}
					.right_cont_top{
						display: flex;
						flex-wrap: nowrap;
						align-items: center;
						justify-content: space-between;
						.cont_left{
							display: flex;
							flex-wrap: nowrap;
							align-items: center;
							image{
								width: 50rpx;
								height: 50rpx;
							}
							.txt{
								margin-left: 34rpx;
								font-weight: 600;
								font-size: 36rpx;
								color: #3D3D3D;
								
							}
						}
						.cont_right{
							.btn1{
								display: flex;
								align-items: center;
								justify-content: center;
								width: 110rpx;
								height: 48rpx;
								background: #FFC107;
								border-radius: 6rpx 6rpx 6rpx 6rpx;
								font-weight: 400;
								font-size: 28rpx;
								color: #FFFFFF;
							}
							.btn2{
								display: flex;
								align-items: center;
								justify-content: center;
								width: 86rpx;
								height: 48rpx;
								border-radius: 6rpx 6rpx 6rpx 6rpx;
								border: 1rpx solid #808080;
								font-weight: 400;
								font-size: 28rpx;
								color: #808080;
							}
						}
					}
				}
				// border-radius: 40rpx 0 0 40rpx;
				// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
			}
		}




	}
</style>