<template>
    <div class="conatiner">
        <el-carousel class="swiper banner" :class="[bannerList.length==1?'noButton':'']" height="220px" :interval="4000">
            <template v-for="item in bannerList">
                <el-carousel-item :style="{backgroundImage:'url('+item.imageUrl+')'}">
                    <a v-if="item.url" :href="item.url"></a>
                </el-carousel-item>
            </template>

        </el-carousel>

        <div class="content">
            <div class="name">
                <div class="kuai"></div>
                <span>加入我们</span>
            </div>

            <div class="content-content">

                <div class="content-text">
                    <div class="title">{{contactInfo.companyName}}</div>
                    <div class="content-all">
                        <div v-if="contactInfo.telephone">
                            <img style="width:18px;height:18px" src="../assetsPre/contact2.png" alt="">
                            <span>电话：{{contactInfo.telephone}}</span>
                        </div>
                        <div v-if="contactInfo.faxes">
                            <img style="width:17px;height:17px" src="../assetsPre/contact4.png" alt="">
                            <span>传真：{{contactInfo.faxes}} </span>
                        </div>
                        <div v-if="contactInfo.postcode">
                            <img style="width:15px;height:12px" src="../assetsPre/contact3.png" alt="">
                            <span>邮编：{{contactInfo.postcode}} </span>
                        </div>
                        <div v-if="contactInfo.address">
                            <img style="width:12px;height:17px" src="../assetsPre/contact5.png" alt="">
                            <span>地址：{{contactInfo.address}}</span>
                        </div>
                    </div>
                </div>

                <div class="line"></div>

                <div class="content-img">
                    <img src="../assetsPre/contact1.png" alt="">
                    <div class="ps" style="margin-top:23px;" v-if="contactInfo.servicePhone">
                        全国免费服务热线 {{contactInfo.servicePhone}}
                    </div>
                    <div class="ps" style="margin-top:8px;" v-if="contactInfo.serviceTime">
                        客服时间 {{contactInfo.serviceTime}}
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'home',
    data() {
        return {
            contactInfo: {},
            bannerList: []
        }
    },
    mounted() {
        this.$http.get({
            url: '/contactUs/getOne',
            data: {
                id: 1
            }
        }).then(res => {
            if (res.success) {
                this.contactInfo = res.data
            }
        }).catch(e => {
            console.log(e)
        })

        this.$http.get({
            url: '/bannerInfo/all',
            data: {
                location: 15
            }
        }).then(res => {
            if (res.success) {
                this.bannerList = res.data
            }
        }).catch(e => {
            console.log(e)
        })
    },
    computed: {
    },
    methods: {
    }
}
</script>

<style lang="less" scoped>
.banner {
    width: 1191px;
    height: 220px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    margin: auto;
}

.content {
    width: 1146px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 1);
    border: 1px solid rgba(234, 234, 234, 1);
    padding: 0 22px;
    .name {
        height: 36px;
        line-height: 36px;
        border-bottom: 1px solid #ebebeb;
        .kuai {
            width: 7px;
            height: 15px;
            background: rgba(11, 158, 192, 1);
            display: inline-block;
            vertical-align: middle;
        }

        span {
            font-size: 14px;
            font-family: MicrosoftYaHei;
            color: rgba(51, 51, 51, 1);
            line-height: 19px;
            margin-left: 13px;
            vertical-align: middle;
        }
    }
    .content-content {
        overflow: hidden;
        padding: 30px 0;
        .content-img {
            width: 383px;
            height: 248px;
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
            display: inline-block;
            vertical-align: middle;

            img {
                width: 137px;
                height: 99px;
                display: block;
                margin: auto;
            }

            .ps {
                font-size: 12px;
                font-family: PingFangSC-Regular;
                color: rgba(102, 102, 102, 1);
                line-height: 17px;
                text-align: center;
            }
        }

        .line {
            width: 1px;
            height: 248px;
            display: inline-block;
            vertical-align: middle;
            background-color: #eaeaea;
        }
        .content-text {
            width: 720px;
            display: inline-block;
            vertical-align: middle;
            .title {
                font-size: 18px;
                font-family: MicrosoftYaHei;
                color: rgba(51, 51, 51, 1);
                line-height: 24px;
            }

            .content-all {
                div {
                    img {
                        vertical-align: middle;
                    }
                    span {
                        vertical-align: middle;
                        margin-left: 5px;
                    }
                }
                font-size: 14px;
                font-family: PingFangSC-Regular;
                color: rgba(102, 102, 102, 1);
                line-height: 41px;
                margin-top: 13px;
            }
        }
    }
}
</style>
