<template>
	<view class="content">
		<!-- tabbar -->
		<view class="tabbar">
			<view @click="active=1" :class="[active==1?'active':'']">报告</view>
			<view @click="active=2" :class="[active==2?'active':'']">曲线</view>
		</view>
		<!--报告  -->
		<view v-if="active==1">
			<report :acd_id="acd_id"></report>
		</view>
		<!-- 曲线 -->
		<view v-if="active==2">
			<charts :acd_id="acd_id"></charts>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	import report from "./components/report.vue"
	import charts from "./components/charts.vue"
	export default {
		data() {
			return {
				active: 1,
				acd_id: "",
			}
		},
		computed: {
			...mapState(['user']),
			endDate() {
				return this.$tools.getDate("start")
			},
			startDate() {
				return this.$tools.GetDateStr(-90);
			},
		},
		components: {
			report,
			charts
		},
		onShow() {
			let that = this
			that.$store.dispatch("getResult", {
				aud_id: uni.getStorageSync('userid')
			})
			that.$store.dispatch("GetBodyTrendList", {
				aud_id: uni.getStorageSync('userid'),
				s_time: that.startDate,
				e_time: that.endDate
			})
		},
		onLoad(options) {
			let that = this
			that.acd_id = options.acd_id
		},
		methods: {

		}
	}
</script>

<style scoped lang="scss">
	.content {
		padding: 15px;
		font-size: 14px;
		background-color: #F5F6FA;
		min-height: 100vh;
	}

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

		view {
			position: relative;
		}

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