<template>
  <div class="list" v-if="list.length >= 1">
    <div class="item-box" v-for="(item,index) in list" :key="index" @click="detailClick(item)">
      <div class="item">
        <div class="left">
          <p class="title">{{item.title}}</p>
          <p class="message">{{item.message}}</p>
          <div class="info">
            <div class="tag">{{item.name || '系统消息'}}</div>
            <p class="time">{{item.createdate}}</p>
          </div>
        </div>
        <div class="right">
          <div class="read" v-if="item.isread == 1">已读</div>
          <div class="no-read" v-else>未读</div>
        </div>
      </div>
    </div>
  </div>
  <el-empty description="暂无数据" v-else></el-empty>
</template>

<script>
export default {
  name: 'list',
  data () {
    return {
      dialogVisible:false,
      message: ''
    };
  },
  props:['list'],
  computed: {
  },
  watch: {
  },
  methods: {
    handleClose() {
      this.dialogVisible = false
    },
    async detailClick(item) {
      
      this.$emit('messageItemClick',item)
    }
  },
};
</script>

<style scoped>
*{
  box-sizing: border-box;
}
.list {
  width: 100%;
  min-height: 100%;
  margin-top: 10px;
}
.list .item-box {
  padding: 0 16px;
  cursor: pointer;
}
.list .item-box:hover {
  background: #fafafa;
}
.list .item-box .item {
  border-bottom: 1px solid #eeeeee;
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
}
.list .item-box .item:last-child {
}
.list .item-box .item .left {
}
.list .item-box .item .left .title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #333333;
  max-width: 1000px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list .item-box .item .left .message {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 400;
  color: #666666;
  max-width: 1000px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list .item-box .item .left .info {
  display: flex;
  align-items: center;
}
.list .item-box .item .left .info .tag {
  padding: 4px 6px;
  border: 1px solid #3874F6;
  color: #3874F6;
  font-size: 12px;
  border-radius: 2px;
  margin-right: 10px;
}
.list .item-box .item .left .info .time {
  font-size: 12px;
  font-weight: 400;
  color: #999999;
}
.list .item-box .item .right .read {
  background: #FFEBEA;
  border-radius: 4px 4px 4px 4px;
  padding: 6px 16px;
  color: #FF3B30;
  font-size: 14px;
}
.list .item-box .item .right .no-read {
  background: #EEEEEE;
  border-radius: 4px 4px 4px 4px;
  padding: 6px 16px;
  color: #999999;
  font-size: 14px;
}
.dialog-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

</style>
