<template>
    <div class="dynamicList">
        <el-row>
            <el-col :span="24">
                <div class="content">
                    <p class="title">最新动态</p>
                    <p class="search">
                        <span class="searchVal">
                            <span>名称：</span>
                            <el-input v-model="searchVal" size="medium" placeholder="请输入"></el-input>
                        </span>
                        <span class="button">搜索</span>
                    </p>
                    <div class="common-table">
                        <el-table
                                highlight-current-row
                                max-height="840"
                                :data="allData"
                                @row-click="openTable"
                                stripe
                                style="width: 100%;margin-bottom: 10px;">
                            <el-table-column
                                    prop="type"
                                    label="标签"
                                    align="center">
                            </el-table-column>
                            <el-table-column
                                    prop="name"
                                    label="标题"
                                    width="500"
                                    :show-overflow-tooltip="true"
                                    align="center">
                            </el-table-column>
                            <el-table-column
                                    prop="time"
                                    width="200"
                                    label="发布时间"
                                    align="center">
                            </el-table-column>
                            <el-table-column
                                    prop="person"
                                    label="发布机构"
                                    align="center">
                            </el-table-column>
                            <el-table-column
                                    prop="type2"
                                    label="机构类型"
                                    align="center">
                            </el-table-column>
                        </el-table>
                    </div>
                    <!-- 分页 -->
                    <div class="block" v-if="this.totleLength >= 10">
                        <el-pagination
                                @size-change="handleSizeChange"
                                @current-change="handleCurrentChange"
                                :current-page.sync="currentPage"
                                :page-size="pagesize"
                                background
                                layout="prev, pager, next"
                                :total="totleLength">
                        </el-pagination>
                    </div>
                    <!-- 分页 -->
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
export default {
    data () {
        return {
            searchVal: '',
            currentPage: 1, // 分页第一页
            pagesize: 8,  // 每页个数
            totleLength: 100, // 获取后台传的所有数据的长度
            allData:[
                {
                    name: '市民政局领导到秀水中专调研与考察老年健康与护理实训基地',
                    time: '2019-04-17 09:24:20',
                    person: '嘉兴市秀水经济信息专修学院',
                    type: '新闻',
                    type2: '学校'
                },
                {
                    name: '校政企深度合作 产学研有机融合',
                    time: '2019-09-01 12:23:44',
                    person: '重庆科创职业学院',
                    type: '新闻',
                    type2: '学校'
                },
                {
                    name: '我校与四川省农业机械研究设计院签订战略合作协议',
                    time: '2019-12-23 16:15:33',
                    person: '成都大学',
                    type: '新闻',
                    type2: '学校'
                },
                {
                    name: '镇江润州区与河海大学探索共建“政企校”党建共同体 ',
                    time: '2019-11-20 18:39：23',
                    person: '润州发布',
                    type: '新闻',
                    type2: '公众号'
                },
                {
                    name: '“政企校”人才培养战略合作签约仪式在固安举行',
                    time: '2019-02-02 19:14:29',
                    person: '长城网',
                    type: '新闻',
                    type2: '公众号'
                },
                {
                    name: '3D打印“政企校”共建创新基地在我校正式落成',
                    time: '2019-01-08 12:02:02',
                    person: '重庆化工职业学院',
                    type: '新闻',
                    type2: '学校'
                }
            ]
        }
    },
    created() {
    },
    mounted(){
        let val = this.$store.getters.getSidebar;
        if (val[val.length - 1].path !== 'ZdynamicList') {
            val.push(
                {
                    name: '最新动态',
                    path: 'ZdynamicList'
                }
            )
            this.$store.commit('changeSidebar', val);
        }
    },
    methods: {
        // 点击表格
        openTable(row) {
            console.log(row)
            this.$router.push({name: 'ZnewsPage'});
        },
        // 点击分页
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
        },
        // 当前页数
        handleCurrentChange(val) {
            // console.log(`当前页: ${val}`);
            this.currentPage = val;
        }
    },
    components: {
    },
    watch: {
    }
}
</script>
<style scoped>
    .dynamicList{
        background: #ebf0f8;
        width: 100%;
    }
    .dynamicList .content{
        margin: 40px;
        height: 841px;
        background: #fff;
        overflow: hidden;
    }
    .dynamicList .content .title{
        padding: 30px 0 0 60px;
        font-size: 20px;
        color: #233b6e;
    }
    .dynamicList .content .search{
        margin-top: 36px;
        padding-left: 70px;
        display: flex;
    }
    .dynamicList .content .searchVal{
        width: 245px;
        display: flex;
        font-size: 18px;
        color: #4663a6;
    }
    .dynamicList .content .searchVal>span{
        width: 85px;
        display: inline-block;
        line-height: 34px;
    }
    .dynamicList .content .common-table{
        box-shadow: 4px 4px 5px rgba(72,119,230,0.1);
        border: .5px solid transparent;
        border-radius: 10px;
    }
    .dynamicList>>>.el-input__inner{
        border: 1px solid rgba(8,104,157,.3);
        border-radius: 2px;
        font-size: 18px;
        color: #999;
        height: 34px;
        line-height: 34px;
        width: 180px;
    }
    .dynamicList .content .button{
        display: inline-block;
        width: 100px;
        height: 34px;
        line-height: 34px;
        text-align: center;
        background: #4877e6;
        cursor: pointer;
        margin-left: 100px;
        border-radius: 2px;
        color: #fff;
        font-size: 18px;
    }
    .dynamicList .content .button:hover{
        background: rgba(72,119,230,.6);
    }
    .dynamicList .content .common-table{
        margin: 24px 70px 0 70px;
    }
    .dynamicList .content .common-table>>>.el-table th > .cell{
        font-size: 18px;
        color: #333;
        font-weight: normal;
    }
    .dynamicList .content .common-table>>>.el-table th.is-leaf{
        height: 70px;
    }
    .dynamicList .content .common-table>>>.el-table tr{
        cursor: pointer;
        font-size: 18px;
    }
    .dynamicList .content .common-table>>>.el-table{
        color: #233b6e;
    }
    .dynamicList .content .common-table>>>.el-table--striped .el-table__body tr.el-table__row--striped.el-table__row--striped.el-table__row--striped td {
        background-color: #fff;
    }

    .dynamicList .content .common-table>>>.el-table--enable-row-hover .el-table__body tr:hover>td{
        background-color: #f5f8fd;
    }
    .dynamicList .content .common-table>>>.el-table th.is-leaf, .el-table td {
        border-bottom: 1px solid #d5e3ff;
    }
    .dynamicList .content .common-table>>>.el-table__body tr, .el-table__body td {
        padding: 0;
        height: 60px;
        background: #f5f8fd;
    }
    .dynamicList .content .block{
        text-align: right;
        padding: 30px 70px 0 0;
    }
    .dynamicList .content>>>.el-pagination.is-background .el-pager li{
        background-image: linear-gradient(to bottom, #c5d5f7,#7a95e6);
        color: #fff;
    }
    .dynamicList .content>>>.el-pagination.is-background .el-pager li:not(.disabled).active{
        background-image: linear-gradient(to bottom, #7a9eeb,#274acf);
        color: #fff;
    }
    .dynamicList .content>>>.el-table td{
        border-bottom: 1px solid #d5e3ff;
    }
    .dynamicList .content>>>.btn-prev,.dynamicList .content>>>.btn-next{
        background: #c5d5f7;
        background-image: linear-gradient(to bottom, #c5d5f7,#7a95e6);
        color: #fff;
    }
    .dynamicList .content>>>.btn-prev:disabled,.dynamicList .content>>>.btn-next:disabled{
        color: #C0C4CC;
    }
</style>
