<template>
    <div class="app-container">
        <div class="banner-box">
            <img class="banner-bg" :src="_getImage('转型升级论坛','top-banner.jpg')"/>
            <div class="banner-content">
                <p class="mytitle">{{noticeList.length>0? noticeList[0].title :''}}</p>
                <p class="description">{{noticeList.length>0? noticeList[0].description :''}}</p>
            </div>
        </div>
        <br><br><br>
        <span class="title">论坛新闻</span>
        <el-divider></el-divider>
        <div class="notice-list" v-for="(item,index) in noticeList" :key="index"  @click="showNoticeDetail(item)">
            <div class="content-block">
                <p class="text-title" style="font-size:14px;"><span style="color:#01496E;"></span>{{item.title}}</p>
            </div>
            <span class="text-date">{{item.issueStartTime}}</span>
        </div>
        <el-pagination
            layout="prev, pager, next"
            :current-page.sync="currentPage"
            @current-change="handleCurrentChange"
            :page-size="10"
            :total="total">
        </el-pagination>
    </div>
</template>

<script>
import {getNoticeList} from "@/api/notice"
export default {
    name: "newsForum",
    data() {
        return {
            noticeList:[],
            currentPage:1,
            total:0
        };
    },
    mounted() {
        this.initData()
    },
    methods:{
        initData(){
            let params = {
            "pageNum": this.currentPage,
            "pageSize": 10,
            "search": {
                "type": "LTXW"
            },
            "sort": ""
            }
            getNoticeList(params).then(res => {
                console.log(res);
                this.noticeList = res.data.list
                this.total = res.data.count
            })
        },
        showNoticeDetail(item){
            this.$router.push({name:'noticeShow',query:{'id':item.id,'title':item.topicTypeText}})
        },
        //当前页变化
        handleCurrentChange(val) {
            this.currentPage = val
            this.initData()
        }
    }
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.banner-box {
    position: relative;
    width: 100%;
    height: 300px;
    padding: 70px;
    .banner-bg {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
    }
    .banner-content {
        position: relative;
        margin: 10px;
        color: #000;
        text-align: center;
        .mytitle {
            font-size: 28px;
            font-weight: 600;
            line-height: 60px;
        }
        .description {
            font-size: 16px;
            line-height: 30px;
        }
    }
}
.title {
    position: relative;
    color: #1e50ae;
    font-size: 18px;
    padding: 0 10px;
    font-weight: bold;
    font-family: 微软雅黑;
    &::before {
        content: " ";
        position: absolute;
        left: 0;
        bottom: -25px;
        width: 100%;
        height: 4px;
        background: #1e50ae;
    }
}
.notice-list {
    position: relative;
    background-color: rgba(255,255,255,0);
    cursor: pointer;
    color: #999999;
    font-family:PingFang SC;
    border-bottom: 1px dotted #dcdcdc;
    margin: 10px 30px;
    .date-block {
        position: relative;
        display: inline-block;
        vertical-align: top;
        width: 67px;
        height: 67px;
        margin: 10px 10px 10px 0;
        padding: 13px 0;
        background-color: #E4E4E4;
    }
    .content-block {
        position: relative;
        display: inline-block;
        width: calc(100% - 90px);
        height: 46px;
        padding: 0 15px;
        &::before {
            content: " ";
            position: absolute;
            top: 28%;
            left: -10px;
            width: 6px;
            height: 6px;
            background: #8D8D8D;
            border-radius: 50%;
        }
    }
    .content-block-first {
        position: relative;
        display: inline-block;
        width: calc(100% - 90px);
        height: 103px;
        padding: 0 15px;
    }
    .text-date {
        text-align: center;
        font-size: 14px;
        vertical-align: super;
    }
    .text-title {
        font-size: 18px;
        margin: 6px 0;
        font-weight:500;
        color: #666666;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .text-content {
        font-size: 14px;
        overflow: hidden;
        display: -webkit-box; 
        -webkit-line-clamp:2; 
        -webkit-box-orient: vertical;
    }
    &:hover {
        .text-title {
            color: #3893c7;
        }
    }
}
</style>
