<template>
    <!-- 一级标题页导航 -->
    <div class="sannongzhichuang">
        <div class="inner">
            <h2>
                <!-- 三农之窗 -->
                {{ title.name }}
                <em class="iconfont icon-xingzhuang-zhijiaosanjiaoxing-copy"></em>
            </h2>
            <p class="introduction">
                <strong>频道介绍</strong>
                <div v-for="(item,index) in titleData">
                    <span v-if="index<=7">
                        <!-- <NuxtLink :to="`/newsList/${item.id}`" target="_blank">{{ item.name }}</NuxtLink> -->
                        <NuxtLink :to="{ path: `/newsList/${item.category_id}`, query: { catid: item.category_id } }" target="_blank">{{ item.name }}</NuxtLink>
                    </span>
                </div>
            </p>
        </div>
    </div>
</template>

<script setup>
import { onMounted } from 'vue'

const props = defineProps({
    titleName: String,
    titleData:Array
});

//获得axios
const nuxtApp = useNuxtApp();
const axios = nuxtApp.$axios;
//let ChannelList = ['理论前沿', '典型经验', '魅力乡村', '农民之家', '农业天地', '农村建设', '高端资讯', '实践探索']

//获得跳转过来的id
const route = useRoute();
const routeId = route.params.id; //获得该页面的id
const routeName = route.query.name; //获得该页面的名称

const title = ref("")
const getTitle = async () => {
    try {
        const response = await axios.get(`/web/getOneWebsiteCategory?catid=${routeId}`);
        title.value = response.data;
    } catch (error) {
        console.error(error);
    }
}

onMounted(() => {
    getTitle()
})

</script>

<style lang="less" scoped>
// 三农之窗
.sannongzhichuang {
    margin: 30px 0 40px;

    .inner {
        width: 1200px;
        height: 67px;
        position: relative;
    }

    h2 {
        display: inline-block;
        background-image: url("../../static/image/bg1.png");
        width: 156px;
        height: 43px;
        padding: 14px 31px 10px 25px;
        font-family: STXingkai, STXingkai;
        font-weight: 400;
        font-size: 39px;
        color: #FFFFFF;
        line-height: 46px;
        text-align: center;
        font-style: normal;
        text-transform: none;
        -webkit-text-stroke: 1px #3C6C47;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 99;

        em {
            position: absolute;
            top: -16px;
            right: -12px;
            color: #185410;
            display: inline-block;
            width: 13px;
            height: 13px;
        }
    }

    p.introduction {
        display: inline-block;
        width: 1003px;
        height: 56px;
        line-height: 56px;
        background-color: #fafafa;
        position: absolute;
        bottom: 0;
        right: 0;
        display: flex;

        >strong:first-child {
            margin-left: 40px;
            display: inline-block;
            vertical-align: middle;
            width: 28px;
            height: 36px;
            padding: 3px 7px;
            border: 0.5px solid #129502;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: bold;
            font-size: 14px;
            color: #139602;
            line-height: 18px;
            text-align: center;
            font-style: normal;
            text-transform: none;

        }

        div {
            
            >span {
                width: 64px;
                height: 21px;
                font-family: Microsoft YaHei, Microsoft YaHei;
                font-weight: 400;
                font-size: 16px;
                color: #000000;
                line-height: 21px;
                text-align: left;
                font-style: normal;
                text-transform: none;
                margin-top: 17px;
                padding: 0 24px;
                border-right: 1px solid #ccc;

                a {
                    color: #000;
                }
            }

            >span:hover a {
                color: #139602;
            }

            >span:last-child {
                border: none;
            }
        }
        
    }
}
</style>