pdfViewExample.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="pdf-view-example j-contanter">
  3. <div class="pdf-container j-main">
  4. <iframe v-if="pdfUrl" sandbox="allow-same-origin allow-scripts" allow="pdf" :src="pdfUrl" />
  5. </div>
  6. <div v-if="!getUserId" class="j-footer">
  7. <a href="/jyapp/free/login?back=index&to=back&activity=bidCreditReportPreview" class="adsense-container">
  8. <AdSingle
  9. ad="app-credit-report-sample"
  10. :show-tag="false"
  11. :show-close-icon="false"
  12. class="adsense-container"
  13. />
  14. </a>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import { mapGetters } from 'vuex'
  20. import AdSingle from '@/components/ad/Ad'
  21. export default {
  22. name: 'PdfViewExample',
  23. components: {
  24. AdSingle
  25. },
  26. data() {
  27. return {
  28. pdfUrl: `${location.origin}/shareFile/bidCreditReportFile/1e452a27575834907747949258e09893/%E4%B8%87%E8%BE%BE%E4%BF%A1%E6%81%AF%E8%82%A1%E4%BB%BD%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8.pdf`
  29. }
  30. },
  31. computed: {
  32. ...mapGetters('user', ['getUserId'])
  33. },
  34. created() {
  35. const { pdfUrl } = this.$route.query
  36. if (pdfUrl) {
  37. this.pdfUrl = pdfUrl
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .pdf-container {
  44. width: 100%;
  45. height: 100%;
  46. iframe {
  47. width: 100%;
  48. height: 100%;
  49. }
  50. }
  51. </style>