@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.
Files changed (274) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +5 -0
  3. package/auto-imports.d.ts +12 -0
  4. package/components.d.ts +45 -0
  5. package/dist.zip +0 -0
  6. package/index.html +13 -0
  7. package/package.json +100 -0
  8. package/presets/eslint/.eslintrc-auto-import.json +462 -0
  9. package/presets/plugins/html.ts +14 -0
  10. package/presets/shared/env.ts +46 -0
  11. package/presets/shared/resolvers.ts +29 -0
  12. package/presets/tov.ts +132 -0
  13. package/presets/types/auto-imports.d.ts +806 -0
  14. package/presets/types/components.d.ts +164 -0
  15. package/presets/types/env.d.ts +17 -0
  16. package/public/favicon.svg +1 -0
  17. package/public/icons.svg +24 -0
  18. package/public/testfile/README.md +5 -0
  19. package/public/testfile/useFileContextMenu.js +74 -0
  20. package/public/testfile//345/217/221/347/245/250.pdf +0 -0
  21. package/public/testfile//346/216/245/346/224/266/345/207/275.docx +0 -0
  22. package/public/testfile//350/247/204/346/240/274/345/236/213/345/217/2671.txt +263 -0
  23. package/public/testfile//350/247/206/351/242/2211.mp4 +0 -0
  24. package/public/testfile//351/237/263/351/242/2211.mp3 +0 -0
  25. package/src/App.vue +8 -0
  26. package/src/api/admin/admin-2fa.js +18 -0
  27. package/src/api/admin/admin-download-log.js +37 -0
  28. package/src/api/admin/admin-login-log.js +9 -0
  29. package/src/api/admin/admin-permission.js +9 -0
  30. package/src/api/admin/admin-setting.js +121 -0
  31. package/src/api/admin/admin-share.js +20 -0
  32. package/src/api/admin/admin-short-link.js +49 -0
  33. package/src/api/admin/admin-sso.js +38 -0
  34. package/src/api/admin/admin-storage.js +189 -0
  35. package/src/api/admin/admin-user.js +61 -0
  36. package/src/api/home/common.js +9 -0
  37. package/src/api/home/file-operator.js +89 -0
  38. package/src/api/home/home.js +87 -0
  39. package/src/api/home/install.js +18 -0
  40. package/src/api/home/login.js +9 -0
  41. package/src/api/home/only-office.js +10 -0
  42. package/src/api/home/share.js +115 -0
  43. package/src/api/home/user.js +74 -0
  44. package/src/api/tools/tools-115.js +17 -0
  45. package/src/api/tools/tools-gd.js +13 -0
  46. package/src/api/tools/tools-s3.js +25 -0
  47. package/src/api/tools/tools-sharepoint.js +19 -0
  48. package/src/assets/hero.png +0 -0
  49. package/src/assets/icons/401.svg +1 -0
  50. package/src/assets/icons/403.svg +45 -0
  51. package/src/assets/icons/404.svg +1 -0
  52. package/src/assets/icons/500.svg +1 -0
  53. package/src/assets/icons/admin-login.svg +1 -0
  54. package/src/assets/icons/document.svg +1 -0
  55. package/src/assets/icons/empty.svg +145 -0
  56. package/src/assets/icons/file-type-apk.svg +1 -0
  57. package/src/assets/icons/file-type-archive.svg +1 -0
  58. package/src/assets/icons/file-type-audio.svg +1 -0
  59. package/src/assets/icons/file-type-back.svg +1 -0
  60. package/src/assets/icons/file-type-css.svg +1 -0
  61. package/src/assets/icons/file-type-deb.svg +1 -0
  62. package/src/assets/icons/file-type-dll.svg +1 -0
  63. package/src/assets/icons/file-type-doc.svg +1 -0
  64. package/src/assets/icons/file-type-document.svg +1 -0
  65. package/src/assets/icons/file-type-docx.svg +1 -0
  66. package/src/assets/icons/file-type-exe.svg +1 -0
  67. package/src/assets/icons/file-type-expression.svg +1 -0
  68. package/src/assets/icons/file-type-file.svg +1 -0
  69. package/src/assets/icons/file-type-folder.svg +1 -0
  70. package/src/assets/icons/file-type-html.svg +1 -0
  71. package/src/assets/icons/file-type-image.svg +1 -0
  72. package/src/assets/icons/file-type-java.svg +1 -0
  73. package/src/assets/icons/file-type-js.svg +1 -0
  74. package/src/assets/icons/file-type-less.svg +1 -0
  75. package/src/assets/icons/file-type-md.svg +1 -0
  76. package/src/assets/icons/file-type-office.svg +1 -0
  77. package/src/assets/icons/file-type-pdf.svg +1 -0
  78. package/src/assets/icons/file-type-php.svg +1 -0
  79. package/src/assets/icons/file-type-ppt.svg +1 -0
  80. package/src/assets/icons/file-type-pptx.svg +1 -0
  81. package/src/assets/icons/file-type-py.svg +1 -0
  82. package/src/assets/icons/file-type-rb.svg +1 -0
  83. package/src/assets/icons/file-type-root.svg +1 -0
  84. package/src/assets/icons/file-type-rpm.svg +1 -0
  85. package/src/assets/icons/file-type-rust.svg +1 -0
  86. package/src/assets/icons/file-type-script.svg +1 -0
  87. package/src/assets/icons/file-type-text.svg +1 -0
  88. package/src/assets/icons/file-type-three3d.svg +5 -0
  89. package/src/assets/icons/file-type-vbs.svg +1 -0
  90. package/src/assets/icons/file-type-video.svg +1 -0
  91. package/src/assets/icons/file-type-xls.svg +1 -0
  92. package/src/assets/icons/file-type-xlsx.svg +1 -0
  93. package/src/assets/icons/file-type-xml.svg +1 -0
  94. package/src/assets/icons/file-type-yaml.svg +1 -0
  95. package/src/assets/icons/file-upload.svg +1 -0
  96. package/src/assets/icons/github.svg +1 -0
  97. package/src/assets/icons/install-step.svg +40 -0
  98. package/src/assets/icons/reset-password.svg +1 -0
  99. package/src/assets/icons/storage-aliyun.svg +1 -0
  100. package/src/assets/icons/storage-baidu.svg +1 -0
  101. package/src/assets/icons/storage-doge-cloud.svg +207 -0
  102. package/src/assets/icons/storage-ftp.svg +13 -0
  103. package/src/assets/icons/storage-google-drive.svg +8 -0
  104. package/src/assets/icons/storage-huawei.svg +1 -0
  105. package/src/assets/icons/storage-local.svg +11 -0
  106. package/src/assets/icons/storage-minio.svg +1 -0
  107. package/src/assets/icons/storage-onedrive-china.svg +18 -0
  108. package/src/assets/icons/storage-onedrive.svg +4 -0
  109. package/src/assets/icons/storage-open115.svg +23 -0
  110. package/src/assets/icons/storage-qiniu.svg +1 -0
  111. package/src/assets/icons/storage-s3.svg +5 -0
  112. package/src/assets/icons/storage-sftp.svg +13 -0
  113. package/src/assets/icons/storage-sharepoint-china.svg +23 -0
  114. package/src/assets/icons/storage-sharepoint.svg +1 -0
  115. package/src/assets/icons/storage-tencent.svg +9 -0
  116. package/src/assets/icons/storage-ufile.svg +14 -0
  117. package/src/assets/icons/storage-upyun.svg +1 -0
  118. package/src/assets/icons/storage-webdav.svg +1 -0
  119. package/src/assets/icons/upload.svg +50 -0
  120. package/src/assets/icons/zfile-basic.svg +17 -0
  121. package/src/assets/icons/zfile-horizontal.svg +16 -0
  122. package/src/assets/icons/zfile.svg +1 -0
  123. package/src/assets/vite.svg +1 -0
  124. package/src/assets/vue.svg +1 -0
  125. package/src/components/HelloWorld.vue +319 -0
  126. package/src/components/common/QrCodePreview.vue +118 -0
  127. package/src/components/common/dialog/ZDialog.vue +171 -0
  128. package/src/components/common/dialog/types.ts +19 -0
  129. package/src/components/common/dialog/useDialog.ts +18 -0
  130. package/src/components/common/dialog/useDialogWithForm.ts +21 -0
  131. package/src/components/copy.vue +133 -0
  132. package/src/components/file/preview/AudioPlayer.vue +333 -0
  133. package/src/components/file/preview/CopyCode.vue +47 -0
  134. package/src/components/file/preview/FileGallery.vue +199 -0
  135. package/src/components/file/preview/ImageViewer.vue +432 -0
  136. package/src/components/file/preview/KkFileViewer.vue +86 -0
  137. package/src/components/file/preview/KkFileViewerDialog.vue +42 -0
  138. package/src/components/file/preview/MarkdownViewer.vue +102 -0
  139. package/src/components/file/preview/MarkdownViewerAsyncLoading.vue +17 -0
  140. package/src/components/file/preview/MarkdownViewerDialogAsyncLoading.vue +12 -0
  141. package/src/components/file/preview/OfficeViewer.vue +76 -0
  142. package/src/components/file/preview/OfficeViewerDialog.vue +55 -0
  143. package/src/components/file/preview/PdfViewer.vue +157 -0
  144. package/src/components/file/preview/PdfViewerDialog.vue +41 -0
  145. package/src/components/file/preview/TextViewer.vue +232 -0
  146. package/src/components/file/preview/TextViewerAsyncLoading.vue +22 -0
  147. package/src/components/file/preview/TextViewerDialog.vue +53 -0
  148. package/src/components/file/preview/Three3dPreview.vue +114 -0
  149. package/src/components/file/preview/Three3dPreviewDialog.vue +50 -0
  150. package/src/components/file/preview/VideoPlayer.vue +341 -0
  151. package/src/components/file/preview/VideoPlayerAsyncLoading.vue +45 -0
  152. package/src/components/file/preview/VideoPlayerDialog.vue +51 -0
  153. package/src/components/file/selectFolder/SelectFolder.vue +208 -0
  154. package/src/components/file/selectFolder/index.ts +50 -0
  155. package/src/components/file/selectFolder/types.ts +5 -0
  156. package/src/components/fileReview/AudioPlayer-copy.vue +333 -0
  157. package/src/components/fileReview/PdfViewer-copy.vue +157 -0
  158. package/src/components/fileReview/TextViewer-copy.vue +44 -0
  159. package/src/components/fileReview/VideoPlayer-copy.vue +341 -0
  160. package/src/components/messageBox/confirm/confirm.vue +137 -0
  161. package/src/components/messageBox/confirm/index.ts +27 -0
  162. package/src/components/messageBox/confirm/types.ts +15 -0
  163. package/src/components/messageBox/messageBox.ts +9 -0
  164. package/src/components/messageBox/prompt/index.ts +27 -0
  165. package/src/components/messageBox/prompt/prompt.vue +178 -0
  166. package/src/components/messageBox/prompt/types.ts +24 -0
  167. package/src/components/vue-codemirror/editor.vue +212 -0
  168. package/src/components/vue-codemirror/encodings.ts +27 -0
  169. package/src/components/vue-codemirror/index.vue +380 -0
  170. package/src/components/vue-codemirror/lang-code/cpp/index.ts +3 -0
  171. package/src/components/vue-codemirror/lang-code/css/index.ts +2 -0
  172. package/src/components/vue-codemirror/lang-code/dockerfile/index.ts +5 -0
  173. package/src/components/vue-codemirror/lang-code/erlang/index.ts +6 -0
  174. package/src/components/vue-codemirror/lang-code/go/index.ts +5 -0
  175. package/src/components/vue-codemirror/lang-code/html/index.ts +3 -0
  176. package/src/components/vue-codemirror/lang-code/java/index.ts +3 -0
  177. package/src/components/vue-codemirror/lang-code/javascript/index.ts +3 -0
  178. package/src/components/vue-codemirror/lang-code/json/index.ts +3 -0
  179. package/src/components/vue-codemirror/lang-code/jsx/index.ts +3 -0
  180. package/src/components/vue-codemirror/lang-code/lua/index.ts +6 -0
  181. package/src/components/vue-codemirror/lang-code/markdown/index.ts +2 -0
  182. package/src/components/vue-codemirror/lang-code/mysql/index.ts +3 -0
  183. package/src/components/vue-codemirror/lang-code/nginx/index.ts +6 -0
  184. package/src/components/vue-codemirror/lang-code/perl/index.ts +5 -0
  185. package/src/components/vue-codemirror/lang-code/pgsql/index.ts +2 -0
  186. package/src/components/vue-codemirror/lang-code/php/index.ts +3 -0
  187. package/src/components/vue-codemirror/lang-code/powershell/index.ts +3 -0
  188. package/src/components/vue-codemirror/lang-code/python/index.ts +2 -0
  189. package/src/components/vue-codemirror/lang-code/r/index.ts +5 -0
  190. package/src/components/vue-codemirror/lang-code/ruby/index.ts +5 -0
  191. package/src/components/vue-codemirror/lang-code/rust/index.ts +2 -0
  192. package/src/components/vue-codemirror/lang-code/shell/index.ts +5 -0
  193. package/src/components/vue-codemirror/lang-code/sql/index.ts +3 -0
  194. package/src/components/vue-codemirror/lang-code/stylus/index.ts +3 -0
  195. package/src/components/vue-codemirror/lang-code/swift/index.ts +4 -0
  196. package/src/components/vue-codemirror/lang-code/toml/index.ts +3 -0
  197. package/src/components/vue-codemirror/lang-code/tsx/index.ts +2 -0
  198. package/src/components/vue-codemirror/lang-code/typescript/index.ts +2 -0
  199. package/src/components/vue-codemirror/lang-code/vb/index.ts +3 -0
  200. package/src/components/vue-codemirror/lang-code/vbscript/index.ts +3 -0
  201. package/src/components/vue-codemirror/lang-code/xml/index.ts +2 -0
  202. package/src/components/vue-codemirror/lang-code/yaml/index.ts +3 -0
  203. package/src/components/vue-codemirror/languages.ts +8 -0
  204. package/src/components/vue-codemirror/themes.ts +5 -0
  205. package/src/components/vue-codemirror/toolbar.vue +183 -0
  206. package/src/components/vue-codemirror/types.ts +12 -0
  207. package/src/components.d.ts +49 -0
  208. package/src/composables/admin/layout/admin-layout.js +53 -0
  209. package/src/composables/admin/link/useLinkSetting.js +16 -0
  210. package/src/composables/admin/sso/baseSsoConfig.js +54 -0
  211. package/src/composables/admin/sso/useSsoConfig.js +176 -0
  212. package/src/composables/admin/storage/storage-copy.js +89 -0
  213. package/src/composables/admin/storage/storage-filter.js +64 -0
  214. package/src/composables/admin/storage/storage-list.js +202 -0
  215. package/src/composables/admin/storage/storage-password.js +101 -0
  216. package/src/composables/admin/storage/storage-readme.js +102 -0
  217. package/src/composables/admin/storage/utils/open115-util.js +61 -0
  218. package/src/composables/admin/useAdminSetting.js +60 -0
  219. package/src/composables/admin/useClientInfo.js +20 -0
  220. package/src/composables/admin/user/user-copy.js +79 -0
  221. package/src/composables/file/useBatchOperatorResult.js +19 -0
  222. package/src/composables/file/useFileContextMenu.js +74 -0
  223. package/src/composables/file/useFileData.js +243 -0
  224. package/src/composables/file/useFileLink.js +175 -0
  225. package/src/composables/file/useFileLoading.js +41 -0
  226. package/src/composables/file/useFileLongPressEvent.js +71 -0
  227. package/src/composables/file/useFileOperator.js +347 -0
  228. package/src/composables/file/useFilePreview.js +99 -0
  229. package/src/composables/file/useFilePwd.js +138 -0
  230. package/src/composables/file/useFileSelect.js +105 -0
  231. package/src/composables/file/useFileShare.js +39 -0
  232. package/src/composables/file/useFileUpload.js +1045 -0
  233. package/src/composables/file/useKkFileViewDialog.js +24 -0
  234. package/src/composables/file/useOfficeViewerDialog.js +20 -0
  235. package/src/composables/file/usePdfViewerDialog.js +22 -0
  236. package/src/composables/file/useShareActions.js +94 -0
  237. package/src/composables/file/useShareTableOperator.js +84 -0
  238. package/src/composables/file/useTableOperator.js +211 -0
  239. package/src/composables/file/useTextViewerDialog.js +22 -0
  240. package/src/composables/file/useThree3dPreviewDialog.js +23 -0
  241. package/src/composables/file/useVideoPlayerDialog.js +19 -0
  242. package/src/composables/header/useHeaderBreadcrumb.js +111 -0
  243. package/src/composables/header/useHeaderStorageList.js +150 -0
  244. package/src/composables/header/useSetting.js +58 -0
  245. package/src/composables/share/useShareData.js +178 -0
  246. package/src/composables/useDarks.ts +4 -0
  247. package/src/composables/useRouterData.js +41 -0
  248. package/src/constant/index.js +193 -0
  249. package/src/http/index.js +153 -0
  250. package/src/http/request.js +31 -0
  251. package/src/main.ts +23 -0
  252. package/src/stores/file-data.ts +108 -0
  253. package/src/stores/global-config.ts +115 -0
  254. package/src/stores/storage-config.ts +123 -0
  255. package/src/style.css +296 -0
  256. package/src/styles/admin.scss +91 -0
  257. package/src/styles/code-editor-variables.scss +52 -0
  258. package/src/styles/element-plus.scss +22 -0
  259. package/src/styles/error-page.css +26 -0
  260. package/src/styles/main.css +142 -0
  261. package/src/styles/tailwind/index.scss +33 -0
  262. package/src/utils/index.ts +7 -0
  263. package/src/utils/models/base.ts +34 -0
  264. package/src/utils/models/file.ts +95 -0
  265. package/src/utils/models/path.ts +117 -0
  266. package/src/utils/models/qrcode.ts +21 -0
  267. package/src/utils/models/time.ts +132 -0
  268. package/src/utils/models/util.ts +42 -0
  269. package/src/utils/models/window.ts +14 -0
  270. package/stats.html +4950 -0
  271. package/tsconfig.app.json +16 -0
  272. package/tsconfig.json +7 -0
  273. package/tsconfig.node.json +26 -0
  274. 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>