<template>
	<view class="content">
		<up-navbar leftText=" " :leftIconColor="'#fff'" :safeAreaInsetTop="true" :autoBack="true" title="我的学习" :bgColor="'transparent'" :titleStyle="{color: '#fff'}">
		</up-navbar>
		<view class="studyDay">已坚持学习8天</view>
		<view class="card">
			<view class="tabs">
				<view class="tab" @click="changeNav(1)" :class="{active: currentNav==1}">科一</view>
				<view class="tab" @click="changeNav(2)" :class="{active: currentNav==2}">科四</view>
			</view>
			<view class="pd20">
				<view class="statistics">
					<view class="statisticsItem" v-for="(item,index) in statisticsData" :key="index">
						<view class="num">{{ item.num }}</view>
						<view class="text">{{ item.name }}</view>
					</view>
				</view>
				<view class="h3">刷题进度</view>
				<view class="bgCard_row">
					<view class="bgCard">
						<view class="lab">顺序练习</view>
						<view class="tps">已完成（题）</view>
						<view class="num">140/500</view>
					</view>
					<view class="bgCard">
						<view class="lab">精选试题</view>
						<view class="tps">已完成（题）</view>
						<view class="num">110/500</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="card card2">
			<view class="chartTab">
				<view class="h3">刷题进度</view>
				<view class="btn_row">
					<view class="btn" @click="changeChart(1)" :class="{bg: currentChart==1}">曲线</view>
					<view class="btn" @click="changeChart(2)" :class="{bg: currentChart==2}">明细</view>
				</view>
			</view>
			<view class="tip">近30次科目一模拟考试成绩</view>
			<view class="con" v-if="currentChart==1">
				图表
				<view class="tips">按住可左右滑动查看更多成绩</view>
			</view>
			<view class="con" v-if="currentChart==2">
				<view class="tables">
					<view class="fristTab li">
						<view class="item">考试成绩</view>
						<view class="item">考试用时</view>
						<view class="item">考试时间</view>
					</view>
					<view class="li">
						<view class="item">90分</view>
						<view class="item">10分30秒</view>
						<view class="item">2024-8-28</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 如果是科目四，并且没有数据 -->
		<view class="subject4 card2 card" v-if="currentNav==2">
			<view class="h3">模拟考试</view>
			<nodata>暂无考试记录</nodata>
			<view class="btnE">
				<oneBtn text="去考试" @oneBtnClick="$goPage('/pages/exercises/beforeExam/beforeExam')"></oneBtn>
			</view>
		</view>
		
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import nodata from '@/components/nodata/nodata.vue'
	const value = ref(false)
	const currentNav = ref(1)
	
	function changeNav(val) {
		currentNav.value = val
	}
	const statisticsData = ref([
		{name: '我的收藏', num: 0},
		{name: '我的错题', num: 1},
		{name: '考试记录', num: 2},
		{name: '预计合格率', num: '100%'},
	])
	
	const currentChart = ref(1)
	function changeChart(num) {
		currentChart.value = num
	}
	
</script>

<style lang="scss" scoped>
	.u-nav-slot {
		display: flex;
		.btn {
			color: #fff;
			position: relative;
			padding: 0 20rpx;
			&.active {
				&::before {
					content: '';
					position: absolute;
					left: 50%;
					bottom: -20rpx;
					width: 30rpx;
					height: 4rpx;
					background: #F6F7F8;
					border-radius: 2rpx;
					transform: translateX(-50%);
				}
			}
		}
	}
	.content {
	  width: 100%;
	  // background-color: #F6F7FA;
	  min-height: 100vh;
	  padding: 100rpx 30rpx 30rpx 30rpx;
	  background: url('../../../static/images/topbg.png') #F6F7FA no-repeat;
	  background-size: 100% 410rpx;
	  .studyDay {
	  	font-weight: bold;
	  	font-size: 36rpx;
	  	color: #FFFFFF;
	  	padding: 40rpx 0;
	  }
	    .card {
			background: #FFFFFF;
			border-radius: 20rpx;
			overflow: hidden;
			margin-top: 20rpx;
			&.card2 {
				padding: 20rpx;
			}
			.pd20 {
				padding: 20rpx;
			}
	      .tabs {
			  height: 84rpx;
			  background: #F6F7FA;
			  border-radius: 20rpx 20rpx 0px 0px;
			  display: flex;
			  line-height: 84rpx;
			  text-align: center;
	        .tab {
				  width: 160rpx;
				  font-weight: 500;
				  font-size: 28rpx;
				  &.active {
					  background: #fff;
				  }
	        }
	      }
	  
	      .statistics {
			  display: flex;
	        .statisticsItem {
				width: 25%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				height: 152rpx;
				&:last-child {
					background: linear-gradient(0deg, rgba(55,118,255,0) 0%, #EDF3FF 100%);
					border-radius: 10px;
					color: $themC;
					.text {
						color: $themC;
					}
				}
	          .num {
				font-family: DIN;
				font-weight: bold;
				font-size: 38rpx;
				margin-bottom: 6rpx;
	          }
	  
	          .text {
				font-size: 24rpx;
				color: #CCCCCC;
				margin-bottom: 16rpx;
	          }
	        }
	      }
	  
	      .h3 {
			font-weight: 500;
			font-size: 30rpx;
	      }
	  
	      .bgCard_row {
			  display: flex;
			  justify-content: space-between;
			  margin-top: 20rpx;
	        .bgCard {
				
				padding: 20rpx 0 0 30rpx;
				height: 172rpx;
				width: 48%;
				&:first-child {
					background: url('../../../static/images/mystudy1.png') no-repeat;
					background-size: 100% 100%;
					color: #24CBBA;
				}
				&:last-child {
					background: url('../../../static/images/mystudy2.png') no-repeat;
					background-size: 100% 100%;
					color: #F07634;
				}
	          .lab {
				font-size: 28rpx;
	          }
	  
	          .tps {
				font-size: 24rpx;
				opacity: 0.3;
				padding: 6rpx 0;
	          }
	  
	          .num {
				font-family: DIN;
				font-weight: bold;
				font-size: 36rpx;
	          }
	        }
	      }
	    }
		
		.tip {
			font-size: 24rpx;
			color: #ccc;
			padding: 10rpx 0 30rpx;
		}
		.tips {
			width: 360rpx;
			height: 48rpx;
			background: #DCE7FF;
			border-radius: 24rpx;
			font-size: 24rpx;
			color: $themC;
			text-align: center;
			line-height: 48rpx;
			margin-top: 30rpx;
		}
		.chartTab {
			display: flex;
			justify-content: space-between;
		  .btn_row {
			  display: flex;
			  width: 170rpx;
			  height: 44rpx;
			  border-radius: 8rpx;
			  overflow: hidden;
			  border: 1px solid $themC;
		    .btn.bg {
				background: #3776FF;
				color: #fff;
		    }
		
		    .btn {
				color: $themC;
				text-align: center;
				font-size: 28rpx;
				flex: 1;
		    }
		  }
		}
		.tables {
			width: 100%;
		  .fristTab.li {
			  background: #F4F4F4;
			  border-radius: 8rpx 8rpx 0 0;
		    .item {
				color: $themC;
		    }
		  }
		
		  .li {
			  height: 76rpx;
			  line-height: 76rpx;
			  border-bottom: 1rpx solid #F4F4F4;
			  display: flex;
		    .item {
				text-align: center;
				flex: 1;
				font-size: 28rpx;
		    }
		  }
		}
	}
	
	.btnE {
		width: 240rpx;
		margin: 30rpx auto 60rpx auto;
	}
</style>