RefferenceFlag.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <span class="refference-container">
  3. <a-popover>
  4. <span class="circle"></span>
  5. <template #title></template>
  6. <template #content>
  7. <div class="refference-content">
  8. <AsideImage :src="img_url"/>
  9. <div class="refference-description">
  10. <div class="ref-text-content">
  11. {{text}}
  12. </div>
  13. <FileNameDisplay @click="handleClick" :file_name="doc_name" :file_id="doc_id" />
  14. </div>
  15. </div>
  16. </template>
  17. </a-popover>
  18. <a-drawer ref="drawer" :width="DOC_WIDTH" :visible="visible" @ok="handleOk" @cancel="handleCancel" unmountOnClose :data-flag="'doc-ref-effect-contaienr'" :footer="false">
  19. <template #title>
  20. {{doc_name}}
  21. </template>
  22. <PDFViewer :url="pdf_url" :doc_width="DOC_WIDTH" :positions="positions"/>
  23. </a-drawer>
  24. </span>
  25. </template>
  26. <script setup>
  27. import { defineComponent, inject, ref, useTemplateRef } from "vue";
  28. import PDFViewer from '../pdf-viewer/PDFViewer.vue';
  29. import AsideImage from './AsideImage.vue';
  30. import FileNameDisplay from '../file/FileNameDisplay.vue';
  31. import {getDocumentUrl, getImageUrl} from '../../ajax/document';
  32. /**
  33. * 此页面可能用到的文档
  34. * @see https://arco.design/vue/component/popover
  35. */
  36. const props = defineProps({
  37. img: String, // 图片链接
  38. image_id: String,
  39. text: String, // 文本地址
  40. doc_id: String,
  41. doc_name: String,
  42. positions: Array
  43. });
  44. const DOC_WIDTH = window.innerWidth/2;
  45. const pdf_url = getDocumentUrl(props.doc_id);
  46. const img_url = getImageUrl(props.image_id);
  47. const visible = ref(false);
  48. const handleClick = () => {
  49. const doc_nm = props.doc_name;
  50. if(doc_nm && doc_nm.indexOf('.pdf') === doc_nm.length - 4){
  51. visible.value = true;
  52. }else{
  53. }
  54. };
  55. const handleOk = () => {
  56. visible.value = false;
  57. };
  58. const handleCancel = () => {
  59. visible.value = false;
  60. }
  61. </script>
  62. <style scoped>
  63. .refference-content{
  64. display: flex;
  65. justify-content: space-between;
  66. align-items: flex-start;
  67. }
  68. .refference-description{
  69. flex-grow: 1;
  70. }
  71. .ref-text-content{
  72. max-width: 460px;
  73. max-height: 340px;
  74. overflow-y: auto;
  75. }
  76. </style>
  77. <style>
  78. .arco-drawer-container[data-flag=doc-ref-effect-contaienr] .arco-drawer-body{
  79. overflow: hidden;
  80. }
  81. </style>