cxc-szcx-uniapp/pages/document/onlinePreview.vue
2024-12-04 11:05:49 +08:00

44 lines
883 B
Vue

<template>
<view :class="['content',{'gray':store.isgray==1}]">
<iframe id="bdIframe" :src="fileUrl" ref="bdIframe" style="border: none;" class="iframe" />
</view>
</template>
<script setup>
import {
useStore
} from '@/store';
import {
onLoad
} from '@dcloudio/uni-app';
import Base64 from '@/utils/code.js';
const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot/sys/common/static/'
const store = useStore();
var fileUrl = "";
onLoad((options) => {
let base64 = new Base64();
var url= JSON.parse(options.data)
url = baseUrl + url;
fileUrl = 'https://10.75.166.6/preview/onlinePreview' + '?url=' + encodeURIComponent(base64.encode(url))
})
</script>
<style>
.container {
position: relative;
width: 100%;
height: 100vh;
}
#bdIframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>