<template>
    <div class="container">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <!--图文信息固定条数展示组件1开始-->
                <div class="twinfo_show_fixrecord_pc_1"><!--使用此组件，请复制此div-->
                    <div class="news-toutiao">
                        <span class="sp1"></span>
                        <span class="sp2">
                        <el-carousel indicator-position="none" arrow="never">
                            <el-carousel-item v-for="(item,index) in newsList" :key="index">
                                <a href="javascript:;" @click.prevent="goDetails(item.articleId)">{{item.title}}</a>
                            </el-carousel-item>
                        </el-carousel>
                        </span>
                    </div>
                </div>
                <!--图文信息固定条数展示组件1结束-->
            </div>
        </div>
    </div>
</template>

<script type="text/babel">
    import formMixin from '../../../src/mixins/formMixin';
    import lenye_base from 'lenye_base';

    export default {
        name: 'ElAdvertisingSpace',
        mixins: [formMixin],
        components: {},
        data() {
            return {
                // newsList
                newsList: [],
                //    站点数据
                siteData: '',
                //    用户数据
                userData: ''
            };
        },
        created() {
            this.siteData = lenye_base.site_data.getsiteData();
            this.userData = lenye_base.user_data.getuserData();
        },
        mounted() {
            this.getData();
        },
        computed: {},
        methods: {
            // 跳转到详情页面
            goDetails(articleId) {
                window.open("/infodetail?id=" + articleId);
            },
            //    获取新闻列表
            getData() {
                var that = this;
                lenye_base.httpPost(lenye_base.base_data.getapiUrl() + lenye_base.api_url.news.queryShowPage, lenye_base.base_data.getformatting({
                    siteId: this.siteData.siteId,
                    sorts: 'newsPubDate=0',
                    page: 1,
                    rows: 3
                }), function (e) {
                    console.log('新闻列表', e);
                    that.newsList = e.data;
                });
            }
        }
    };
</script>