<template>
  <div class="news-detail-box">
    <breadcrumb class="content-max-width crumb" :data="crumbData" />
    <div class="title">{{ data.title }}</div>
    <div class="content content-max-width" v-html="data.content"></div>
    <div class="pdf content-max-width">
      <a target="_blank" :href="data.attachment_url" class="name">{{ data.attachment_title }}</a>
    </div>
  </div>
</template>
<script>
import * as api from '@/api/article'
import breadcrumb from '@/components/breadcrumb.vue'
export default {
  components: {
    breadcrumb,
  },
  data() {
    return {
      data: {},
      crumbData: [
        {
          path: '/',
          name: '首页',
        },
        {
          name: parseInt(this.$route.query.tabs) === 1 ? '工作动态' : '通知公告',
        },
      ],
    }
  },
  mounted() {
    this.getData()
    if (this.$route.query.type) {
      this.crumbData = [
        {
          path: '/',
          name: '首页',
        },
        {
          name: parseInt(this.$route.query.tabs) === 1 ? '工作动态' : '通知公告',
        },
      ]
    }
  },
  methods: {
    getData() {
      api.getArticleDetail(this.$route.query.id).then((res) => {
        this.data = res.data
      })
    },
  },
}
</script>
<style lang="scss" scoped>
.crumb {
  padding-top: 24px;
}
.content-max-width {
  width: 870px;
  margin: 0 auto;
}
.news-detail-box {
  .title {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #c01540;
    line-height: 25px;
    margin: 24px 0;
  }
  .content {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    color: #717171;
    line-height: 20px;
    margin-bottom: 24px;
  }
}
.pdf {
  padding-bottom: 30px;
  .name {
    color: #0053c6;
  }
}
</style>
