<template>
    <ie-page bg-color="#F6F8FA">
        <ie-navbar title="测职业技能分"/>
        <ie-image is-oss src="/volunteer/skill/index/bg.png" custom-class="w-full h-600 absolute"/>
        <view class="p-28 z-2">
            <view class="rounded-xl overflow-hidden">
                <college-item :item="target.info" hidden-star reverse/>
                <uv-line/>
                <college-summary :college="target.info"/>
            </view>
            <skill-result />
        </view>
        <ie-safe-toolbar :height="84" :shadow="false">
            <view class="px-30 py-16">
                <ie-button @click="handleSubmit">加入志愿表</ie-button>
            </view>
        </ie-safe-toolbar>
    </ie-page>
</template>

<script setup lang="ts">

import {VOLUNTARY_TARGET, VOLUNTARY_RULES, VOLUNTARY_MODEL, VOLUNTARY_RESULT} from "@/types/injectionSymbols";
import {useTransferPage} from "@/hooks/useTransferPage";
import {VoluntaryDto} from "@/types/voluntary";
import VoluntaryFormMajor from "@/pagesOther/pages/voluntary/index/components/voluntary-form-major.vue";
import CollegeItem from "@/pagesOther/pages/university/index/components/plus/college-item.vue";
import CollegeSummary from "@/pagesOther/pages/university/index/components/plus/college-summary.vue";
import SkillResult from "@/pagesOther/pages/skill/result/components/skill-result.vue";
import {addVoluntary} from "@/api/modules/voluntary";

const {prevData} = useTransferPage<VoluntaryDto, any>()
const target = computed(() => prevData.value.target || {})
const rules = computed(() => prevData.value.rules || [])
const model = computed(() => prevData.value.model || {})
const result = computed(() => prevData.value.result || {})

const handleSubmit = async () => {
    await addVoluntary(target.value)
    uni.$ie.showSuccess('保存成功')
}

provide(VOLUNTARY_TARGET, target)
provide(VOLUNTARY_RULES, rules)
provide(VOLUNTARY_MODEL, model)
provide(VOLUNTARY_RESULT, result)
// 为了让子组件触发页面滚动
onPageScroll(() => {
})
</script>

<style lang="scss">

</style>
