知识库图片预览,自定义瓦片渲染

This commit is contained in:
Teo
2025-07-02 10:45:48 +08:00
parent 1f1a82aae0
commit 64b04286e3
7 changed files with 75 additions and 210 deletions

View File

@ -13,6 +13,8 @@
</template>
<script lang="ts">
import { setMove } from '@/utils/moveDiv';
declare const CXO_API: any;
export default defineComponent({
name: 'index',
setup(props, { emit }) {
@ -68,10 +70,6 @@ export default defineComponent({
};
const init = (obj) => {
let documentKey = obj.id.toString() + new Date().getTime();
let baseURL = import.meta.env.VITE_APP_BASE_API + '/';
console.log(baseURL);
let url = baseURL + obj.filePath.replaceAll('+', ' ');
console.log('🚀 ~ init ~ url:', obj.fileUrl);
let type = obj.fileSuffix;
if (obj.fileSuffix.includes('.')) {
@ -83,8 +81,6 @@ export default defineComponent({
} else if (type == 'ppt' || type == 'pptx') {
documentType = 'slide'; //演示文档文件
}
console.log(documentType, obj.fileSuffix);
new CXO_API.CXEditor('box_app', {
document: {
fileType: type,
@ -130,7 +126,7 @@ export default defineComponent({
}
});
</script>
<style lang="scss">
<style lang="scss" scoped>
.document_detail {
position: fixed;
top: 50%;

View File

@ -16,6 +16,10 @@ import { toRefs, reactive, onMounted, ref, defineComponent, watch, getCurrentIns
import { setMove } from '@/utils/moveDiv';
import { useUserStoreHook } from '@/store/modules/user';
// Ensure CXO_API is available globally or import it if it's a module
// Example for global usage (e.g., included via script tag in index.html):
declare const CXO_API: any;
export default defineComponent({
name: 'index',
setup(props, { emit }) {
@ -134,7 +138,7 @@ export default defineComponent({
}
});
</script>
<style lang="scss">
<style lang="scss" scoped>
.document_detail_eidt {
position: fixed;
top: 50%;