<!-- 主页模块 消息详情页-->
<template>
  <div>
    <!--消息中心-->
    <div class="commonly-used message-center">
      <div class="label-box">
        <span class="label-title">消息中心</span>
      </div>
      <div class="button-box">
        <span class="cursor go-back">
          <el-button class="cursor go-back" @click="back">返回</el-button>
          <span class="cursor go-message" @click="goMessageDetail">消息中心</span>
        </span>
      </div>
      <div class="message-box1 ">
        <p class="message-text ">{{ messageDetail.systemMessageTitle }}</p>
        <p class="msg-content">{{ messageDetail.systemMessageContent }}</p>
        <p class="msg-company">{{ messageDetail.compName }}</p>
        <p class="msg-time">{{ messageDetail.createDate.split(' ')[0] }}</p>
      </div>
    </div>
  </div>
</template>

<script>
import { readSystemMessage } from '../../api/home/home';

export default {
  name: 'MessageDetail',
  data() {
    return {
      headState: '/home',
      msg: 'Welcome to Your messageList.js App',
      compId: localStorage.getItem('enterprise-front-compId'),
      messageDetail: {}
    };
  },
  created() {
    this.messageDetailInit();
  },
  methods: {
    messageDetailInit() {
      this.messageDetail = JSON.parse(localStorage.getItem('enterprise-front-systemMessageId'));
      const params = {
        id: this.messageDetail.id
      };
      readSystemMessage(params).then(() => {
      });
    },
    goMessageDetail() {
      this.$router.push({ path: '/messageList', name: 'messageList' });
    },
    back() {
      this.$router.back();
    }
  }
};
</script>

<style scoped lang="scss">
  .message-center{
    padding: 30px;
    .message-box1 {
      font-size: 13px;
      background-color: #f6f6f6;
      padding: 50px 100px 30px 100px;
      margin: 10px 0;
      .message-text{
        text-align: center;
        /*padding-left: 18px;*/
        position: relative;
        font-size: 16px;
        font-weight: bold;
      }
      .msg-content{
        padding: 30px 10px 50px 18px;
        font-size: 14px;
        line-height: 25px;
        color: #333;
      }
      .msg-company{
        text-align: right;
        /*padding-right: 10px;*/
        color: #333;
        font-size: 14px;
      }
      .msg-time{
        text-align: right;
        /*padding-right: 10px;*/
        color: #999;
        font-size: 13px;
      }
    }
  }
  .button-box {
    display: block;
    background-color: #f6f6f6;
    padding: 0 10px;
    margin: 5px 0;
    .go-back {
      .el-button {
        display: inline-block;
        margin: 10px 0;
        width: 70px;
        height: 30px;
      }
    }
    .go-message {
      font-size: 14px;
      float: right;
      display: inline-block;
      height: 50px;
      line-height: 50px;
      color: #1d6ced;
    }
    .message-box {
      font-size: 13px;
      background-color: #f6f6f6;
      padding: 10px 10px;
      margin: 5px 0;
    }
  }
</style>
