<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-user"></i> Editor list
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="handle-box">
                <el-button type="primary" icon="el-icon-circle-plus-outline" @click="addEditor">add</el-button>
            </div>
            
            <el-table
                :data="tableData"
                border
                stripe
                class="table"
                ref="multipleTable"
                header-cell-class-name="table-header"
            >
                <el-table-column prop="user_id" label="ID" align="center"></el-table-column>
                <el-table-column prop="account" label="username" align="center"></el-table-column>
                <el-table-column prop="realname" label="realname" align="center"></el-table-column>
                <el-table-column prop="phone" label="phone" align="center"></el-table-column>
                <el-table-column prop="email" label="email" align="center"></el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination
                    background
                    layout="total, prev, pager, next"
                    :current-page="query.pageIndex"
                    :page-size="query.pageSize"
                    :total="Total"
                    @current-change="handlePageChange"
                ></el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name:'editorList',
    data() {
        return {
            query: {
                pageIndex: 1,
                pageSize: 10
            },
            tableData: [],
            Total: 0
        };
    },
    created() {
        this.getdate();
    },
    methods: {
        // 获取编辑列表数据
        getdate() {
            this.$api
                .post('api/Admin/getEditor', this.query)
                .then(res => {
                    this.Total = res.total;
                    this.tableData = res.data;
                })
                .catch(err => {
                    console.log(err);
                });
        },
        // 分页导航
        handlePageChange(val) {
            this.$set(this.query, 'pageIndex', val);
            this.getdate();
        },
        addEditor(){
            this.$router.push('/EditorAdd');
        },
        // showdetail(row) {
        //     this.$router.push({ path: 'articleDetail', query: { id: row.article_id } });
        // }
    }
};
</script>

<style scoped>
.handle-box {
    margin-bottom: 20px;
}

.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
    display: inline-block;
}
.table {
    width: 100%;
    font-size: 14px;
}
.red {
    color: #ff0000;
}
.mr10 {
    margin-right: 10px;
}
.table-td-thumb {
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
}
.el-table .warning-row {
    background: #f3ca7f;
}
.el-table .success-row {
    background: #bcfc9a;
}
.el-table .normol-row{
    background: #d8f1c7
}
.el-table .red-row{
    background: #f05555;
}
</style>
