<template>
	<view class="pageBgImg">
		<topNavbar title="学车学时"></topNavbar>
		<view class="pad">
			<view class="box" v-for="(item,index) in list" :key="index" :style="{ backgroundImage: `url(${imgUrl})`, backgroundSize: backgroundSize }">
				<view class="h2">{{ item.text }}</view>
				<view class="con">
					<view class="item_row">
						<view class="item">
							<view class="lab">总学时</view>
							<view class="val">{{ item.total }}分钟</view>
						</view>
						<view class="item">
							<view class="lab">已完成</view>
							<view class="val">{{ item.time }}分钟</view>
						</view>
					</view>
				</view>
				<view class="chain left" v-if="index!=0">
					<image src="@/static/images/index/chain.png" mode=""></image>
				</view>
				<view class="chain right" v-if="index!=0">
					<image src="@/static/images/index/chain.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { imgUrl } from '@/config/site.config'
	import { getStudentProcess } from '@/config/api.js'
	export default {
		data() {
			return {
				imgUrl: imgUrl+'carlearTimeBg.png',
				backgroundSize: '100% 100%',
				list: []
			}
		},
		onLoad() {
			this.getStudentProcessFn()
		},
		onPullDownRefresh() {
			this.getStudentProcessFn().then((res)=>{
				uni.stopPullDownRefresh()
			})
		},
		methods: {
			async getStudentProcessFn() {
				const {data: res} = await getStudentProcess({studentId: this.studentId})
				console.log('基础不劳')
				this.list = [
					{total: res.simulateTotalTime, time: res.simulateValidTtime, text: '模拟器'},
					{total: res.subjectOneTotalTime, time: res.subjectOneValidTtime, text: '科目一'},
					{total: res.subjectTwoTotalTime, time: res.subjectTwoValidTtime, text: '科目二'},
					{total: res.subjectThreeTotalTime, time: res.subjectOneValidTtime, text: '科目三'},
				]
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pad {
		marginp: 20rpx 0;
	}
	.box {
		width: 100%;
		height: 400rpx;
		margin-bottom: 20rpx;
		padding: 0 16rpx 52rpx 16rpx;
		background: url('http://192.168.1.20:81/zhili/image/20230822/ca8f14281ac9412987b23ad43bfb50a1.png') no-repeat;
		background-size: 100% 400rpx;
		position: relative;
	  .h2 {
			width: 489rpx;
			height: 75rpx;
			line-height: 70rpx;
			margin: 0 auto;
			text-align: center;
			// background-color: #A6E2FF;
			color: #fff;
			font-size: 32rpx;
			font-weight: 600;
	  }
	
	  .con {
		  border-radius: 16rpx;
		  width: 100%;
	    .item_row {
			display: flex;
			width: 100%;
			height: 256rpx;
			align-items: center;
	      .item {
			  flex: 1;
			  text-align: center;
			  display: flex;
			  flex-direction: column;
			  align-items: center;
	        .lab {
				font-size: 28rpx;
				color: #363A44;
	        }
	
	        .val {
				margin-top: 20rpx;
				font-size: 40rpx;
				color: $themC;
				font-weight: 500;
	        }
	      }
	    }
	  }
	
	  .chain {
	  	width: 28rpx;
	  	height: 100rpx;
	  	position: absolute;
	  	top: -56rpx;
	  	&.left {
	  		left: 60rpx;
	  	}
	  	&.right {
	  		right: 60rpx !important;
	  	}
	  }
	}
</style>