 <template>
    <footer class="index_foot">
        <div class="foot_img_box"> 
            <a :href="item.url" v-for="(item, index) in bottomLink" :title="item.title" target="_blank">
                <img :src="item.logo_url" :alt="item.title">
            </a>
        </div>
        <div class="foot_frind_box">
            <span>友情链接</span>	 		
            <div>
                <a :href="item.url" v-for="(item, index) in bottomText" :key="index" :title="item.title" target="_blank">{{ item.title }}</a>	
            </div>
        </div>
        <div class="call_us_box">
            <span v-for="(item, index) in bottomMenu" :key="index">
                <NuxtLink :to="{ path: `/specialList/${item.id}` }" v-if="item.type == 1" :title="item.name">
                    {{ item.name }}
                </NuxtLink>
                <NuxtLink :to="{ path: `/speciaArticle/${item.id}` }" v-if="item.type == 0" :title="item.name">
                    {{ item.name }}
                </NuxtLink>
            </span>
        </div>
        <div class="foot_text_box" v-if="bottomBase">
            <p>{{ bottomBase.statistics_onetext }} <a :href="bottomBase.record_number_url" :title="中农兴业">中农兴业</a> {{ bottomBase.statistics_twotext }}</p>
            <p>{{ bottomBase.organizer }} <a :href="currentDomain" :title="webSiteName">{{ webSiteName }}</a> {{ webSiteUrl }} 版权所有。</p>
            <p><a :href="bottomBase.record_number_url" title="ICP备案号">{{ bottomBase.record_number }}</a> &nbsp;&nbsp; <img :src="bottomBase.icp_number_img"><a :href="bottomBase.icp_number_url" title="京公网安备案号">{{ bottomBase.icp_number }}</a> </p>
            <p>{{ bottomBase.email }}</p>
            <p>{{ bottomBase.company_address }}</p>
            <p>{{ bottomBase.contact_number }}</p>
        </div>
        <div class="foot_logo_out" v-if="bottomBase">
            <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>
        <div class="foot_last_img_box">
            <a :href="item.url" v-for="(item, index) in bottomphoto" :title="item.title">
                <img :src="item.logo_url" :alt="item.title">
            </a>
        </div>
 	</footer>	
</template>

<script setup>
//获得底部基本信息 start---------------------------------------->

//1.获得友情链接图片
const bottomLink = ref([])
async function getModelData1() {
    const mkdata =  await requestDataPromise('/web/selectWebsiteLinks', {
        method: 'GET',
        query: {
            'type':1,
            'num':12,
        },
    });
    if(mkdata.code == 200){
        bottomLink.value = mkdata.data;
    }else{
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取友情链接图片")
        console.log("后端错误反馈：",mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getModelData1();
//2.获得友情链接文字
const bottomText = ref([])
async function getModelData2() {
    const mkdata =  await requestDataPromise('/web/selectWebsiteLinks', {
        method: 'GET',
        query: {
            'type':2,
            'num':8,
        },
    });
    if(mkdata.code == 200){
        bottomText.value = mkdata.data;
    }else{
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取友情链接文字")
        console.log("后端错误反馈：",mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getModelData2();
//3.获得底部图片
const bottomphoto = ref([])
async function getModelData3() {
    const mkdata =  await requestDataPromise('/web/selectWebsiteLinks', {
        method: 'GET',
        query: {
            'type':3,
            'num':4,
        },
    });
    if(mkdata.code == 200){
        bottomphoto.value = mkdata.data;
    }else{
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取底部图片")
        console.log("后端错误反馈：",mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getModelData3();
//4.获得底部导航
const bottomMenu = ref([])
async function getModelData4() {
    const mkdata =  await requestDataPromise('/web/getWebsiteFooterCategory', {
        method: 'GET',
        query: {
        },
    });
    if(mkdata.code == 200){
        bottomMenu.value = mkdata.data;
    }else{
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取底部导航")
        console.log("后端错误反馈：",mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getModelData4();
//5.获得底部基本信息
const bottomBase = ref({})
const webSiteName = ref("")
const webSiteUrl = ref("")
async function getModelData5() {
    const mkdata =  await requestDataPromise('/web/getWebsiteFootInfo', {
        method: 'GET',
        query: {
        },
    });
    if(mkdata.code == 200){
        bottomBase.value = mkdata.data.website_foot;
        webSiteName.value = mkdata.data.website_head.title;
        //获得最后一个域名
        webSiteUrl.value = mkdata.data.website_head.website_url[mkdata.data.website_head.website_url.length - 1];
    }else{
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取底部基本信息")
        console.log("后端错误反馈：",mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getModelData5();

//6.获取当前域名
// 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 //协议和域名
//     }
// }
// getDomain();
//获得底部基本信息 end---------------------------------------->
</script>

<style lang="less" scoped>
    @import '@/assets/css/foot.less';
</style>