<template>
	<view class="container">
		<view class="dataCountBox">
			<view class="leftBox">
				<view>
					<text class="count">{{userStudyCountList.studyTimeTotal}}</text>
					<text>分钟</text>
				</view>
				<view style="margin-top: 16rpx;">累计学习时长</view>
			</view>
			<view class="rightBox">
				<view>
					<text class="count">{{userStudyCountList.fileTotal}}</text>
					<text>节</text>
				</view>
				<view style="margin-top: 16rpx;">累计完成课程</view>
			</view>
		</view>
		<!-- 总览学习进度 -->
		<view class="studyProgressBox">
			<h4>总览学习进度</h4>
			<view class="progressBox">
				<text>0</text>
				<view class="progressLine">
					<view class="bgLine" :style="{width:userStudyCountList.progressBarTotal+'%'}">{{userStudyCountList.progressBarTotal}}%</view>
				</view>
				<text>100%</text>
			</view>
		</view>
	</view>
</template>

<script>
	import api from "@/api/api";
	export default {
		data() {
			return {
				userId:'1',
				userStudyCountList:{},
				userCoursePackBarList:{},
				userStudyTimeList:{},
				packFileId:'',
				orderId:'',
				month:''
			};
		},
		methods:{
			userStudyCount(){
				api.userStudyCount({userId:this.userId}).then(res=>{
					if(res['success']){
						this.userStudyCountList = res['data'];
					}
				})
			},
			userCoursePackBar(){
				api.userCoursePackBar({userId:this.userId,packFileId:this.packFileId,orderId:this.orderId}).then(res=>{
					if(res['success']){
						this.userCoursePackBarList = res['data'];
					}
				})
			},
			userStudyTime(){
				api.userStudyTime({userId:this.userId,month:this.month}).then(res=>{
					if(res['success']){
						this.userStudyTimeList = res['data'];
					}
				})
			}
		},
		mounted() {
			this.userStudyCount()
		}
	}
</script>

<style lang="scss">
	.container{
		height: 100%;
		.dataCountBox{
			padding: 30rpx 0;
			margin: 10rpx 20rpx;
			display: flex;
			background-color: #fff;
			color: #666666;
			.leftBox,.rightBox{
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				.count{
					color: #0A2F99;
					font-size: 40rpx;
				}
			}
			.leftBox{
				border-right: 1px solid #F4F4F4;
			}
		}
		.studyProgressBox{
			h4{
				position: relative;
				font-size: 36rpx;
				color: #333;
				padding-left: 50rpx;
				margin-top: 10rpx;
				margin-bottom: 20rpx;
				&:before{
					content: '';
					display: block;
					position: absolute;
					left: 30rpx;
					top: 10%;
					width: 6rpx;
					height: 70%;
					background-color: #FA882F;
					border-radius: 4rpx;
				}
			}
			.progressBox{
				display: flex;
				align-items: center;
				padding: 0 40rpx;
				.progressLine{
					width: 90%;
					height: 60rpx;
					border-radius: 36rpx;
					border: 4rpx solid #0867F5;
					margin: 0 20rpx;
					.bgLine{
						height: 100%;
						background-color: #0867F5;
						border-top-left-radius: 36rpx;
						border-bottom-left-radius: 36rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						color: #fff;
					}
				}
			}
		}
	}
</style>
