| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <view class="">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="预览" @clickLeft="back">
- </uni-nav-bar>
- <web-view :src="fileUrl" class="webview" allow :fullscreen="false" :webview-styles="webviewStyles"
- style="width: 100%;height: calc(100vh - 100px)" :frameborder="0"></web-view>
- </view>
- </template>
- <script>
- // import { getFileType } from './util.js';
- export default {
- data() {
- return {
- fileUrl: '',
- showEditFlag: false,
- webviewStyles: {
- width: '100%',
- height: '100%',
- bottom: '56px'
- }
- };
- },
- onLoad({
- url
- }) {
- uni.getSystemInfo({
- success: (res) => {
- this.webviewStyles.height = res.screenHeight - res.statusBarHeight - res.safeAreaInsets
- ?.bottom - 100 + 'px';
- this.webviewStyles.bottom = res.safeAreaInsets?.bottom + 56 + 'px';
- }
- })
- this.fileUrl = url
- console.log(url);
- },
- methods: {
- // open(row) {
- // this.showEditFlag = true
- // this.setFileUrl(row)
- // },
- setFileUrl(row) {
- let file = row.storagePath[0];
- let fileNames = file.storePath.split('/')
- let url = window.location.origin + '/api/main/file/getFile?objectName=' + file.storePath +
- '&fullfilename=' + fileNames[fileNames.length - 1]
- this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
-
- }
- }
- };
- </script>
- <style scoped lang="scss">
- </style>
|