<template>
  <el-dialog
    :title="$t1('消息详情')"
    :append-to-body="true"
    :modal-append-to-body="true"
    :close-on-click-modal="false"
    :visible.sync="showDialog"
    :modal="false"
    custom-class="el-dialog dialog-style news-box"
    width="800px"
    :destroy-on-close="true"
    @close="$emit('update:visiable',false)"
    v-el-drag-dialog
    v-el-dialog-center
  >
    <div id="containt" style="width: 100%;margin:10px 0;">
      <div class="n-cont" style="width: 100%;">
        <h2 class="t1">{{ notifyMessage.notifyTypeName }}</h2>
        <!--          <h3 class="t2">紧急通知</h3>-->
        <p class="time">{{ notifyMessage.createDate }}</p>
        <div class="c"><p v-html="notifyMessage.content"></p></div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "infoDialog",
  props: ["dataId"],
  data() {
    return {
      showDialog: true,
      notifyMessage: {}
    }
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      this.$commonHttp({
        url: USER_PREFIX + `/notify_message/get`,
        method: `post`,
        data: {
          id: this.dataId
        },
        isLoading: true,
        modalStrictly: true,
        success: res => {
          this.notifyMessage = res.objx || {};
          this.handleRead();
        }
      });
    },
    handleRead() {
      if (this.notifyMessage.readed == 0) {
        this.$http({
          url: USER_PREFIX + `/notify_message/read`,
          method: `post`,
          data: [this.notifyMessage.id],
          isLoading: true,
          success: res => {
            this.$emit('readHanlde');
          }
        });
      } else {
        this.$emit('readHanlde');
      }
    }
  }
}
</script>

<style scoped>

</style>
