<template>
	<view class="po-r">
		<image class="bg" src="" mode=""></image>
		<view class="po-a content w-100">
			<view class="top bg-fff">
				<view class="com-title size-32 fw700 flex-rowl">
					您选择的宠物类型
				</view>
				<image class="mt32" :src="petTypeImg" mode="widthFix"></image>
			</view>

			<view class="text po-r bg-fff">
				<up-parse class="size-28" :content="configList.pet_raising_details.paramValueArea"></up-parse>
				<view class="po-a flex-rowl tips">
					<image class="ml16" src="@/static/images/ydd/icon1.png" mode="widthFix"></image>
					<text class="size-28 ml16">养宠考试说明</text>
				</view>
			</view>

			<view class="text po-r bg-fff mb150">
				<up-parse class="size-28" :content="configList.pet_attention_details.paramValueArea"></up-parse>
				<view class="po-a flex-rowl tips">
					<image class="ml16" src="@/static/images/ydd/icon2.png" mode="widthFix"></image>
					<text class="size-28 ml16">考试注意事项</text>
				</view>
			</view>


		</view>
		<view class="footer-btn flex-colc">
			<view class="size-22 color-777 tips-rest">
				<!-- todo -->
				剩余考试机会：<text class="highlight">{{ restTimes }}</text>次
			</view>
			<view class="btn" @click="toNext">
				开始考试
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref, computed } from 'vue'
	import { useStore } from 'vuex'
	import { onLoad } from '@dcloudio/uni-app'
	
	const store = useStore()

	const petType = ref()
	const restTimes = ref()

	const configList = computed(() => {
		return store.getters.configList
	})
	
	const petTypeImg = computed(() => {
		return store.getters.petTypeOptions.find(item => item.id == petType.value)?.image
	})
	
	onLoad((option) => {
    store.dispatch('fetchPetTypeOptions')

		petType.value = option.petType

		// todo: fetch
		restTimes.value = parseInt(configList.value.pet_work_num.paramValueText || 0)
	})

	const toNext = () => {
		uni.navigateTo({
			url: "/otherPages/authentication/examination/base"
		})
	}
</script>

<style lang="scss" scoped>
	.mb150 {
		margin-bottom: 150rpx;
	}

	.text {
		padding: 50rpx 37rpx;
		border-radius: 20rpx;
		margin-top: 43px;
	}

	.tips {
		width: 302rpx;
		height: 67rpx;
		background-color: #FFEBCE;
		top: -28rpx;
		left: 20rpx;
		border-radius: 0 90rpx 0 0;

		image {
			width: 40rpx;
		}
	}

	.content {
		padding: 16rpx;
		width: 718rpx;
		left: 0;
		top: 0;
	}

	.bg {
		width: 750rpx;
		height: 432px;
		background-image: linear-gradient(to bottom, #FFBF60, #f5f5f5);
	}

	.top {
		padding: 46rpx 17rpx 17rpx;
		margin: 16rpx;
		border-radius: 20rpx;

		image {
			width: 198rpx;
		}
	}

	.tips {
		&-rest {
			color: #707070;
			font-size: 22rpx;
			margin: 9rpx 0 13rpx 0;
			.highlight {
				color: #FF8DC6;
			}
		}
	}

	.footer-btn {
		height: 163rpx;
		box-sizing: border-box;
		padding-bottom: 18rpx;
	}
</style>