<template>
  <div class="citySafeNoticDetail">
    <div class="title">{{ detail.title }}</div>
    <div class="time">
      <van-icon name="underway-o" />
      <div>发布日期：{{ $common.transBaseDateTime(detail.createTime) }}</div>
    </div>
    <div class="text" v-html="detail.content"></div>
    <div class="fj">
      <div>附件：</div>
      <div class="filename" v-for="item in annex" @click="openFiled(item.msg)">
        {{ item.name }}
      </div>
    </div>
  </div>
</template>

<script>
import { getNoticeById } from '@/service/api_company.js'
export default {
    data() {
        return {
            detail: {},
            annex: []
            // search: {
            //     pageNum: '1',
            //     createdBy: 'xxxxx',
            //     pageSize: '10'
            // }
        }
    },
    mounted() {
        this.getNoticeById()
    },
    methods: {
        openFiled(url) {
            location.href = url
            // window.open(url, "_blank");
        },
        async getNoticeById() {
            // alert('createdBy:' + this.$route.params.openId + '===>' + this.$route.params.id + '==>' + this.$route.params)
            const { data } = await getNoticeById({
                id: this.$route.params.id,
                createdBy: this.$route.params.openId
            })
            this.detail = data
            this.annex = JSON.parse(data.annex)
            console.log(JSON.parse(data.annex))
        }
    }
}
</script>

<style lang="scss">
.citySafeNoticDetail {
  width: 100%;
  background-color: rgba(255, 255, 255, 1);
  margin-top: 24px;
  padding: 20px 32px 20px 32px;
  box-sizing: border-box;
  .title {
    font-size: 36px;
    color: #333333;
    font-weight: bold;
  }
  .time {
    margin-top: 12px;
    display: flex;
    align-items: center;
    font-size: 32px;
  }
  .text {
    font-size: 32px;
    margin-top: 24px;
    img {
      max-width: 100%;
    }
  }
  .fj {
    margin-top: 24px;
  }
  .filename {
    color: rgba(31, 106, 255, 1);
  }
}
</style>
