fileBrowse.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <ele-modal
  3. title="详情"
  4. :visible.sync="visible"
  5. v-if="visible"
  6. :before-close="handleClose"
  7. append-to-body
  8. :maxable="true"
  9. :close-on-click-modal="false"
  10. :close-on-press-escape="false"
  11. width="80%"
  12. >
  13. <div>
  14. <iframe
  15. :src="fileUrl"
  16. width="100%"
  17. style="height: calc(70vh - 20px); margin-top: 30px"
  18. frameborder="0"
  19. allowfullscreen="true"
  20. ></iframe>
  21. </div>
  22. <div slot="footer">
  23. <el-button @click="handleClose"> 关闭 </el-button>
  24. </div>
  25. </ele-modal>
  26. </template>
  27. <script>
  28. export default {
  29. components: {},
  30. mixins: [],
  31. data() {
  32. return {
  33. fileUrl: '',
  34. visible: false
  35. };
  36. },
  37. computed: {},
  38. mounted() {},
  39. methods: {
  40. setFileUrl(row) {
  41. console.log(row);
  42. let file = row.storagePath[0];
  43. let fileNames = file.storePath.split('/');
  44. let url =
  45. window.location.origin +
  46. '/api/main/file/getFile?objectName=' +
  47. file.storePath +
  48. '&fullfilename=' +
  49. fileNames[fileNames.length - 1];
  50. this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
  51. this.visible = true;
  52. },
  53. handleClose() {
  54. this.visible = false;
  55. }
  56. }
  57. };
  58. </script>
  59. <style lang="scss" scoped></style>