<template>
    <div class="footer">
        <div class="inner">
            <!-- 图片列表 -->
            <ul class="logoList">
                <li v-for="(item, index) in bottomLink" :key=index class="left">
                    <a :href="item.url">
                        <img :src="item.logo_url" alt="">
                    </a>
                </li>
            </ul>
            <!-- 友情链接 -->
            <div class="link">
                <h5 class="left">友情链接</h5>
                <ul class="left">
                    <li v-for="(item, index) in bottomText" :key="index">
                        <a :href="item.url">{{ item.title }}</a>
                    </li>
                </ul>
            </div>
            <!-- 快捷服务 -->
            <div class="service">
                <h5 class="left">快捷服务</h5>
                <p class="left">
                    <span v-for="(item, index) in bottomMenu" :key="index">
                        <NuxtLink :to="{ path: `/specialList/${item.id}` }" target="_blank" v-if="item.type == 1">
                            {{ item.name }}
                        </NuxtLink>
                        <NuxtLink :to="{ path: `/speciaArticle/${item.id}` }" target="_blank" v-if="item.type == 0">
                            {{ item.name }}
                        </NuxtLink>
                    </span>
                </p>
            </div>
            <div class="tips" v-if="bottomBase">
                <p>{{ bottomBase.statement }} <a :href="currentDomain">三农资讯网</a> {{ bottomBase.statement_two }}</p>
            </div>
            <div class="tipsList" v-if="bottomBase">
                <!-- <p>{{ bottomBase.statistics_onetext }} <a :href="'http://' + bottomBase.statistics_twourl">中农兴业</a> {{ bottomBase.statistics_twotext }}</p> -->
                <p>{{ bottomBase.statistics_onetext }} <a :href="bottomBase.record_number_url">中农兴业</a> {{ bottomBase.statistics_twotext }}</p>
                <p>{{ bottomBase.organizer }} <a :href="currentDomain">三农资讯网</a> {{ currentDomainUrl }} 版权所有。</p>
                <!-- <p><img :src="bottomBase.icp_number_img"><a :href="'http://' + bottomBase.statistics_twourl">{{ bottomBase.record_number }}</a> <a :href="'http://' + bottomBase.icp_number_url">{{ bottomBase.icp_number }}</a> </p> -->
                <p><a :href="bottomBase.record_number_url">{{ bottomBase.record_number }}</a> &nbsp;&nbsp; <img :src="bottomBase.icp_number_img"><a :href="bottomBase.icp_number_url">{{ bottomBase.icp_number }}</a> </p>
                <p>{{ bottomBase.email }}</p>
                <p>{{ bottomBase.company_address }}</p>
                <p>{{ bottomBase.contact_number }}</p>
                <a :href="'http://' + bottomBase.company_url" :title="bottomBase.company_name">
                    <img :src="bottomBase.project_logo" class="floatLogoLeft" :alt="bottomBase.company_name">
                </a>
                <a :href="'http://' + bottomBase.project_url" :title="bottomBase.project_name">
                    <img :src="bottomBase.company_logo" class="floatLogoRight" :alt="bottomBase.project_name">
                </a>
            </div>

            
            <!-- 图片列表 -->
            <ul class="logoList1">
                <li v-for="(item, index) in bottomphoto" :key=index class="left">
                    <a :href="item.url">
                        <img :src="item.logo_url" alt="">
                    </a>
                </li>
            </ul>
        </div>
    </div>
</template>

<script setup>
import { onMounted } from 'vue';
const nuxtApp = useNuxtApp();
const axios = nuxtApp.$axios;

// const props = defineProps({
//     bottomLink: Array,
//     bottomMenu: Array,
//     bottomBase: Object
// });

//获得友情链接 图片
const bottomLink = ref([])
const getBottomLink = async () => {
    const response = await axios.get(`/web/selectWebsiteLinks?&type=${1}&num=${7}`);
    bottomLink.value = response.data;
    console.log(bottomLink.value)
}
//文字
const bottomText = ref([])
const getBottomLink2 = async () => {
    const response = await axios.get(`/web/selectWebsiteLinks?&type=${2}&num=${8}`);
    bottomText.value = response.data;
    console.log(bottomLink.value)
}
//底部
const bottomphoto = ref([])
const getBottomLink1 = async () => {
    const response = await axios.get(`/web/selectWebsiteLinks?&type=${3}&num=${4}`);
    bottomphoto.value = response.data;
    console.log(bottomphoto.value)
}

//获得底部导航
const bottomMenu = ref([])
const getBottomMenu = async () => {
    const response = await axios.get(`/web/getWebsiteFooterCategory`);
    bottomMenu.value = response.data;
    console.log(bottomMenu.value)
}

//获得底部基本信息
const bottomBase = ref({})
const getBottomBase = async () => {
    const response = await axios.get(`/web/getWebsiteFootInfo`);
    bottomBase.value = response.data.website_foot;
    console.log(7777777)
    console.log('bottomBase', bottomBase.value)
}


onMounted(() => {
    getBottomLink();
    getBottomLink1();
    getBottomLink2();
    getBottomMenu();
    getBottomBase();
    //获取域名
    getDomain()
})

//获取当前域名
const currentDomain = ref('')
const currentDomainUrl = ref('')

const getDomain = () => {
    if (process.client) {
        const url = new URL(window.location.href)
        currentDomainUrl.value = url.hostname // 获取域名
        currentDomain.value = url.origin //协议和域名
    }
}
</script>

<style lang="less" scoped>
.footer {
    width: 100%;
    height: 595px;
    background-color: #40663b;
    overflow: hidden;

    .inner {
        width: 1200px;
        height: 100%;

        // 图片列表
        .logoList {
            height: 50px;
            margin-top: 43px;

            >li {
                width: 150px;
                height: 50px;
                margin-right: 25px;

                img {
                    width: 150px;
                    height: 50px;

                }
            }

            >li:nth-child(7) {
                margin-right: 0;
            }

        }

        .link,
        .service {
            width: 1200px;
            height: 26px;
            padding-left: 40px;
            box-sizing: border-box;

            >h5 {
                width: 48px;
                height: 18px;
                line-height: 18px;
                font-family: Source Han Sans, Source Han Sans;
                font-weight: bold;
                font-size: 12px;
                color: #FFFFFF;
                text-align: center;
                font-style: normal;
                text-transform: none;
            }
        }

        //友情链接
        .link {
            margin-top: 47px;
            width: 1200px;
            border-bottom: 1px solid #fff;

            h5 {
                margin-right: 109px;
            }

            >ul>li {
                margin-right: 40px;
            }

            ul>li {
                float: left;

                >a {
                    font-family: Source Han Sans, Source Han Sans;
                    font-weight: 500;
                    font-size: 12px;
                    color: #FFFFFF;
                    line-height: 18px;
                    text-align: center;
                    font-style: normal;
                    text-transform: none;
                }
            }


        }

        //快捷服务
        .service {
            width: 1200px;
            margin-top: 8px;

            h5 {
                margin-right: 80px;
            }

            >p {
                >span {
                    border-right: 1px solid #fff;

                    >a {
                        font-family: Source Han Sans, Source Han Sans;
                        font-weight: 400;
                        font-size: 12px;
                        color: #FFFFFF;
                        line-height: 18px;
                        text-align: center;
                        font-style: normal;
                        text-transform: none;
                        padding: 0 13px;
                    }
                }

                >span:last-child {
                    border: none;
                }
            }


        }

        p {
            font-family: Inter, Inter;
            font-weight: bold;
            font-size: 12px;
            color: #FFFFFF;
            line-height: 14px;
            text-align: center;
            font-style: normal;
            text-transform: none;
            

            >em {
                display: inline-block;
                width: 20px;
                height: 20px;
                background-image: url("../../static/images/beian 1.png");
                vertical-align: middle;

            }
        }

        .tips {
            width: 784px;
            height: 30px;
            margin: 70px auto 30px;
            p {
                line-height: 22px;
            }
            a {
                color: #fff;
                text-decoration: underline;
            }
        }

        .tipsList {
            margin: 0 auto;
            width: 750px;
            height: 108px;
            line-height: 30px;
            position: relative;
            .floatLogoLeft,.floatLogoRight {
                position: absolute;
                top:-50px;
                width: 120px;
                height: 120px;
            }
            .floatLogoLeft {
                left: -220px;
            }
            .floatLogoRight {
                right: -220px;
            }
            p {
                line-height: 22px;
            }
            img {
                display: inline-block;
                vertical-align: middle;
                margin-right: 5px;
                margin-top: -2px;
            }
            a {
                color: #fff;
                text-decoration: underline;
            }
        }

        .logoList1 {
            width: 445px;
            height: 40px;
            margin: 70px auto 57px;

            >li {
                width: 96px;
                height: 40px;
                margin-right: 20px;

                img {
                    width: 96px;
                    height: 40px;
                }
            }

            >li:last-child {
                margin-right: 0px;
            }

        }
    }
}
</style>