<style scoped>
	.WrongContent {
		padding: 40rpx;
		background-color: #F5F5F5;
		height: 93vh;
	}

	.Wrong_Top {
		display: flex;
		margin-bottom:37rpx;
	}

	.Wrong_Top>view {
		flex: 1;
		height: 270rpx;
		background-color: #fff;
		padding: 40rpx 32rpx;
		margin-right: 32rpx;
		border-radius: 24rpx;
	}

	.Wr_Name {
		color: #111111;
		font-size: 28rpx;
		margin-bottom: 40rpx;
	}

	.img_Box img {
		width: 87rpx;
		height: 87rpx;
	}

	.Wr_Total {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 40rpx;
	}

	.Wr_Fuxi {
		color: #4C50E7;
		font-size: 24rpx;
	}

	.Wr_Current {
		font-size: 40rpx;
		color: #FA9717;
	}

	.Wr_CurTotal {
		color: #888888;
		font-size: 25rpx;
	}
</style>
<template>
	<view class="WrongContent">
		<view class="Wrong_Top">
			<view @click="goWrongTopic(3,dataObj.wordsWrongTotalCount)">
				<view class="Wr_Name">单词</view>
				<view class="img_Box">
					<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/word.png"
						alt="" />
				</view>
				<view class="Wr_Total" v-if="Object.keys(dataObj).length>0">
					<view>
						<text class="Wr_Current">{{dataObj.wordsWrongFinishCount}}</text><text class="Wr_CurTotal">/{{dataObj.wordsWrongTotalCount}}</text>
					</view>
					<view class="Wr_Fuxi">
						<text v-if="dataObj.wordsWrongFinishCount==0">未复习</text>
						<text v-if="dataObj.wordsWrongFinishCount>0&&dataObj.wordsWrongFinishCount<dataObj.wordsWrongTotalCount">复习中</text>
						<text v-if="dataObj.wordsWrongFinishCount>0&&dataObj.wordsWrongFinishCount==dataObj.wordsWrongTotalCount">复习完毕</text>
					</view>
				</view>
			</view>
			<view style="margin-right:0;" @click="goWrongTopic(4,dataObj.grammarWrongTotalCount)">
				<view class="Wr_Name">语法</view>
				<view class="img_Box">
					<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/gramer.png"
						alt="" />
				</view>
				<view class="Wr_Total" v-if="Object.keys(dataObj).length>0">
					<view>
						<text class="Wr_Current">{{dataObj.grammarWrongFinishCount}}</text><text class="Wr_CurTotal">/{{dataObj.grammarWrongTotalCount}}</text>
					</view>
					<view class="Wr_Fuxi">
						<text v-if="dataObj.grammarWrongFinishCount==0">未复习</text>
						<text v-if="dataObj.grammarWrongFinishCount>0&&dataObj.grammarWrongFinishCount<dataObj.grammarWrongTotalCount">复习中</text>
						<text v-if="dataObj.grammarWrongFinishCount>0&&dataObj.grammarWrongFinishCount==dataObj.grammarWrongTotalCount">复习完毕</text>
					</view>
				</view>
			</view>
		</view>
		<view class="Wrong_Top" @click="goWrongTopic(5,dataObj.readingWrongTotalCount)">
			<view>
				<view class="Wr_Name">阅读理解</view>
				<view class="img_Box">
					<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/read.png"
						alt="" />
				</view>
				<view class="Wr_Total" v-if="Object.keys(dataObj).length>0">
					<view>
						<text class="Wr_Current">{{dataObj.readingWrongFinishCount}}</text><text class="Wr_CurTotal">/{{dataObj.readingWrongTotalCount}}</text>
					</view>
					<view class="Wr_Fuxi">
						<text v-if="dataObj.readingWrongFinishCount==0">未复习</text>
						<text v-if="dataObj.readingWrongFinishCount>0&&dataObj.readingWrongFinishCount<dataObj.readingWrongTotalCount">复习中</text>
						<text v-if="dataObj.readingWrongFinishCount>0&&dataObj.readingWrongFinishCount==dataObj.readingWrongTotalCount">复习完毕</text>
					</view>
				</view>
			</view>
			<view style="margin-right:0;" @click="goWrongTopic(6,dataObj.listeningWrongTotalCount)">
				<view class="Wr_Name">听力</view>
				<view class="img_Box">
					<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/listen.png"
						alt="" />
				</view>
				<view class="Wr_Total" v-if="Object.keys(dataObj).length>0">
					<view>
						<text class="Wr_Current">{{dataObj.listeningWrongFinishCount}}</text><text class="Wr_CurTotal">/{{dataObj.listeningWrongTotalCount}}</text>
					</view>
					<view class="Wr_Fuxi">
						<text v-if="dataObj.listeningWrongFinishCount==0">未复习</text>
						<text v-if="dataObj.listeningWrongFinishCount>0&&dataObj.listeningWrongFinishCount<dataObj.listeningWrongTotalCount">复习中</text>
						<text v-if="dataObj.listeningWrongFinishCount>0&&dataObj.listeningWrongFinishCount==dataObj.listeningWrongTotalCount">复习完毕</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		ref,
		reactive,
		toRefs,
		toRef,
		getCurrentInstance,
		watch,
		computed,
		onMounted,
	} from "vue";
	import {GetPracticeWrongStatic} from "../../api/exam";
	export default {
		components: {

		},
		setup(props, ctx) {
			let data = reactive({
				pageState: "more",
				msg: {
					StudentId:0
				},
				dataObj: {},
			});
			let methods = {
				getWrongTotal(){
					GetPracticeWrongStatic(data.msg).then(res=>{
						console.log(res,'数据');
						if(res.Code==1){
							data.dataObj = res.Data;
						}
					})
				},
				//跳转
				goWrongTopic(Type,count){
					if(count>0){
						let StartId=0;
						//3单词 4语法 5阅读理解 6听力
						if(Type==3){
							StartId = data.dataObj.wordsWrongStartId;
						}
						if(Type==4){
							StartId = data.dataObj.grammarWrongStartId;
						}
						if(Type==5){
							StartId = data.dataObj.readingWrongStartId;
						}
						if(Type==6){
							StartId = data.dataObj.listeningWrongStartId;
						}
						uni.navigateTo({
							url: "/pages/exam/examGongu?StartId="+StartId+'&&Type='+Type
						});
					}
				}
			};
			let that = methods;
			return {
				...toRefs(data),
				...methods,
			};
		},
		onLoad(options) {
			uni.setNavigationBarTitle({
				title: "错题库"
			});
		},
		onShow() {
			let UserInfo = uni.getStorageSync('userInfo');
			this.msg.StudentId = UserInfo.AccountId;
			this.getWrongTotal();
		}
	};
</script>

<style>
</style>
