<template>
    <uv-cell :title="item.title" :label="item.createTime" class="bg-white" is-link @click="goBrochure(null, item)"/>
</template>

<script setup>
import {createPropDefine} from "@/utils";
import {useDownload} from "@/hooks/useDownload";
import {useTransfer} from "@/hooks/useTransfer";

const props = defineProps({
    item: createPropDefine({}, Object),
    detail: createPropDefine({}, Object)
})

const {downloadFile} = useDownload()
const {transferTo} = useTransfer()

const goBrochure = (type, brochure = null) => {
    brochure = brochure || props.detail.enrollBrochures.find(b => b.type == type)
    if (!brochure) return
    if (brochure.url) return downloadFile(brochure.url)
    brochure['logo'] = props.detail.baseInfo.logo
    transferTo('/pages/college-library/introduction/introduction', brochure, null, true)
}
</script>

<style scoped lang="scss">
::v-deep(.uv-cell) {
    .uv-cell__title-text {
        font-size: 13px;
        line-height: 18px;
    }

    .uv-cell__label {
        margin-top: 2px;
    }

    .uv-cell-group__title {
        padding: 15px 12px 8px;
    }
}
</style>