cxc-szcx-uniapp/pages/document/onlinePreviewH5.vue

46 lines
954 B
Vue
Raw Permalink Normal View History

2025-03-12 13:51:38 +00:00
<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';
const requestUrl = import.meta.env.VITE_REQUEST_BASE_URL;
const baseUrl = 'https://10.75.166.6/jeecg-boot/sys/common/static/';
const store = useStore();
import {Base64} from 'js-base64'
var fileUrl = "";
onLoad((options) => {
var url= JSON.parse(options.data)
url = baseUrl + url;
console.log(url)
console.log(Base64.encode(url))
fileUrl =requestUrl+ '/preview/onlinePreview' + '?url=' + encodeURIComponent(Base64.encode(url))
console.log(fileUrl)
})
</script>
<style>
.container {
position: relative;
width: 100%;
height: 100vh;
}
#bdIframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>