<template>
    <view class="bg-gradient-to-br from-primary-deep to-primary-light mx-card fx-col gap-20 p-30 text-2xs text-white">
        <view class="fx-row fx-bet-cen">
            <text>专业类别：{{ majorCategory.name }}</text>
            <text>省份：{{ userSnapshot.provinceName }}</text>
        </view>
        <view class="fx-row fx-bet-cen">
            <text>考生类别：{{ userSnapshot.examType }}</text>
            <view class="fx-row fx-end-center">
                <uv-icon name="clock" color="white"></uv-icon>
                <text class="text-right ml-10">{{ data.createTime }}</text>
            </view>
        </view>
    </view>
</template>
<script>

import {findTreeNode} from "@/utils/tree-helper";
import {useInjectUserSnapshot} from "@/pages/ie/hooks/useUserSnapshotInjection";
import {useInjectMajorTreeService} from "@/pages/ie/hooks/useMajorTreeInjection";

export default {
    name: 'voluntary-card',
    props: {
        data: {
            type: Object,
            default: () => ({})
        }
    },
    setup() {
        const {userSnapshot} = useInjectUserSnapshot()
        const {majorTree} = useInjectMajorTreeService()

        return {
            userSnapshot,
            majorTree
        }
    },
    computed: {
        majorCategory() {
            if (!this.majorTree) return {}
            return findTreeNode(this.majorTree, n => n.code == this.data.request?.majorCategory) || {}
        }
    }
};
</script>
<style lang="scss" scoped>
</style>
