<template>
    <view class="page-content">
        <mx-nav-bar title="院校动态"/>
        <view class="bg-white px-20 pt-20">
            <uv-text size="18" bold :text="prevData.title"/>
        </view>
        <uv-sticky>
            <view class="fx-row fx-bet-cen bg-white mx-border-b p-20">
                <uv-text size="13" :icon-style="{width: '22px', height: '20px'}" :prefix-icon="prevData.logo"
                         :text="prevData.editor"/>
                <text class="text-tips text-xs">{{ prevData.createTime.split(' ')[0] }}</text>
            </view>
        </uv-sticky>
        <view class="mt-20 bg-white p-30 text-xs text-content">
            <uv-parse :content="detail.content||prevData.content"/>
        </view>
        <uv-back-top :scroll-top="scrollTop"/>
    </view>
</template>

<script setup>
import {ref, onMounted} from 'vue'
import {getUniversitiesEnrollBrochureDetail} from "@/api/webApi/collegemajor";
import {useTransfer} from "@/hooks/useTransfer";
import {useCacheStore} from "@/hooks/useCacheStore";
import {useProvidePageScroll} from "@/hooks/usePageScrollInjection";


const detail = ref({})
const {prevData} = useTransfer()
const {dispatchCache} = useCacheStore()
const scrollTop = useProvidePageScroll()

onMounted(async () => {
    const {id, content} = prevData.value
    if (id && !content) {
        const payload = {id}
        const res = await dispatchCache(getUniversitiesEnrollBrochureDetail, payload)
        detail.value = res.data
    }
})
</script>

<style>
</style>
