browse.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <ele-modal
  3. :visible.sync="showEditFlag"
  4. :close-on-click-modal="false"
  5. custom-class="ele-dialog-form"
  6. append-to-body
  7. :fullscreen="true"
  8. >
  9. <iframe
  10. :src="fileUrl"
  11. width="100%"
  12. v-if="showEditFlag"
  13. style="height: calc(100vh - 100px)"
  14. frameborder="0"
  15. allowfullscreen="true"
  16. ></iframe
  17. ></ele-modal>
  18. </template>
  19. <script>
  20. import { getFileType } from './util.js';
  21. export default {
  22. data() {
  23. return {
  24. fileUrl: '',
  25. showEditFlag: false
  26. };
  27. },
  28. methods: {
  29. open(row) {
  30. this.showEditFlag = true;
  31. this.setFileUrl(row);
  32. },
  33. setFileUrl(row) {
  34. console.log(row);
  35. let file = row.storagePath[0];
  36. let fileNames = file.storePath.split('/');
  37. let url =
  38. window.location.origin +
  39. '/api/main/file/getFile?objectName=' +
  40. file.storePath +
  41. '&fullfilename=' +
  42. fileNames[fileNames.length - 1];
  43. this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
  44. this.visible = true;
  45. }
  46. }
  47. };
  48. </script>
  49. <style scoped lang="scss"></style>