<!--
  @description: 邀请函内容详情
  @Modifier: haoFx
  @routerPath:
  @date: 2020/1/7-16:18
-->
<template>
  <div>
    <pdf :pdf-url="pdfUrl" />
    <div v-show="isShow" class="view mb16">
      <div class="page-title">
        邀请函附件
      </div>
      <downloadFile ref="downloadFile" :data="upLoadData" @file="fileList" />
    </div>
  </div>
</template>

<script>
import { readImageRoot } from '@api/common/uploadCenter'
import { getFileDetail } from '@/api/common/uploadCenter'
/* 混合开发-公用方法 */
import { tenderInvtationMixin } from './../mixins/tenderInvtationMixin'
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件
import pdf from '@comp/common/pdf/pdf'
export default {
  name: 'MakeTenderingBulletinPdfDetail',
  components: {
    downloadFile, // 文件下载
    pdf
  },
  mixins: [tenderInvtationMixin],
  data() {
    return {
      readImageUrl: readImageRoot, // 预览图片
      pdfUrl: '',
      isShow: true // 是否展示附件
    }
  },
  created() {
    // 获取邀请函内容pdf
    this.getBulletinContentPdf()
  },
  methods: {
    // 获取邀请函内容
    getBulletinContentPdf() {
      getFileDetail(this.bulletinContentData).then(response => {
        const url = this.readImageUrl + response.data[0].path
        this.pdfUrl = encodeURIComponent(url)
        // 获取附件
        this.$refs.downloadFile.getFile()
      }).catch(() => {
      })
    },
    fileList(file) {
      if (file && file.length <= 0) {
        this.isShow = false
      }
    }
  }
}
</script>

<style scoped lang="less">

</style>
