<template>
  <view class="notice">
    <uni-section title="选择的宠物类型" type="line" titleFontSize="32rpx"></uni-section>
    <u-cell>
      <template #label>
        <uni-data-checkbox mode="button" multiple v-model="type" :localdata="typeData"></uni-data-checkbox>
      </template>
    </u-cell>
    <uni-section title="考试说明" type="line" titleFontSize="32rpx"></uni-section>
    <u-cell>
      <template #label>
        <view class="line-h200">1、题目类型：单选题</view>
        <view class="line-h200">2、题目数量：34道</view>
        <view class="line-h200">3、通过要求：准确率100%</view>
        <view class="line-h200">4、考核内容：</view>
        <view class="line-h200">
          个人经验：10道，本部分是基于平台对于伴宠师入驻门槛条件的问题审核，需要完全符合，否则考试将直接失败；
        </view>
        <view class="line-h200">
          养宠理念及常识：30道，本部分是对伴宠师养宠经验及理念的基础考核，均为单选题，大多是科学养宠所涉及的常识题，以客观事实判定标准答案。
        </view>
      </template>
    </u-cell>
    <uni-section title="考试注意事项" type="line" titleFontSize="32rpx"></uni-section>
    <u-cell>
      <template #label>
        <view class="line-h200">1、关注家养宠物，不考虑流浪动物、散养等特殊情况</view>
        <view class="line-h200">
          2、所以题目适用于家养宠物，暂不考虑经过训练的宠物、流浪猫狗、小部分习惯习性差异较大的特殊情况
        </view>
        <view class="line-h200">3、仅有3次考核机会，如未通过，将无法再考核入驻</view>
        <view class="line-h200">
          4、为保证猫妈狗爸平台的服务质量，需要对伴宠师进行严格筛选，所以每位伴宠师的答题次数仅3次，3次内回答准确率达标1次即可通过，均未达标则无法再次答题。需等待半年后再次认证。
        </view>
        <view class="line-h200">5、系统不会给出错误提示，请自行检查</view>
      </template>
    </u-cell>
  </view>
  <submitBut text="开始考试" @click="handleClick" :disabled="(sumNum - answerCount) < 1">
    <template #tips>
      <view class="tips-sum">剩余考试机会：
        <text>{{ sumNum - answerCount }}</text>
        次
      </view>
    </template>
  </submitBut>
</template>
<script setup>
import {ref} from "vue";
import {onShow} from '@dcloudio/uni-app'
import submitBut from "../../../components/submitBut/index.vue"
import tab from "@/plugins/tab";
import {getStorage} from "../../../utils/auth";
import modal from "../../../plugins/modal";
import { useStore } from 'vuex'

const store = useStore()

const configList = computed(() => {
  return store.getters.configList
})

onShow(() => {
  answerCount.value = getStorage("userInfo").answerCount
  console.log(answerCount.value);
})
const type = getStorage("userInfo")?.petType?.split(',')
const sumNum = computed(() => {
  return parseInt(configList.value.pet_work_num.paramValueText || 0)
})
const answerCount = ref(0)
const typeData = ref(
    [
      {value: '1', text: "猫咪", disable: true},
      {value: '2', text: "狗狗", disable: true},
      {value: '3', text: "异宠", disable: true}
    ]
)
const handleClick = () => {
  if (sumNum.value - answerCount.value > 0) {
    tab.navigateTo("/otherPages/workbenchManage/startExam/index")
  } else {
    modal.msg("考试机会已用完")
  }
}
</script>

<style scoped lang="scss">
@import "index";
</style>