<template>
	<view class="content">
		<!--  -->
		<view class="top">
			<view class="status"><text>设备连接</text></view>
			<view class="item">
				<view class="item-ite">今日个数<text>--</text></view>
				<view class="item-ite">今日时长<text>--</text></view>
				<view class="item-ite">卡路里/kcal<text>--</text></view>
			</view>
		</view>
		<!--  -->
		<view class="tabbar">
			<view @click="active=1" :class="[active==1?'active':'']">自由训练</view>
			<view @click="active=2" :class="[active==2?'active':'']">定时训练</view>
			<view @click="active=3" :class="[active==3?'active':'']">定数训练</view>
		</view>
		<!--  -->
		<view class="box"></view>
		<!--  -->
		<view class="box">
			<view class="data">
				<view class="item" @click="navTo('/pages/charts/charts?type=t')">
					<view class="val"></view>
					<view class="name">运动曲线</view>
				</view>
				<view class="item" @click="navTo('/pages/history/history?type=t')">
					<view class="val"></view>
					<view class="name">历史记录</view>
				</view>
				<view class="item" @click="navTo('/pages/compk/contrast?type=t')">
					<view class="val"></view>
					<view class="name">数据对比</view>
				</view>
				<view class="item" @click="navTo('/pages/compk/contrast')">
					<view class="val"></view>
					<view class="name">添加记录</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active: 1
			}
		},
		methods: {
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		min-height: 100vh;
		background-color: #F5F6FA;
	}

	.top {
		background: $maincolor;
		border-radius: 10px;
		margin: 10px 15px;
		font-size: 14px;
		padding: 15px 10px;
		color: #fff;

		.status {
			margin-bottom: 25px;

			text {
				width: auto;
				color: #333;
				background-color: #fff;
				border-radius: 15px;
				padding: 5px 10px;
			}
		}

		.item {
			display: flex;
			justify-content: space-between;

			text {
				display: block;
				width: 100%;
				text-align: center;
				margin-top: 15px;
			}
		}
	}

	.tabbar {
		width: 100%;
		margin: 15px 0;
		display: flex;
		align-items: center;
		justify-content: space-around;

		view {
			position: relative;
		}

		.active:after {
			content: "";
			height: 3px;
			width: 100%;
			position: absolute;
			bottom: -8px;
			left: 0;
			border-radius: 5px;
			background: $maincolor;
		}
	}

	.box {
		padding: 0;
		display: flex;
		flex-wrap: wrap;
		border-radius: 10px;
		margin: 15px;
		width: calc(100%- 30px);
		justify-content: space-between;

		.data {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: space-between;
			margin-top: 20px;
			width: 100%;

			.item {
				width: 47.5%;
				font-size: 14px;
				background: #fff;
				padding: 10px 0;
				border-radius: 15px;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-bottom: 15px;
			}

			.val {
				width: 40px;
				height: 40px;
				border-radius: 50%;
				margin-right: 10px;
				background-color: #F5F6FA;
			}

		}
	}
</style>