<template>
	<view class="content">
		<!--  -->
		<view class="skiptop">
			<view class="item">
				<view class="item-ite">{{$t("averagelungsuction")}}<text>{{info?info.average:'--'}}</text></view>
				<view class="item-ite">{{$t("lungsuctionspeed")}}<text>--</text></view>
				<view class="item-ite">{{$t("isMarginal")}}<text>{{info?info.level:'--'}}</text></view>
			</view>
		</view>
		<!--自由训练  -->
		<view class="box1">
			<view class="time">{{info?info.time:''}}</view>
			<view class="item">
				<view class="image">
					<image src="../../static/bae.png" mode="widthFix"></image>
				</view>
				<view class="center  mt-15">
					<view class="level"></view>
					<view class="level level-bg" :style="{'top':info?Number(100 - info.offset)+'%':'100%'}"></view>
					<view class="level-item" v-if="info">
						<view class="ite" v-for="(ite,ind) in info.list" :style="{'height':100/info.list.length+'%'}">
							{{ite.text}}
						</view>
					</view>
				</view>
			</view>
			<!-- <view class="val" v-if="info">
				<text>{{info.average}}</text>
				吸气肺活量平均值{{$t("infoGender")}}
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		data() {
			return {
				LiuS: 0,
				isdevice: true,
			}
		},
		computed: {
			...mapState(["MeasureLung", "user"]),
			info() {
				return this.MeasureLung
			}
		},
		onLoad(options) {
			let that = this
			uni.setNavigationBarTitle({
				title: this.$t('titlevVitalcapacity'),
			})
			that.$store.dispatch("getLungResult", {
				aud_id: that.user.aud_id
			})
		},
		onPullDownRefresh() {
			let that = this
			that.$store.dispatch("getLungResult", {
				aud_id: that.user.aud_id
			})
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1000);
		},
		methods: {
			// 历史数据删除时重新加载接口
			reload() {
				let that = this
				console.log('重新加载');
				this.$nextTick(() => {
					that.$store.dispatch("getLungResult", {
						aud_id: that.user.aud_id
					})
				})
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	@import "@/scss/lunging.scss";

	.skiptop {
		margin-top: 15px;
		width: calc(100% - 40px);
	}
</style>