PdfDialog.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <el-dialog
  3. class="my-dialog yse-events"
  4. :align-center="true"
  5. with-header="false"
  6. destroy-on-close
  7. :model-value="showDialog"
  8. @close="closeDialog()"
  9. :modal="true"
  10. >
  11. <div class="dialog-box">
  12. <div class="title">
  13. <div class="myclose cursor-pointer" @click="closeDialog"></div>
  14. </div>
  15. <iframe class="my-body" :src="src" id="my-pdf"></iframe>
  16. </div>
  17. </el-dialog>
  18. </template>
  19. <script setup>
  20. import {onMounted, toRefs, ref,watch} from "vue";
  21. import {base_img_url2} from "../api/config"
  22. import eventBus from "@/api/eventBus";
  23. const title = ref(null)
  24. const src=ref()
  25. const showDialog=ref(false);
  26. onMounted(async () => {
  27. })
  28. function closeDialog(){
  29. showDialog.value = false;
  30. }
  31. function gybgListener(e){
  32. showDialog.value = true;
  33. src.value = e.filename;
  34. title.value = e.title;
  35. }
  36. eventBus.off("homePage:gybg",gybgListener)
  37. eventBus.on("homePage:gybg",gybgListener)
  38. </script>
  39. <style lang="scss" scoped>
  40. $title-height:44px;
  41. $body-height:calc(100% - $title-height);
  42. .dialog-box{
  43. font-family: PingFangSC-Regular, PingFang SC;
  44. position: fixed;
  45. left: calc(50% - 700px);
  46. top:0px;
  47. width: 80%;
  48. height: calc(100% - 100px);
  49. background: rgba(1,17,22,0.8);
  50. box-shadow: 0px 0px 20px 0px #232323;
  51. border-radius: 4px;
  52. border: 2px solid #232323;
  53. z-index: 99999;
  54. .title{
  55. position: relative;
  56. width: 100%;
  57. height: $title-height;
  58. box-sizing: border-box;
  59. background: #232323;
  60. border-radius: 4px 4px 0px 0px;
  61. border-bottom: 2px solid #232323;
  62. .myclose{
  63. position: absolute;
  64. right: 0px;
  65. top: calc($title-height / 2 - 8px);
  66. margin-right: 20px;
  67. width: 16px;
  68. height: 16px;
  69. background-image: url("@/assets/img/close.png");
  70. background-size: 100% 100%;
  71. }
  72. }
  73. .my-body{
  74. width: 100%;
  75. height: 100%;
  76. box-sizing: border-box;
  77. }
  78. }
  79. </style>