<template>
    <div class="message">
        <el-row>
            <div class="content_title">
                <span>通知消息</span>
            </div>
        </el-row>

        <el-row>
            <div class="box" @click="$router.push({ name: 'messageDetails' })">
                <img src="../../assets/xiaoxi_icon_xitong.png" />
                <div class="info">
                    <div class="name">系统消息</div>
                    <p>{{ sysList.content }}</p>
                </div>
                <div class="time">{{ sysList.createdAt }}</div>
            </div>
            <!-- <div class="box" v-for="n in tableData" :key="n.id" >
                <img :src="n.user.avatar" />
                <div class="info">
                    <div class="name">姓名</div>
                    <p>你好，我对贵方的一体化集成动力设备很感兴趣，有很多细节希望可以进一步沟通一下</p>
                </div>
                <div class="time">{{ n.createdAt }}</div>
            </div> -->
            <div class="box" v-for="n in conversationList" :key="n.id" @click="$router.push({ name: 'chat' })">
                <img :src="n.senderAvatar" />
                <div class="info">
                    <div class="name">{{ n.senderName }}</div>
                    <p>{{ n.content }}</p>
                </div>
                <div class="time">{{ n.createdAt }}</div>
            </div>
        </el-row>
    </div>
</template>

<script>
// import pageableTable from '@/mixins/pageableTable';
export default {
    // mixins: [pageableTable],
    name: 'message',
    data() {
        return {
            // url: '/notificationMessage/all',
            current: 0,
            sysList: {},
            conversationList: {}
        };
    },
    created() {
        this.$http.get('/message/all', { query: { messageType: 'SYSTEM_MESSAGE' } }).then(res => {
            // console.log(res);
            this.sysList = res.content;
        });
        this.$http.get('/message/all', { query: { messageType: 'CONVERSATION_MESSAGE' } }).then(res => {
            // console.log(res);
            this.conversationList = res.content;
        });
    },
    methods: {
        getIndex(index) {
            this.current = index;
            /*            if (index === 0) {
                this.url = '/auditHistory/myAll';
                this.getData();
                this.url = '/message/all';
                const arr = this.tableData;
                this.getData();
                arr.push.apply(arr, this.tableData);
                this.url = '/topic/all';
                this.getData();
                arr.push.apply(arr, this.tableData);
                this.tableData = arr;
                return;
            } */
            // if (index === 0) {
            //     this.url = '/auditHistory/myAll';
            // }
            // if (index === 1) {
            //     this.url = '/message/getMySupply';
            // }
            // if (index === 2) {
            //     this.url = '/topic/myAll';
            // }
            // this.getData();
        }
    }
};
</script>
<style lang="less" scoped>
.content_title {
    height: 60px;
    line-height: 60px;
    box-sizing: border-box;
    padding-bottom: 20px;
    border-bottom: #f2f3f5 1px solid;
    > span {
        font-size: 16px;
        color: #000000;
        line-height: 30px;
        font-weight: 700;
    }
}
.classify {
    height: 60px;
    line-height: 60px;
    span {
        cursor: pointer;
        font-size: 13px;
        color: #818999;
        + span {
            margin-left: 30px;
        }
        &.active {
            color: #bf1616;
        }
    }
}
.box {
    // overflow: hidden;
    display: flex;
    padding: 20px 0 20px;
    height: auto;
    // box-sizing: content-box;
    cursor: pointer;
    img {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        // background: cadetblue;
    }
    .info {
        width: 780px;
        margin-left: 8px;
        height: auto;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        .name {
            font-size: 14px;
            font-weight: 500;
            color: #000000;
        }
        p {
            margin: 0px;
            width: 600px;
            // height: 22px;
            font-size: 14px;

            color: #c8c9cc;
            line-height: 22px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
    .time {
        width: 20%;
        height: 22px;
        font-size: 13px;
        color: #c8c9cc;
        line-height: 22px;
    }
    + .box {
        // margin-top: 20px;
        border-top: 1px solid #f2f3f5;
    }
}
</style>
