@chenghongyu/xpt-file-viewer 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +3 -0
- package/README.md +5 -0
- package/auto-imports.d.ts +12 -0
- package/components.d.ts +45 -0
- package/dist.zip +0 -0
- package/index.html +13 -0
- package/package.json +100 -0
- package/presets/eslint/.eslintrc-auto-import.json +462 -0
- package/presets/plugins/html.ts +14 -0
- package/presets/shared/env.ts +46 -0
- package/presets/shared/resolvers.ts +29 -0
- package/presets/tov.ts +132 -0
- package/presets/types/auto-imports.d.ts +806 -0
- package/presets/types/components.d.ts +164 -0
- package/presets/types/env.d.ts +17 -0
- package/public/favicon.svg +1 -0
- package/public/icons.svg +24 -0
- package/public/testfile/README.md +5 -0
- package/public/testfile/useFileContextMenu.js +74 -0
- package/public/testfile//345/217/221/347/245/250.pdf +0 -0
- package/public/testfile//346/216/245/346/224/266/345/207/275.docx +0 -0
- package/public/testfile//350/247/204/346/240/274/345/236/213/345/217/2671.txt +263 -0
- package/public/testfile//350/247/206/351/242/2211.mp4 +0 -0
- package/public/testfile//351/237/263/351/242/2211.mp3 +0 -0
- package/src/App.vue +8 -0
- package/src/api/admin/admin-2fa.js +18 -0
- package/src/api/admin/admin-download-log.js +37 -0
- package/src/api/admin/admin-login-log.js +9 -0
- package/src/api/admin/admin-permission.js +9 -0
- package/src/api/admin/admin-setting.js +121 -0
- package/src/api/admin/admin-share.js +20 -0
- package/src/api/admin/admin-short-link.js +49 -0
- package/src/api/admin/admin-sso.js +38 -0
- package/src/api/admin/admin-storage.js +189 -0
- package/src/api/admin/admin-user.js +61 -0
- package/src/api/home/common.js +9 -0
- package/src/api/home/file-operator.js +89 -0
- package/src/api/home/home.js +87 -0
- package/src/api/home/install.js +18 -0
- package/src/api/home/login.js +9 -0
- package/src/api/home/only-office.js +10 -0
- package/src/api/home/share.js +115 -0
- package/src/api/home/user.js +74 -0
- package/src/api/tools/tools-115.js +17 -0
- package/src/api/tools/tools-gd.js +13 -0
- package/src/api/tools/tools-s3.js +25 -0
- package/src/api/tools/tools-sharepoint.js +19 -0
- package/src/assets/hero.png +0 -0
- package/src/assets/icons/401.svg +1 -0
- package/src/assets/icons/403.svg +45 -0
- package/src/assets/icons/404.svg +1 -0
- package/src/assets/icons/500.svg +1 -0
- package/src/assets/icons/admin-login.svg +1 -0
- package/src/assets/icons/document.svg +1 -0
- package/src/assets/icons/empty.svg +145 -0
- package/src/assets/icons/file-type-apk.svg +1 -0
- package/src/assets/icons/file-type-archive.svg +1 -0
- package/src/assets/icons/file-type-audio.svg +1 -0
- package/src/assets/icons/file-type-back.svg +1 -0
- package/src/assets/icons/file-type-css.svg +1 -0
- package/src/assets/icons/file-type-deb.svg +1 -0
- package/src/assets/icons/file-type-dll.svg +1 -0
- package/src/assets/icons/file-type-doc.svg +1 -0
- package/src/assets/icons/file-type-document.svg +1 -0
- package/src/assets/icons/file-type-docx.svg +1 -0
- package/src/assets/icons/file-type-exe.svg +1 -0
- package/src/assets/icons/file-type-expression.svg +1 -0
- package/src/assets/icons/file-type-file.svg +1 -0
- package/src/assets/icons/file-type-folder.svg +1 -0
- package/src/assets/icons/file-type-html.svg +1 -0
- package/src/assets/icons/file-type-image.svg +1 -0
- package/src/assets/icons/file-type-java.svg +1 -0
- package/src/assets/icons/file-type-js.svg +1 -0
- package/src/assets/icons/file-type-less.svg +1 -0
- package/src/assets/icons/file-type-md.svg +1 -0
- package/src/assets/icons/file-type-office.svg +1 -0
- package/src/assets/icons/file-type-pdf.svg +1 -0
- package/src/assets/icons/file-type-php.svg +1 -0
- package/src/assets/icons/file-type-ppt.svg +1 -0
- package/src/assets/icons/file-type-pptx.svg +1 -0
- package/src/assets/icons/file-type-py.svg +1 -0
- package/src/assets/icons/file-type-rb.svg +1 -0
- package/src/assets/icons/file-type-root.svg +1 -0
- package/src/assets/icons/file-type-rpm.svg +1 -0
- package/src/assets/icons/file-type-rust.svg +1 -0
- package/src/assets/icons/file-type-script.svg +1 -0
- package/src/assets/icons/file-type-text.svg +1 -0
- package/src/assets/icons/file-type-three3d.svg +5 -0
- package/src/assets/icons/file-type-vbs.svg +1 -0
- package/src/assets/icons/file-type-video.svg +1 -0
- package/src/assets/icons/file-type-xls.svg +1 -0
- package/src/assets/icons/file-type-xlsx.svg +1 -0
- package/src/assets/icons/file-type-xml.svg +1 -0
- package/src/assets/icons/file-type-yaml.svg +1 -0
- package/src/assets/icons/file-upload.svg +1 -0
- package/src/assets/icons/github.svg +1 -0
- package/src/assets/icons/install-step.svg +40 -0
- package/src/assets/icons/reset-password.svg +1 -0
- package/src/assets/icons/storage-aliyun.svg +1 -0
- package/src/assets/icons/storage-baidu.svg +1 -0
- package/src/assets/icons/storage-doge-cloud.svg +207 -0
- package/src/assets/icons/storage-ftp.svg +13 -0
- package/src/assets/icons/storage-google-drive.svg +8 -0
- package/src/assets/icons/storage-huawei.svg +1 -0
- package/src/assets/icons/storage-local.svg +11 -0
- package/src/assets/icons/storage-minio.svg +1 -0
- package/src/assets/icons/storage-onedrive-china.svg +18 -0
- package/src/assets/icons/storage-onedrive.svg +4 -0
- package/src/assets/icons/storage-open115.svg +23 -0
- package/src/assets/icons/storage-qiniu.svg +1 -0
- package/src/assets/icons/storage-s3.svg +5 -0
- package/src/assets/icons/storage-sftp.svg +13 -0
- package/src/assets/icons/storage-sharepoint-china.svg +23 -0
- package/src/assets/icons/storage-sharepoint.svg +1 -0
- package/src/assets/icons/storage-tencent.svg +9 -0
- package/src/assets/icons/storage-ufile.svg +14 -0
- package/src/assets/icons/storage-upyun.svg +1 -0
- package/src/assets/icons/storage-webdav.svg +1 -0
- package/src/assets/icons/upload.svg +50 -0
- package/src/assets/icons/zfile-basic.svg +17 -0
- package/src/assets/icons/zfile-horizontal.svg +16 -0
- package/src/assets/icons/zfile.svg +1 -0
- package/src/assets/vite.svg +1 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/HelloWorld.vue +319 -0
- package/src/components/common/QrCodePreview.vue +118 -0
- package/src/components/common/dialog/ZDialog.vue +171 -0
- package/src/components/common/dialog/types.ts +19 -0
- package/src/components/common/dialog/useDialog.ts +18 -0
- package/src/components/common/dialog/useDialogWithForm.ts +21 -0
- package/src/components/copy.vue +133 -0
- package/src/components/file/preview/AudioPlayer.vue +333 -0
- package/src/components/file/preview/CopyCode.vue +47 -0
- package/src/components/file/preview/FileGallery.vue +199 -0
- package/src/components/file/preview/ImageViewer.vue +432 -0
- package/src/components/file/preview/KkFileViewer.vue +86 -0
- package/src/components/file/preview/KkFileViewerDialog.vue +42 -0
- package/src/components/file/preview/MarkdownViewer.vue +102 -0
- package/src/components/file/preview/MarkdownViewerAsyncLoading.vue +17 -0
- package/src/components/file/preview/MarkdownViewerDialogAsyncLoading.vue +12 -0
- package/src/components/file/preview/OfficeViewer.vue +76 -0
- package/src/components/file/preview/OfficeViewerDialog.vue +55 -0
- package/src/components/file/preview/PdfViewer.vue +157 -0
- package/src/components/file/preview/PdfViewerDialog.vue +41 -0
- package/src/components/file/preview/TextViewer.vue +232 -0
- package/src/components/file/preview/TextViewerAsyncLoading.vue +22 -0
- package/src/components/file/preview/TextViewerDialog.vue +53 -0
- package/src/components/file/preview/Three3dPreview.vue +114 -0
- package/src/components/file/preview/Three3dPreviewDialog.vue +50 -0
- package/src/components/file/preview/VideoPlayer.vue +341 -0
- package/src/components/file/preview/VideoPlayerAsyncLoading.vue +45 -0
- package/src/components/file/preview/VideoPlayerDialog.vue +51 -0
- package/src/components/file/selectFolder/SelectFolder.vue +208 -0
- package/src/components/file/selectFolder/index.ts +50 -0
- package/src/components/file/selectFolder/types.ts +5 -0
- package/src/components/fileReview/AudioPlayer-copy.vue +333 -0
- package/src/components/fileReview/PdfViewer-copy.vue +157 -0
- package/src/components/fileReview/TextViewer-copy.vue +44 -0
- package/src/components/fileReview/VideoPlayer-copy.vue +341 -0
- package/src/components/messageBox/confirm/confirm.vue +137 -0
- package/src/components/messageBox/confirm/index.ts +27 -0
- package/src/components/messageBox/confirm/types.ts +15 -0
- package/src/components/messageBox/messageBox.ts +9 -0
- package/src/components/messageBox/prompt/index.ts +27 -0
- package/src/components/messageBox/prompt/prompt.vue +178 -0
- package/src/components/messageBox/prompt/types.ts +24 -0
- package/src/components/vue-codemirror/editor.vue +212 -0
- package/src/components/vue-codemirror/encodings.ts +27 -0
- package/src/components/vue-codemirror/index.vue +380 -0
- package/src/components/vue-codemirror/lang-code/cpp/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/css/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/dockerfile/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/erlang/index.ts +6 -0
- package/src/components/vue-codemirror/lang-code/go/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/html/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/java/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/javascript/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/json/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/jsx/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/lua/index.ts +6 -0
- package/src/components/vue-codemirror/lang-code/markdown/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/mysql/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/nginx/index.ts +6 -0
- package/src/components/vue-codemirror/lang-code/perl/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/pgsql/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/php/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/powershell/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/python/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/r/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/ruby/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/rust/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/shell/index.ts +5 -0
- package/src/components/vue-codemirror/lang-code/sql/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/stylus/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/swift/index.ts +4 -0
- package/src/components/vue-codemirror/lang-code/toml/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/tsx/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/typescript/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/vb/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/vbscript/index.ts +3 -0
- package/src/components/vue-codemirror/lang-code/xml/index.ts +2 -0
- package/src/components/vue-codemirror/lang-code/yaml/index.ts +3 -0
- package/src/components/vue-codemirror/languages.ts +8 -0
- package/src/components/vue-codemirror/themes.ts +5 -0
- package/src/components/vue-codemirror/toolbar.vue +183 -0
- package/src/components/vue-codemirror/types.ts +12 -0
- package/src/components.d.ts +49 -0
- package/src/composables/admin/layout/admin-layout.js +53 -0
- package/src/composables/admin/link/useLinkSetting.js +16 -0
- package/src/composables/admin/sso/baseSsoConfig.js +54 -0
- package/src/composables/admin/sso/useSsoConfig.js +176 -0
- package/src/composables/admin/storage/storage-copy.js +89 -0
- package/src/composables/admin/storage/storage-filter.js +64 -0
- package/src/composables/admin/storage/storage-list.js +202 -0
- package/src/composables/admin/storage/storage-password.js +101 -0
- package/src/composables/admin/storage/storage-readme.js +102 -0
- package/src/composables/admin/storage/utils/open115-util.js +61 -0
- package/src/composables/admin/useAdminSetting.js +60 -0
- package/src/composables/admin/useClientInfo.js +20 -0
- package/src/composables/admin/user/user-copy.js +79 -0
- package/src/composables/file/useBatchOperatorResult.js +19 -0
- package/src/composables/file/useFileContextMenu.js +74 -0
- package/src/composables/file/useFileData.js +243 -0
- package/src/composables/file/useFileLink.js +175 -0
- package/src/composables/file/useFileLoading.js +41 -0
- package/src/composables/file/useFileLongPressEvent.js +71 -0
- package/src/composables/file/useFileOperator.js +347 -0
- package/src/composables/file/useFilePreview.js +99 -0
- package/src/composables/file/useFilePwd.js +138 -0
- package/src/composables/file/useFileSelect.js +105 -0
- package/src/composables/file/useFileShare.js +39 -0
- package/src/composables/file/useFileUpload.js +1045 -0
- package/src/composables/file/useKkFileViewDialog.js +24 -0
- package/src/composables/file/useOfficeViewerDialog.js +20 -0
- package/src/composables/file/usePdfViewerDialog.js +22 -0
- package/src/composables/file/useShareActions.js +94 -0
- package/src/composables/file/useShareTableOperator.js +84 -0
- package/src/composables/file/useTableOperator.js +211 -0
- package/src/composables/file/useTextViewerDialog.js +22 -0
- package/src/composables/file/useThree3dPreviewDialog.js +23 -0
- package/src/composables/file/useVideoPlayerDialog.js +19 -0
- package/src/composables/header/useHeaderBreadcrumb.js +111 -0
- package/src/composables/header/useHeaderStorageList.js +150 -0
- package/src/composables/header/useSetting.js +58 -0
- package/src/composables/share/useShareData.js +178 -0
- package/src/composables/useDarks.ts +4 -0
- package/src/composables/useRouterData.js +41 -0
- package/src/constant/index.js +193 -0
- package/src/http/index.js +153 -0
- package/src/http/request.js +31 -0
- package/src/main.ts +23 -0
- package/src/stores/file-data.ts +108 -0
- package/src/stores/global-config.ts +115 -0
- package/src/stores/storage-config.ts +123 -0
- package/src/style.css +296 -0
- package/src/styles/admin.scss +91 -0
- package/src/styles/code-editor-variables.scss +52 -0
- package/src/styles/element-plus.scss +22 -0
- package/src/styles/error-page.css +26 -0
- package/src/styles/main.css +142 -0
- package/src/styles/tailwind/index.scss +33 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/models/base.ts +34 -0
- package/src/utils/models/file.ts +95 -0
- package/src/utils/models/path.ts +117 -0
- package/src/utils/models/qrcode.ts +21 -0
- package/src/utils/models/time.ts +132 -0
- package/src/utils/models/util.ts +42 -0
- package/src/utils/models/window.ts +14 -0
- package/stats.html +4950 -0
- package/tsconfig.app.json +16 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +57 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VueCodeEditor v-if="fileContent" :fileName="fileName" :modelValue="fileContent" :language="fileSuffix" :readonly="!storageConfigStore.permission.upload"></VueCodeEditor>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { onMounted, ref } from "vue";
|
|
7
|
+
import useStorageConfigStore from "~/stores/storage-config";
|
|
8
|
+
let storageConfigStore = useStorageConfigStore();
|
|
9
|
+
|
|
10
|
+
import { getFileSuffix } from "~/utils";
|
|
11
|
+
import VueCodeEditor from "~/components/vue-codemirror/index.vue";
|
|
12
|
+
|
|
13
|
+
// 组件接收的属性:
|
|
14
|
+
// fileUrl: 文件下载路径
|
|
15
|
+
// fileName: 文件名
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
fileUrl: String,
|
|
18
|
+
fileName: String
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// 获取文件名后缀
|
|
22
|
+
const fileSuffix = getFileSuffix(props.fileName);
|
|
23
|
+
|
|
24
|
+
// 文件内容
|
|
25
|
+
const fileContent = ref(null);
|
|
26
|
+
|
|
27
|
+
import { getFileTextReq } from "~/api/home/common";
|
|
28
|
+
|
|
29
|
+
// 挂载时,加载文件内容,并初始化播放器
|
|
30
|
+
onMounted(() => {
|
|
31
|
+
let fileUrl = props.fileUrl;
|
|
32
|
+
getFileTextReq(fileUrl).then((res) => {
|
|
33
|
+
fileContent.value = res.request.response;
|
|
34
|
+
}).catch((e) => {
|
|
35
|
+
ElMessage({
|
|
36
|
+
message: `加载文本文件失败. 请检查此地址是否有效或是否限制了跨域访问.`,
|
|
37
|
+
type: 'error',
|
|
38
|
+
duration: 0,
|
|
39
|
+
showClose: true,
|
|
40
|
+
grouping: true,
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
|
|
48
|
+
.toolbar {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-columns: repeat(1,minmax(0,1fr))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (min-width: 640px) {
|
|
54
|
+
.toolbar {
|
|
55
|
+
grid-template-columns:repeat(2,minmax(0,1fr))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (min-width: 768px) {
|
|
60
|
+
.toolbar {
|
|
61
|
+
grid-template-columns:repeat(3,minmax(0,1fr))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (min-width: 1280px) {
|
|
66
|
+
.toolbar {
|
|
67
|
+
grid-template-columns:repeat(5,minmax(0,1fr))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.toolbar .item {
|
|
72
|
+
margin-top: .25rem;
|
|
73
|
+
margin-bottom: .25rem;
|
|
74
|
+
display: -webkit-box;
|
|
75
|
+
display: flex
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.toolbar .item>:not([hidden])~:not([hidden]) {
|
|
79
|
+
--tw-space-x-reverse: 0;
|
|
80
|
+
margin-right: calc(.25rem * var(--tw-space-x-reverse));
|
|
81
|
+
margin-left: calc(.25rem * calc(1 - var(--tw-space-x-reverse)))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (min-width: 640px) {
|
|
85
|
+
.toolbar .item {
|
|
86
|
+
max-width:80%
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (min-width: 768px) {
|
|
91
|
+
.toolbar .item {
|
|
92
|
+
max-width:70%
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (min-width: 1280px) {
|
|
97
|
+
.toolbar .item {
|
|
98
|
+
max-width:60%
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.toolbar .item label {
|
|
103
|
+
white-space: nowrap
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.editor .cm-editor {
|
|
107
|
+
height: 50vh
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (min-width: 640px) {
|
|
111
|
+
.editor .cm-editor {
|
|
112
|
+
height:60vh
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@media (min-width: 1024px) {
|
|
117
|
+
.editor .cm-editor {
|
|
118
|
+
height:65vh
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.editor .divider {
|
|
123
|
+
height: 1px;
|
|
124
|
+
background-color: var(--theme-border)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.editor .main {
|
|
128
|
+
display: -webkit-box;
|
|
129
|
+
display: flex;
|
|
130
|
+
width: 100%
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.editor .main .code {
|
|
134
|
+
width: 30%;
|
|
135
|
+
height: 100px;
|
|
136
|
+
margin: 0;
|
|
137
|
+
padding: .4em;
|
|
138
|
+
overflow: scroll;
|
|
139
|
+
border-left: 1px solid var(--theme-border);
|
|
140
|
+
font-family: monospace
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.editor .footer {
|
|
144
|
+
height: 3rem;
|
|
145
|
+
display: -webkit-box;
|
|
146
|
+
display: flex;
|
|
147
|
+
-webkit-box-pack: justify;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
-webkit-box-align: center;
|
|
150
|
+
align-items: center;
|
|
151
|
+
font-size: 90%;
|
|
152
|
+
width: 100%
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@media not all and (min-width: 640px) {
|
|
156
|
+
.editor .footer {
|
|
157
|
+
-webkit-box-orient:vertical;
|
|
158
|
+
-webkit-box-direction: normal;
|
|
159
|
+
flex-direction: column
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.editor .footer .buttons>:not([hidden])~:not([hidden]) {
|
|
164
|
+
--tw-space-x-reverse: 0;
|
|
165
|
+
margin-right: calc(.75rem * var(--tw-space-x-reverse));
|
|
166
|
+
margin-left: calc(.75rem * calc(1 - var(--tw-space-x-reverse)))
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@media not all and (min-width: 640px) {
|
|
170
|
+
.editor .footer .buttons {
|
|
171
|
+
width:100%
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.editor .footer .buttons .item {
|
|
176
|
+
display: -webkit-inline-box;
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
-webkit-box-pack: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
-webkit-box-align: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
background-color: transparent;
|
|
183
|
+
border: 1px dashed var(--theme-border);
|
|
184
|
+
font-size: 12px;
|
|
185
|
+
color: var(--text-secondary);
|
|
186
|
+
cursor: pointer
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.editor .footer .buttons .item .iconfont {
|
|
190
|
+
margin-left: .309rem
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.editor .footer .buttons .item:hover {
|
|
194
|
+
color: var(--text-color);
|
|
195
|
+
border-color: var(--text-color)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.editor .footer .infos>:not([hidden])~:not([hidden]) {
|
|
199
|
+
--tw-space-x-reverse: 0;
|
|
200
|
+
margin-right: calc(.75rem * var(--tw-space-x-reverse));
|
|
201
|
+
margin-left: calc(.75rem * calc(1 - var(--tw-space-x-reverse)))
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@media not all and (min-width: 640px) {
|
|
205
|
+
.editor .footer .infos {
|
|
206
|
+
width:100%
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.editor .footer .infos .item {
|
|
211
|
+
display: inline-block;
|
|
212
|
+
-webkit-font-feature-settings: "tnum";
|
|
213
|
+
font-feature-settings: "tnum"
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.example .divider {
|
|
217
|
+
height: 1px;
|
|
218
|
+
background-color: var(--theme-border)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.example .cm-editor {
|
|
222
|
+
height: var(--51369a7c)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.example .loading-box {
|
|
226
|
+
overflow: auto;
|
|
227
|
+
width: 100%;
|
|
228
|
+
min-height: 20rem;
|
|
229
|
+
max-height: 60rem;
|
|
230
|
+
height: calc(100vh - 42.2rem - 2px)
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="zfile-async-loading p-10 h-[75vh] w-full">
|
|
3
|
+
<div class="flex justify-between h-full">
|
|
4
|
+
<div class="w-1/4">
|
|
5
|
+
<el-skeleton animated :count="6" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="w-20 h-full">
|
|
8
|
+
<el-skeleton animated class="h-full">
|
|
9
|
+
<template #template>
|
|
10
|
+
<el-skeleton-item variant="rect" class="!h-full"></el-skeleton-item>
|
|
11
|
+
</template>
|
|
12
|
+
</el-skeleton>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style lang="scss" scoped>
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<z-dialog
|
|
3
|
+
v-model="visible"
|
|
4
|
+
draggable
|
|
5
|
+
top="5vh"
|
|
6
|
+
class="zfile-text-viewer-dialog"
|
|
7
|
+
:title="name"
|
|
8
|
+
width="90%"
|
|
9
|
+
:showFooter="false"
|
|
10
|
+
>
|
|
11
|
+
<TextViewer :file-name="name"
|
|
12
|
+
:file-url="url"
|
|
13
|
+
v-if="visible && name.indexOf('.md') === -1"/>
|
|
14
|
+
<MarkdownViewer :file-name="name"
|
|
15
|
+
:file-url="url"
|
|
16
|
+
v-if="visible && name.indexOf('.md') !== -1"/>
|
|
17
|
+
</z-dialog>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import ZDialog from "~/components/common/dialog/ZDialog.vue";
|
|
22
|
+
import MarkdownViewerDialogAsyncLoading from "~/components/file/preview/MarkdownViewerDialogAsyncLoading.vue";
|
|
23
|
+
|
|
24
|
+
const TextViewer = defineAsyncComponent({
|
|
25
|
+
loader: () => import("~/components/file/preview/TextViewer.vue"),
|
|
26
|
+
loadingComponent: MarkdownViewerDialogAsyncLoading
|
|
27
|
+
})
|
|
28
|
+
const MarkdownViewer = defineAsyncComponent({
|
|
29
|
+
loader: () => import("~/components/file/preview/MarkdownViewer.vue"),
|
|
30
|
+
loadingComponent: MarkdownViewerDialogAsyncLoading
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
import useTextViewerDialog from "~/composables/file/useTextViewerDialog";
|
|
34
|
+
const { visible, name, url } = useTextViewerDialog();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style scoped lang="scss">
|
|
38
|
+
:deep(.zfile-text-viewer-dialog) {
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
height: 90%;
|
|
41
|
+
|
|
42
|
+
.el-dialog__body {
|
|
43
|
+
@apply overflow-hidden p-0 h-full;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.is-fullscreen {
|
|
47
|
+
.markdown-body {
|
|
48
|
+
height: 90vh;
|
|
49
|
+
}
|
|
50
|
+
height: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="el">
|
|
3
|
+
<div class="float-right mb-1">
|
|
4
|
+
<span>背景颜色: </span>
|
|
5
|
+
<el-color-picker v-model="color" show-alpha :predefine="predefineColors" />
|
|
6
|
+
</div>
|
|
7
|
+
<vue3dLoader
|
|
8
|
+
v-if="loadFinish"
|
|
9
|
+
:key="resizeCount"
|
|
10
|
+
class="h-[75vh] clear-right"
|
|
11
|
+
:fileType="fileSuffix"
|
|
12
|
+
:mtlPath="mtlPath"
|
|
13
|
+
:backgroundColor="color"
|
|
14
|
+
:filePath='fileLinkUrl'>
|
|
15
|
+
</vue3dLoader>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { useResizeObserver } from '@vueuse/core'
|
|
22
|
+
const el = ref(null)
|
|
23
|
+
const resizeCount = ref(0);
|
|
24
|
+
|
|
25
|
+
useResizeObserver(el, () => {
|
|
26
|
+
resizeCount.value++;
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
import { getFileNameIgnoreExt, getFileSuffix } from "~/utils";
|
|
30
|
+
import { vue3dLoader } from "vue-3d-loader";
|
|
31
|
+
|
|
32
|
+
import useRouterData from "~/composables/useRouterData";
|
|
33
|
+
let { currentPath } = useRouterData();
|
|
34
|
+
|
|
35
|
+
import useFileLink from "~/composables/file/useFileLink";
|
|
36
|
+
let { batchGetFilePathLink } = useFileLink();
|
|
37
|
+
|
|
38
|
+
const loadFinish = ref(false);
|
|
39
|
+
let mtlPath = ref();
|
|
40
|
+
|
|
41
|
+
// 组件接收的属性:
|
|
42
|
+
// fileUrl: 文件下载路径
|
|
43
|
+
// fileName: 文件名
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
fileUrl: String,
|
|
46
|
+
fileName: String
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
init();
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
let fileSuffix = getFileSuffix(props.fileName);
|
|
54
|
+
let fileLinkUrl = ref();
|
|
55
|
+
|
|
56
|
+
const init = async () => {
|
|
57
|
+
|
|
58
|
+
let loadPathLinkFiles = [
|
|
59
|
+
{
|
|
60
|
+
path: currentPath.value,
|
|
61
|
+
name: props.fileName
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
if (fileSuffix === "obj") {
|
|
66
|
+
let basicName = getFileNameIgnoreExt(props.fileName);
|
|
67
|
+
loadPathLinkFiles.push({
|
|
68
|
+
path: currentPath.value,
|
|
69
|
+
name: basicName + '.mtl',
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let generateLinkResult = await batchGetFilePathLink(loadPathLinkFiles);
|
|
74
|
+
if (generateLinkResult) {
|
|
75
|
+
fileLinkUrl.value = generateLinkResult[0];
|
|
76
|
+
if (generateLinkResult.length > 1) {
|
|
77
|
+
mtlPath.value = generateLinkResult[1];
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
console.log('加载文件直链失败,无法预览。');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
loadFinish.value = true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
onUnmounted(() => {
|
|
87
|
+
mtlPath.value = null;
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const color = useStorage('zfile-3d-color', '#ffffff');
|
|
92
|
+
|
|
93
|
+
const predefineColors = ref([
|
|
94
|
+
'#ff4500',
|
|
95
|
+
'#ff8c00',
|
|
96
|
+
'#ffd700',
|
|
97
|
+
'#90ee90',
|
|
98
|
+
'#00ced1',
|
|
99
|
+
'#1e90ff',
|
|
100
|
+
'#c71585',
|
|
101
|
+
'rgba(255, 69, 0, 0.68)',
|
|
102
|
+
'rgb(255, 120, 0)',
|
|
103
|
+
'hsv(51, 100, 98)',
|
|
104
|
+
'hsva(120, 40, 94, 0.5)',
|
|
105
|
+
'hsl(181, 100%, 37%)',
|
|
106
|
+
'hsla(209, 100%, 56%, 0.73)',
|
|
107
|
+
'#c7158577',
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style scoped>
|
|
113
|
+
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<z-dialog
|
|
3
|
+
v-model="visible"
|
|
4
|
+
draggable
|
|
5
|
+
top="5vh"
|
|
6
|
+
width="90%"
|
|
7
|
+
class="zfile-three-3d-dialog"
|
|
8
|
+
:title="name"
|
|
9
|
+
:showFooter="false"
|
|
10
|
+
>
|
|
11
|
+
<Three3dPreview v-if="visible" :fileName="name" :fileUrl="url"/>
|
|
12
|
+
</z-dialog>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import ZDialog from "~/components/common/dialog/ZDialog.vue";
|
|
17
|
+
import MarkdownViewerDialogAsyncLoading from "~/components/file/preview/MarkdownViewerDialogAsyncLoading.vue";
|
|
18
|
+
|
|
19
|
+
const Three3dPreview = defineAsyncComponent({
|
|
20
|
+
loader: () => import("~/components/file/preview/Three3dPreview.vue"),
|
|
21
|
+
loadingComponent: MarkdownViewerDialogAsyncLoading
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
import useThree3dPreviewDialog from "~/composables/file/useThree3dPreviewDialog";
|
|
25
|
+
const { visible, name, url } = useThree3dPreviewDialog();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style scoped lang="scss">
|
|
29
|
+
:deep(.el-dialog) {
|
|
30
|
+
// 内容无边框
|
|
31
|
+
@apply p-0;
|
|
32
|
+
|
|
33
|
+
// 标题有边框
|
|
34
|
+
.el-dialog__header {
|
|
35
|
+
@apply p-2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 全屏时,视频播放器高度 90vh
|
|
39
|
+
&.is-fullscreen {
|
|
40
|
+
.viewer-container {
|
|
41
|
+
height: calc(100vh - 41px - 32px - 4px);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 隐藏底部按钮
|
|
46
|
+
.el-dialog__footer {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|