<template>
	<view>
		<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
		<view class="relative" v-if="!getLoading"
			style="width: 100%;background-image: url(https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E8%80%83%E5%89%8D%E5%AF%86%E5%8D%B7_20230904212623.png);background-size: 100% 100%;height: 100vh;">
			<view style="position: absolute;top: 320px;" class="wp100 p35lr flex jc-sb ai-c">
				<view class="paper_item" @tap="toExam({isExam1:'1'})">
					<view class="topTitle">
						秘卷一
					</view>
					<view class="bottom">
						<text class="wenzi">新规考点提炼</text>
						<view class="wp100 p5 mt15">
							<view class="btn">
								去考试
							</view>
						</view>
					</view>
				</view>
				<view class="paper_item" @tap="toExam({isExam2:'1'})">
					<view class="topTitle">
						秘卷二
					</view>
					<view class="bottom">
						<text class="wenzi">精选高频考试</text>
						<view class="wp100 p5 mt15">
							<view class="btn">
								去考试
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'pinia' //引入映射函数
	import useQuestionStore from '@/jtools/store/question' //引入store
	import storage from '@/jtools/storage';
	import {
		queryQuestionId,
		getTestQuestionId
	} from '@/jtools/api/question';
	export default {
		data() {
			return {
				subject:'1'
			}
		},
		onLoad(op){
			if(op.subject){
				this.subject=op.subject
			}
		},
		computed: {
			...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "curSubject","version"]), //映射函数，取出tagslist
			getLoading() {
				return this.loading_subject4 && this.loading_subject1
			}
		},
		methods: {
			...mapActions(useQuestionStore, ['getOrderQuestion_sub4', 'getOrderQuestion_sub1', 'changeSubject']),
			toExam(param) {
				queryQuestionId({
					versionId: this.version,
					carTypeId: storage.get('carType') || '1001',
					subject: this.subject,
					...param
				}).then(async (resp) => {
						if (resp.code === '0000') {
							const arr = resp.data
							const listJson = JSON.stringify(arr)
							uni.navigateTo({
							url: "/pages/questionBank/practiceExams?title=考前秘卷&subject=" + this.subject + "&questionIdList=" + listJson
							})
						}
					})

				},
			}
		}
</script>

<style scoped>
	.paper_item {
		width: 287rpx;
		height: 320rpx;
		/* border: 4px solid #F8A42C; */
		border-radius: 16rpx;
	}

	.topTitle {
		width: 100%;
		height: 85rpx;
		line-height: 85rpx;
		text-align: center;
		background: linear-gradient(90deg, #E66501 0%, #F8A42C 100%);
		border-radius: 16rpx 16rpx 0rpx 0rpx;
		font-size: 48rpx;
		font-family: PingFang SC;
		font-weight: 600;
		color: #FFFFFF;
	}

	.bottom {
		padding-top: 15px;
		width: 100%;
		height: 235rpx;
		border-radius: 0rpx 0rpx 16rpx 16rpx;
		border-bottom: 4px solid #F8A42C;
		border-left: 4px solid #F8A42C;
		border-right: 4px solid #F8A42C;
		text-align: center;
	}

	.wenzi {
		font-size: 40rpx;
		font-family: PingFang SC;
		font-weight: 600;
		color: #7D4310;
		line-height: 48rpx;
	}

	.btn {
		width: 246rpx;
		height: 76rpx;
		text-align: center;
		line-height: 76rpx;
		color: #fff;
		background: linear-gradient(0deg, #E66501 0%, #F8A42C 100%);
		box-shadow: 0rpx 2rpx 21rpx 0rpx #F7A12A;
		border-radius: 38rpx;
	}
</style>