@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,183 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="toolbar">
|
|
3
|
+
<div class="item">
|
|
4
|
+
<label for="language">语言:</label>
|
|
5
|
+
<el-select
|
|
6
|
+
v-model="config.language"
|
|
7
|
+
placeholder="请选择"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
class="w-32"
|
|
10
|
+
size="small"
|
|
11
|
+
@change="handleSelectLanguage">
|
|
12
|
+
<el-option
|
|
13
|
+
v-for="option in languages"
|
|
14
|
+
:key="option"
|
|
15
|
+
:label="option"
|
|
16
|
+
:value="option">
|
|
17
|
+
</el-option>
|
|
18
|
+
</el-select>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="item">
|
|
21
|
+
<label for="language">编码:</label>
|
|
22
|
+
<el-select
|
|
23
|
+
v-model="config.encoding"
|
|
24
|
+
placeholder="请选择"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
class="w-32"
|
|
27
|
+
size="small"
|
|
28
|
+
@change="handleSelectEncoding">
|
|
29
|
+
<el-option
|
|
30
|
+
v-for="option in encodings"
|
|
31
|
+
:key="option"
|
|
32
|
+
:label="option"
|
|
33
|
+
:value="option">
|
|
34
|
+
</el-option>
|
|
35
|
+
</el-select>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="item">
|
|
38
|
+
<label for="theme">主题:</label>
|
|
39
|
+
<el-select
|
|
40
|
+
v-model="config.theme"
|
|
41
|
+
placeholder="请选择"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
class="w-20"
|
|
44
|
+
size="small">
|
|
45
|
+
<el-option
|
|
46
|
+
v-for="option in ['default', ...themes]"
|
|
47
|
+
:key="option"
|
|
48
|
+
:label="option"
|
|
49
|
+
:value="option">
|
|
50
|
+
</el-option>
|
|
51
|
+
</el-select>
|
|
52
|
+
</div>
|
|
53
|
+
<!-- <div class="item">
|
|
54
|
+
<label for="disabled">只读:</label>
|
|
55
|
+
<el-checkbox
|
|
56
|
+
id="disabled"
|
|
57
|
+
v-model="config.readonly"
|
|
58
|
+
:disabled="disabled"
|
|
59
|
+
size="small">
|
|
60
|
+
</el-checkbox>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="item">
|
|
63
|
+
<label for="lineWrapping">自动换行:</label>
|
|
64
|
+
<el-checkbox
|
|
65
|
+
id="lineWrapping"
|
|
66
|
+
v-model="config.lineWrapping"
|
|
67
|
+
:disabled="disabled"
|
|
68
|
+
size="small">
|
|
69
|
+
</el-checkbox>
|
|
70
|
+
</div> -->
|
|
71
|
+
<div class="item" v-show="false">
|
|
72
|
+
<label for="autofocus">autofocus:</label>
|
|
73
|
+
<el-checkbox
|
|
74
|
+
id="autofocus"
|
|
75
|
+
v-model="config.autofocus"
|
|
76
|
+
:disabled="disabled"
|
|
77
|
+
size="small">
|
|
78
|
+
</el-checkbox>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="item" v-show="false">
|
|
81
|
+
<label for="indentWithTab">indentWithTab:</label>
|
|
82
|
+
<el-checkbox
|
|
83
|
+
id="indentWithTab"
|
|
84
|
+
v-model="config.indentWithTab"
|
|
85
|
+
:disabled="disabled"
|
|
86
|
+
size="small">
|
|
87
|
+
</el-checkbox>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="item" v-show="false">
|
|
90
|
+
<label for="tabSize">tabSize:</label>
|
|
91
|
+
<el-select
|
|
92
|
+
v-model.number="config.tabSize"
|
|
93
|
+
id="tabSize"
|
|
94
|
+
placeholder="请选择"
|
|
95
|
+
:disabled="disabled"
|
|
96
|
+
class="w-12"
|
|
97
|
+
size="small">
|
|
98
|
+
<el-option
|
|
99
|
+
v-for="option in [2, 4, 6, 8]"
|
|
100
|
+
:key="option"
|
|
101
|
+
:label="option"
|
|
102
|
+
:value="option">
|
|
103
|
+
</el-option>
|
|
104
|
+
</el-select>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="item" v-show="false">
|
|
107
|
+
<label for="height">height:</label>
|
|
108
|
+
<el-select
|
|
109
|
+
v-model="config.height"
|
|
110
|
+
placeholder="请选择"
|
|
111
|
+
:disabled="disabled"
|
|
112
|
+
class="w-16"
|
|
113
|
+
size="small">
|
|
114
|
+
<el-option
|
|
115
|
+
v-for="option in ['auto', '200px', '40em', '60vh']"
|
|
116
|
+
:key="option"
|
|
117
|
+
:label="option"
|
|
118
|
+
:value="option">
|
|
119
|
+
</el-option>
|
|
120
|
+
</el-select>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<script setup lang="ts">
|
|
126
|
+
import { ElSelect, ElOption, ElCheckbox } from "element-plus";
|
|
127
|
+
import { PropType } from "vue";
|
|
128
|
+
import { ToolBarConfig } from "./types";
|
|
129
|
+
|
|
130
|
+
const props = defineProps({
|
|
131
|
+
disabled: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false
|
|
134
|
+
},
|
|
135
|
+
config: {
|
|
136
|
+
type: Object as PropType<ToolBarConfig>,
|
|
137
|
+
required: true
|
|
138
|
+
},
|
|
139
|
+
languages: {
|
|
140
|
+
type: Array as PropType<Array<string>>,
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
encodings: {
|
|
144
|
+
type: Object as PropType<Record<string, string>>,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
themes: {
|
|
148
|
+
type: Array as PropType<Array<string>>,
|
|
149
|
+
required: true
|
|
150
|
+
},
|
|
151
|
+
readonly: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const emits = defineEmits<{
|
|
158
|
+
(e: 'language', data: string): void
|
|
159
|
+
(e: 'encoding', data: string): void
|
|
160
|
+
}>()
|
|
161
|
+
|
|
162
|
+
const handleSelectLanguage = (value: string) => {
|
|
163
|
+
emits("language", value)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const handleSelectEncoding = (value: string) => {
|
|
167
|
+
emits("encoding", value)
|
|
168
|
+
}
|
|
169
|
+
</script>
|
|
170
|
+
|
|
171
|
+
<style lang="scss">
|
|
172
|
+
.toolbar {
|
|
173
|
+
@apply grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5;
|
|
174
|
+
|
|
175
|
+
.item {
|
|
176
|
+
@apply sm:max-w-[80%] md:max-w-[70%] xl:max-w-[60%] space-x-1 flex my-1;
|
|
177
|
+
|
|
178
|
+
label {
|
|
179
|
+
@apply whitespace-nowrap;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// Generated by unplugin-vue-components
|
|
4
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
+
// biome-ignore lint: disable
|
|
6
|
+
export {}
|
|
7
|
+
|
|
8
|
+
/* prettier-ignore */
|
|
9
|
+
declare module 'vue' {
|
|
10
|
+
export interface GlobalComponents {
|
|
11
|
+
1: typeof import('./components/1.vue')['default']
|
|
12
|
+
AudioPlayer: typeof import('./components/file/preview/AudioPlayer.vue')['default']
|
|
13
|
+
AudioPlayerCopy: typeof import('./components/fileReview/AudioPlayer-copy.vue')['default']
|
|
14
|
+
Confirm: typeof import('./components/messageBox/confirm/confirm.vue')['default']
|
|
15
|
+
CopyCode: typeof import('./components/file/preview/CopyCode.vue')['default']
|
|
16
|
+
Editor: typeof import('./components/vue-codemirror/editor.vue')['default']
|
|
17
|
+
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
|
|
18
|
+
FileGallery: typeof import('./components/file/preview/FileGallery.vue')['default']
|
|
19
|
+
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
|
20
|
+
KkFileViewer: typeof import('./components/file/preview/KkFileViewer.vue')['default']
|
|
21
|
+
KkFileViewerDialog: typeof import('./components/file/preview/KkFileViewerDialog.vue')['default']
|
|
22
|
+
MarkdownViewer: typeof import('./components/file/preview/MarkdownViewer.vue')['default']
|
|
23
|
+
MarkdownViewerAsyncLoading: typeof import('./components/file/preview/MarkdownViewerAsyncLoading.vue')['default']
|
|
24
|
+
MarkdownViewerDialogAsyncLoading: typeof import('./components/file/preview/MarkdownViewerDialogAsyncLoading.vue')['default']
|
|
25
|
+
OfficeViewer: typeof import('./components/file/preview/OfficeViewer.vue')['default']
|
|
26
|
+
OfficeViewerDialog: typeof import('./components/file/preview/OfficeViewerDialog.vue')['default']
|
|
27
|
+
PdfViewer: typeof import('./components/file/preview/PdfViewer.vue')['default']
|
|
28
|
+
PdfViewerCopy: typeof import('./components/fileReview/PdfViewer-copy.vue')['default']
|
|
29
|
+
PdfViewerDialog: typeof import('./components/file/preview/PdfViewerDialog.vue')['default']
|
|
30
|
+
Prompt: typeof import('./components/messageBox/prompt/prompt.vue')['default']
|
|
31
|
+
QrCodePreview: typeof import('./components/common/QrCodePreview.vue')['default']
|
|
32
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
|
33
|
+
RouterView: typeof import('vue-router')['RouterView']
|
|
34
|
+
SelectFolder: typeof import('./components/file/selectFolder/SelectFolder.vue')['default']
|
|
35
|
+
TextViewer: typeof import('./components/file/preview/TextViewer.vue')['default']
|
|
36
|
+
TextViewerAsyncLoading: typeof import('./components/file/preview/TextViewerAsyncLoading.vue')['default']
|
|
37
|
+
TextViewerCopy: typeof import('./components/fileReview/TextViewer-copy.vue')['default']
|
|
38
|
+
TextViewerDialog: typeof import('./components/file/preview/TextViewerDialog.vue')['default']
|
|
39
|
+
Three3dPreview: typeof import('./components/file/preview/Three3dPreview.vue')['default']
|
|
40
|
+
Three3dPreviewDialog: typeof import('./components/file/preview/Three3dPreviewDialog.vue')['default']
|
|
41
|
+
Toolbar: typeof import('./components/vue-codemirror/toolbar.vue')['default']
|
|
42
|
+
VideoPlayer: typeof import('./components/file/preview/VideoPlayer.vue')['default']
|
|
43
|
+
VideoPlayerAsyncLoading: typeof import('./components/file/preview/VideoPlayerAsyncLoading.vue')['default']
|
|
44
|
+
VideoPlayerCopy: typeof import('./components/fileReview/VideoPlayer-copy.vue')['default']
|
|
45
|
+
VideoPlayerDialog: typeof import('./components/file/preview/VideoPlayerDialog.vue')['default']
|
|
46
|
+
VueCodemirror: typeof import('./components/vue-codemirror/index.vue')['default']
|
|
47
|
+
ZDialog: typeof import('./components/common/dialog/ZDialog.vue')['default']
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// 请求加载
|
|
2
|
+
import { downloadLogReq } from "~/api/admin/admin-setting";
|
|
3
|
+
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
|
|
6
|
+
export default function useAdminLayout(router, route) {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 日志下载
|
|
10
|
+
*/
|
|
11
|
+
const logDownload = () => {
|
|
12
|
+
const loading = ElLoading.service({
|
|
13
|
+
fullscreen: true,
|
|
14
|
+
lock: true,
|
|
15
|
+
text: '下载中...',
|
|
16
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
|
17
|
+
});
|
|
18
|
+
downloadLogReq().then((res) => {
|
|
19
|
+
const { data, headers } = res;
|
|
20
|
+
const fileName = `ZFile 诊断日志 - ${dayjs().format('YYYY-MM-DD HH:mm:ss')}.zip`;
|
|
21
|
+
// 此处当返回json文件时需要先对data进行JSON.stringify处理,其他类型文件不用做处理
|
|
22
|
+
//const blob = new Blob([JSON.stringify(data)], ...)
|
|
23
|
+
const blob = new Blob([data], {type: headers['content-type']})
|
|
24
|
+
let dom = document.createElement('a')
|
|
25
|
+
let url = window.URL.createObjectURL(blob)
|
|
26
|
+
dom.href = url
|
|
27
|
+
dom.download = decodeURI(fileName)
|
|
28
|
+
dom.style.display = 'none'
|
|
29
|
+
document.body.appendChild(dom)
|
|
30
|
+
dom.click()
|
|
31
|
+
dom.parentNode.removeChild(dom)
|
|
32
|
+
window.URL.revokeObjectURL(url);
|
|
33
|
+
}).catch((res) => {
|
|
34
|
+
ElMessage.error('下载日志失败.');
|
|
35
|
+
}).finally(() => {
|
|
36
|
+
loading.close();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const rebuildTitle = () => {
|
|
41
|
+
if (route.path.indexOf('/admin') === -1) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// 获取当前选中的左侧导航的文字, 作为标题
|
|
45
|
+
document.title = (route.meta.name || 'ZFile') + ' | 后台管理';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
logDownload,
|
|
50
|
+
rebuildTitle
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getLinkLimitInfoReq } from "~/api/admin/admin-setting";
|
|
2
|
+
|
|
3
|
+
const linkLimitInfoList = ref([]);
|
|
4
|
+
|
|
5
|
+
export default function useLinkSetting() {
|
|
6
|
+
|
|
7
|
+
const loadLinkLimitInfo = () => {
|
|
8
|
+
getLinkLimitInfoReq().then(res => {
|
|
9
|
+
linkLimitInfoList.value = res.data;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
linkLimitInfoList, loadLinkLimitInfo
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const baseSsoConfig = {
|
|
2
|
+
github: {
|
|
3
|
+
"provider": "github",
|
|
4
|
+
"name": "Github",
|
|
5
|
+
"icon": "<svg t=\"1747450607632\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"4752\" width=\"200\" height=\"200\"><path d=\"M950.930286 512q0 143.433143-83.748571 257.974857t-216.283429 158.573714q-15.433143 2.852571-22.601143-4.022857t-7.168-17.115429l0-120.539429q0-55.442286-29.696-81.115429 32.548571-3.437714 58.587429-10.313143t53.686857-22.308571 46.299429-38.034286 30.281143-59.977143 11.702857-86.016q0-69.12-45.129143-117.686857 21.138286-52.004571-4.534857-116.589714-16.018286-5.12-46.299429 6.290286t-52.589714 25.161143l-21.723429 13.677714q-53.174857-14.848-109.714286-14.848t-109.714286 14.848q-9.142857-6.290286-24.283429-15.433143t-47.689143-22.016-49.152-7.68q-25.161143 64.585143-4.022857 116.589714-45.129143 48.566857-45.129143 117.686857 0 48.566857 11.702857 85.723429t29.988571 59.977143 46.006857 38.253714 53.686857 22.308571 58.587429 10.313143q-22.820571 20.553143-28.013714 58.88-11.995429 5.705143-25.746286 8.557714t-32.548571 2.852571-37.449143-12.288-31.744-35.693714q-10.825143-18.285714-27.721143-29.696t-28.306286-13.677714l-11.410286-1.682286q-11.995429 0-16.603429 2.56t-2.852571 6.582857 5.12 7.972571 7.460571 6.875429l4.022857 2.852571q12.580571 5.705143 24.868571 21.723429t17.993143 29.110857l5.705143 13.165714q7.460571 21.723429 25.161143 35.108571t38.253714 17.115429 39.716571 4.022857 31.744-1.974857l13.165714-2.267429q0 21.723429 0.292571 50.834286t0.292571 30.866286q0 10.313143-7.460571 17.115429t-22.820571 4.022857q-132.534857-44.032-216.283429-158.573714t-83.748571-257.974857q0-119.442286 58.88-220.306286t159.744-159.744 220.306286-58.88 220.306286 58.88 159.744 159.744 58.88 220.306286z\" fill=\"#444444\" p-id=\"4753\"></path></svg>",
|
|
6
|
+
"clientId": "",
|
|
7
|
+
"clientSecret": "",
|
|
8
|
+
"authUrl": "https://github.com/login/oauth/authorize",
|
|
9
|
+
"tokenUrl": "https://github.com/login/oauth/access_token",
|
|
10
|
+
"userInfoUrl": "https://api.github.com/user",
|
|
11
|
+
"scope": "user:email",
|
|
12
|
+
"bindingField": "email",
|
|
13
|
+
"enabled": true
|
|
14
|
+
},
|
|
15
|
+
gitee: {
|
|
16
|
+
"provider": "gitee",
|
|
17
|
+
"name": "Gitee",
|
|
18
|
+
"icon": "<svg t=\"1747558280392\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"4149\" width=\"200\" height=\"200\"><path d=\"M512 1024C229.2224 1024 0 794.7776 0 512S229.2224 0 512 0s512 229.2224 512 512-229.2224 512-512 512z m259.1488-568.8832H480.4096a25.2928 25.2928 0 0 0-25.2928 25.2928l-0.0256 63.2064c0 13.952 11.3152 25.2928 25.2672 25.2928h177.024c13.9776 0 25.2928 11.3152 25.2928 25.2672v12.6464a75.8528 75.8528 0 0 1-75.8528 75.8528H366.592a25.2928 25.2928 0 0 1-25.2672-25.2928v-240.1792a75.8528 75.8528 0 0 1 75.8272-75.8528h353.9456a25.2928 25.2928 0 0 0 25.2672-25.2928l0.0768-63.2064a25.2928 25.2928 0 0 0-25.2672-25.2928H417.152a189.6192 189.6192 0 0 0-189.6192 189.6448v353.9456c0 13.9776 11.3152 25.2928 25.2928 25.2928h372.9408a170.6496 170.6496 0 0 0 170.6496-170.6496v-145.408a25.2928 25.2928 0 0 0-25.2928-25.2672z\" fill=\"#C71D23\" p-id=\"4150\"></path></svg>",
|
|
19
|
+
"clientId": "",
|
|
20
|
+
"clientSecret": "",
|
|
21
|
+
"authUrl": "https://gitee.com/oauth/authorize",
|
|
22
|
+
"tokenUrl": "https://gitee.com/oauth/token",
|
|
23
|
+
"userInfoUrl": "https://gitee.com/api/v5/user",
|
|
24
|
+
"scope": "user_info",
|
|
25
|
+
"bindingField": "login",
|
|
26
|
+
"enabled": true
|
|
27
|
+
},
|
|
28
|
+
gitlab: {
|
|
29
|
+
"provider": "gitlab",
|
|
30
|
+
"name": "Gitlab",
|
|
31
|
+
"icon": "<svg t=\"1747696327658\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2457\" width=\"200\" height=\"200\"><path d=\"M932.317184 567.76704L885.10464 422.46144l-93.57312-287.997952c-4.8128-14.81728-25.776128-14.81728-30.590976 0L667.36128 422.459392H356.62848L263.051264 134.46144c-4.8128-14.81728-25.776128-14.81728-30.593024 0l-93.57312 287.997952-47.210496 145.309696a32.165888 32.165888 0 0 0 11.68384 35.96288l408.6272 296.890368L920.61696 603.734016c11.272192-8.192 15.990784-22.71232 11.68384-35.964928\" fill=\"#FC6D26\" p-id=\"2458\"></path><path d=\"M512.002048 900.62848l155.365376-478.171136H356.634624z\" fill=\"#E24329\" p-id=\"2459\"></path><path d=\"M512.004096 900.62848L356.63872 422.47168H138.901504z\" fill=\"#FC6D26\" p-id=\"2460\"></path><path d=\"M138.891264 422.465536l-47.214592 145.309696a32.16384 32.16384 0 0 0 11.685888 35.96288L511.991808 900.62848z\" fill=\"#FCA326\" p-id=\"2461\"></path><path d=\"M138.893312 422.459392h217.737216L263.053312 134.46144c-4.8128-14.819328-25.778176-14.819328-30.590976 0z\" fill=\"#E24329\" p-id=\"2462\"></path><path d=\"M512.002048 900.62848l155.365376-478.154752H885.10464z\" fill=\"#FC6D26\" p-id=\"2463\"></path><path d=\"M885.11488 422.465536l47.214592 145.309696a32.16384 32.16384 0 0 1-11.685888 35.96288L512.014336 900.62848z\" fill=\"#FCA326\" p-id=\"2464\"></path><path d=\"M885.096448 422.459392H667.36128l93.577216-287.997952c4.814848-14.819328 25.778176-14.819328 30.590976 0z\" fill=\"#E24329\" p-id=\"2465\"></path></svg>",
|
|
32
|
+
"clientId": "",
|
|
33
|
+
"clientSecret": "",
|
|
34
|
+
"authUrl": "https://gitlab.com/oauth/authorize",
|
|
35
|
+
"tokenUrl": "https://gitlab.com/oauth/token",
|
|
36
|
+
"userInfoUrl": "https://gitlab.com/api/v4/user",
|
|
37
|
+
"scope": "openid email",
|
|
38
|
+
"bindingField": "email",
|
|
39
|
+
"enabled": true
|
|
40
|
+
},
|
|
41
|
+
logto_cloud: {
|
|
42
|
+
"provider": "logto_cloud",
|
|
43
|
+
"name": "Logto Cloud",
|
|
44
|
+
"icon": " <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"> <g clip-path=\"url(#clip0_3163_230)\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0 5.62127C0 4.58692 0 4.06975 0.189869 3.65348C0.357191 3.28664 0.626294 2.97572 0.96511 2.75777C1.34958 2.51044 1.86074 2.43703 2.88305 2.29021L17.463 0.196199C18.7865 0.00612588 19.4482 -0.0889106 19.9624 0.111751C20.4138 0.2879 20.7905 0.61494 21.0287 1.03745C21.3 1.51875 21.3 2.18826 21.3 3.52727L21.3 32.4727C21.3 33.8117 21.3 34.4812 21.0287 34.9626C20.7905 35.3851 20.4138 35.7121 19.9624 35.8882C19.4482 36.0889 18.7865 35.9939 17.463 35.8038L2.88305 33.7098C1.86074 33.563 1.34958 33.4896 0.96511 33.2422C0.626294 33.0243 0.357191 32.7134 0.189869 32.3465C0 31.9302 0 31.4131 0 30.3787L0 5.62127ZM14.7 15.4267C14.7 15.1172 14.7 14.9625 14.7582 14.8402C14.8094 14.7325 14.8916 14.6425 14.9942 14.5817C15.1108 14.5127 15.2649 14.4986 15.5731 14.4706L16.9531 14.3452C17.3162 14.3122 17.4978 14.2957 17.6379 14.3562C17.7611 14.4094 17.8629 14.5024 17.927 14.6202C18 14.7543 18 14.9366 18 15.3012L18 20.6988C18 21.0634 18 21.2457 17.927 21.3798C17.8629 21.4976 17.7611 21.5906 17.6379 21.6438C17.4978 21.7043 17.3162 21.6878 16.9531 21.6548L15.5731 21.5294H15.5731C15.2649 21.5014 15.1108 21.4873 14.9942 21.4183C14.8916 21.3575 14.8094 21.2675 14.7582 21.1598C14.7 21.0375 14.7 20.8828 14.7 20.5733L14.7 15.4267ZM25.44 3H23.4L23.4 33H25.44C26.6161 33 27.2042 33 27.6534 32.7711C28.0485 32.5698 28.3698 32.2485 28.5711 31.8534C28.8 31.4042 28.8 30.8161 28.8 29.64L28.8 6.36C28.8 5.18389 28.8 4.59583 28.5711 4.14662C28.3698 3.75148 28.0485 3.43022 27.6534 3.22889C27.2042 3 26.6161 3 25.44 3Z\" fill=\"#191C1D\" /> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0 5.62127C0 4.58692 0 4.06975 0.189869 3.65348C0.357191 3.28664 0.626294 2.97572 0.96511 2.75777C1.34958 2.51044 1.86074 2.43703 2.88305 2.29021L17.463 0.196199C18.7865 0.00612588 19.4482 -0.0889106 19.9624 0.111751C20.4138 0.2879 20.7905 0.61494 21.0287 1.03745C21.3 1.51875 21.3 2.18826 21.3 3.52727L21.3 32.4727C21.3 33.8117 21.3 34.4812 21.0287 34.9626C20.7905 35.3851 20.4138 35.7121 19.9624 35.8882C19.4482 36.0889 18.7865 35.9939 17.463 35.8038L2.88305 33.7098C1.86074 33.563 1.34958 33.4896 0.96511 33.2422C0.626294 33.0243 0.357191 32.7134 0.189869 32.3465C0 31.9302 0 31.4131 0 30.3787L0 5.62127ZM14.7 15.4267C14.7 15.1172 14.7 14.9625 14.7582 14.8402C14.8094 14.7325 14.8916 14.6425 14.9942 14.5817C15.1108 14.5127 15.2649 14.4986 15.5731 14.4706L16.9531 14.3452C17.3162 14.3122 17.4978 14.2957 17.6379 14.3562C17.7611 14.4094 17.8629 14.5024 17.927 14.6202C18 14.7543 18 14.9366 18 15.3012L18 20.6988C18 21.0634 18 21.2457 17.927 21.3798C17.8629 21.4976 17.7611 21.5906 17.6379 21.6438C17.4978 21.7043 17.3162 21.6878 16.9531 21.6548L15.5731 21.5294H15.5731C15.2649 21.5014 15.1108 21.4873 14.9942 21.4183C14.8916 21.3575 14.8094 21.2675 14.7582 21.1598C14.7 21.0375 14.7 20.8828 14.7 20.5733L14.7 15.4267ZM25.44 3H23.4L23.4 33H25.44C26.6161 33 27.2042 33 27.6534 32.7711C28.0485 32.5698 28.3698 32.2485 28.5711 31.8534C28.8 31.4042 28.8 30.8161 28.8 29.64L28.8 6.36C28.8 5.18389 28.8 4.59583 28.5711 4.14662C28.3698 3.75148 28.0485 3.43022 27.6534 3.22889C27.2042 3 26.6161 3 25.44 3Z\" fill=\"url(#paint0_linear_3163_230)\" /> </g> <defs> <linearGradient id=\"paint0_linear_3163_230\" x1=\"-8.91429\" y1=\"24.8965\" x2=\"26.9632\" y2=\"10.8165\" gradientUnits=\"userSpaceOnUse\"> <stop stop-color=\"#4B2EFB\" /> <stop offset=\"1\" stop-color=\"#E65FFC\" /> </linearGradient> <clipPath id=\"clip0_3163_230\"> <rect width=\"28.8\" height=\"36\" fill=\"white\" /> </clipPath> </defs> </svg>",
|
|
45
|
+
"clientId": "",
|
|
46
|
+
"clientSecret": "",
|
|
47
|
+
"authUrl": "https://你的账号前缀.logto.app/oidc/auth",
|
|
48
|
+
"tokenUrl": "https://你的账号前缀.logto.app/oidc/token",
|
|
49
|
+
"userInfoUrl": "https://你的账号前缀.logto.app/oidc/me",
|
|
50
|
+
"scope": "openid email",
|
|
51
|
+
"bindingField": "email",
|
|
52
|
+
"enabled": true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { ElMessage } from "element-plus";
|
|
2
|
+
import { baseSsoConfig } from "~/composables/admin/sso/baseSsoConfig";
|
|
3
|
+
import {
|
|
4
|
+
listReq,
|
|
5
|
+
deleteReq,
|
|
6
|
+
saveOrUpdateReq,
|
|
7
|
+
checkProviderDuplicateReq,
|
|
8
|
+
} from "~/api/admin/admin-sso";
|
|
9
|
+
|
|
10
|
+
const currentSsoProvider = ref()
|
|
11
|
+
|
|
12
|
+
export default function useSsoConfig() {
|
|
13
|
+
|
|
14
|
+
const ssoConfigList = ref([])
|
|
15
|
+
const autoId = ref(-1)
|
|
16
|
+
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
loadList()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const loadList = () => {
|
|
22
|
+
listReq().then((res) => {
|
|
23
|
+
ssoConfigList.value = res.data.map(item => {
|
|
24
|
+
return {
|
|
25
|
+
...item,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
if (!currentSsoProvider.value) {
|
|
29
|
+
currentSsoProvider.value = ssoConfigList.value[0]?.id
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const saveOrUpdate = () => {
|
|
35
|
+
const item = ssoConfigList.value.find(item => item.id === currentSsoProvider.value)
|
|
36
|
+
if (item.id < 0) {
|
|
37
|
+
item.id = null
|
|
38
|
+
}
|
|
39
|
+
saveOrUpdateReq(item).then((res) => {
|
|
40
|
+
ElMessage({
|
|
41
|
+
type: 'success',
|
|
42
|
+
message: '保存成功',
|
|
43
|
+
})
|
|
44
|
+
if (!item.id) {
|
|
45
|
+
currentSsoProvider.value = res.data.id
|
|
46
|
+
}
|
|
47
|
+
loadList()
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const formRules = ref({
|
|
52
|
+
provider: [
|
|
53
|
+
{ required: true, message: '请输入服务商简称', trigger: ['change'] },
|
|
54
|
+
{
|
|
55
|
+
validator: (rule, value, callback) => {
|
|
56
|
+
let reg = /^[a-z0-9_-]+$/;
|
|
57
|
+
if (!reg.test(value)) {
|
|
58
|
+
callback(new Error('只允许使用小写字母、数字、下划线、横杠。'));
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let params = {
|
|
63
|
+
id: currentSsoProvider.value,
|
|
64
|
+
provider: value
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
checkProviderDuplicateReq(params).then((res) => {
|
|
68
|
+
if (res.data) {
|
|
69
|
+
callback(new Error("该服务商简称已存在,请修改。"));
|
|
70
|
+
} else {
|
|
71
|
+
callback();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
name: [
|
|
78
|
+
{required: true, message: '请输入服务商名称', trigger: ['change']},
|
|
79
|
+
],
|
|
80
|
+
icon: [
|
|
81
|
+
{required: true, message: '请输入服务商图标', trigger: ['change']},
|
|
82
|
+
],
|
|
83
|
+
clientId: [
|
|
84
|
+
{required: true, message: '请输入 ClientId', trigger: ['change']},
|
|
85
|
+
],
|
|
86
|
+
clientSecret: [
|
|
87
|
+
{required: true, message: '请输入 ClientSecret', trigger: ['change']},
|
|
88
|
+
],
|
|
89
|
+
authUrl: [
|
|
90
|
+
{required: true, message: '请输入授权端点', trigger: ['change']},
|
|
91
|
+
],
|
|
92
|
+
tokenUrl: [
|
|
93
|
+
{required: true, message: '请输入 Token 端点', trigger: ['change']},
|
|
94
|
+
],
|
|
95
|
+
userInfoUrl: [
|
|
96
|
+
{required: true, message: '请输入用户信息端点', trigger: ['change']},
|
|
97
|
+
],
|
|
98
|
+
scope: [
|
|
99
|
+
{required: true, message: '请输入授权范围', trigger: ['change']},
|
|
100
|
+
],
|
|
101
|
+
bindingField: [
|
|
102
|
+
{required: true, message: '请输入绑定字段', trigger: ['change']},
|
|
103
|
+
],
|
|
104
|
+
enabled: [
|
|
105
|
+
{required: true, message: '请选择是否启用', trigger: ['change']},
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const addTab = (provider) => {
|
|
110
|
+
const index = autoId.value--;
|
|
111
|
+
if (provider) {
|
|
112
|
+
const providerConfig = baseSsoConfig[provider]
|
|
113
|
+
if (providerConfig) {
|
|
114
|
+
let newProvider = JSON.parse(JSON.stringify(providerConfig))
|
|
115
|
+
newProvider.id = index
|
|
116
|
+
ssoConfigList.value.push(newProvider)
|
|
117
|
+
currentSsoProvider.value = index
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ssoConfigList.value.push({
|
|
123
|
+
id: index,
|
|
124
|
+
provider: 'new' + index,
|
|
125
|
+
name: '新服务商' + index,
|
|
126
|
+
icon: '',
|
|
127
|
+
clientId: '',
|
|
128
|
+
clientSecret: '',
|
|
129
|
+
authUrl: '',
|
|
130
|
+
tokenUrl: '',
|
|
131
|
+
userInfoUrl: '',
|
|
132
|
+
scope: '',
|
|
133
|
+
bindingField: '',
|
|
134
|
+
enabled: true,
|
|
135
|
+
})
|
|
136
|
+
currentSsoProvider.value = index
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const removeTab = (delId) => {
|
|
140
|
+
ElMessageBox.confirm('是否确认删除?', {
|
|
141
|
+
confirmButtonText: '确定',
|
|
142
|
+
cancelButtonText: '取消',
|
|
143
|
+
type: 'warning',
|
|
144
|
+
}).then(() => {
|
|
145
|
+
if (delId < 0) {
|
|
146
|
+
const index = ssoConfigList.value.findIndex(item => item.id === delId)
|
|
147
|
+
if (index === -1) {
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
ssoConfigList.value.splice(index, 1)
|
|
151
|
+
if (currentSsoProvider.value === delId) {
|
|
152
|
+
currentSsoProvider.value = ssoConfigList.value[0]?.id
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
deleteReq(delId).then((res) => {
|
|
156
|
+
ElMessage({
|
|
157
|
+
type: 'success',
|
|
158
|
+
message: '删除成功',
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
if (currentSsoProvider.value === delId) {
|
|
162
|
+
currentSsoProvider.value = null
|
|
163
|
+
}
|
|
164
|
+
loadList()
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
ssoConfigList, currentSsoProvider,
|
|
172
|
+
formRules, addTab, removeTab,
|
|
173
|
+
saveOrUpdate
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { copyStorageReq, existStorageKeyReq } from "~/api/admin/admin-storage";
|
|
2
|
+
import { constant } from '../../src/constant/index.js'
|
|
3
|
+
const formData = reactive({
|
|
4
|
+
toName: '',
|
|
5
|
+
toKey: '',
|
|
6
|
+
fromId: null
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const rules = {
|
|
10
|
+
toName: [
|
|
11
|
+
{ required: true, message: '请输入新存储源名称', trigger: 'blur' }
|
|
12
|
+
],
|
|
13
|
+
toKey: [
|
|
14
|
+
{ required: true, message: '请输入新存储源别名', trigger: 'blur' },
|
|
15
|
+
{
|
|
16
|
+
validator: (rule, value, callback) => {
|
|
17
|
+
if (value === undefined || value === null || value === '') {
|
|
18
|
+
callback('请输入存储源别名');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (constant.systemNames.includes(value)) {
|
|
23
|
+
callback(new Error('不可占用系统级名称,请修改。'));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let reg = /^[\w\-]+$/;
|
|
28
|
+
if (!reg.test(value)) {
|
|
29
|
+
callback(new Error('只允许使用字母、数字、下划线、横杠'));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
existStorageKeyReq({storageKey: value}).then((res) => {
|
|
34
|
+
if (res.data) {
|
|
35
|
+
callback(new Error('该存储源别名已存在,请修改。'));
|
|
36
|
+
} else {
|
|
37
|
+
callback();
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const dialogVisible = ref(false);
|
|
46
|
+
const saveLoading = ref(false);
|
|
47
|
+
export default function useStorageCopy() {
|
|
48
|
+
|
|
49
|
+
const openDialog = (row) => {
|
|
50
|
+
dialogVisible.value = true;
|
|
51
|
+
formData.fromId = row.id;
|
|
52
|
+
formData.toKey = row.key;
|
|
53
|
+
formData.toName = row.name;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const closeDialog = () => {
|
|
57
|
+
dialogVisible.value = false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const storageCopyFormRef = ref(null);
|
|
61
|
+
|
|
62
|
+
const submitForm = (emit) => {
|
|
63
|
+
saveLoading.value = true;
|
|
64
|
+
storageCopyFormRef.value.validate((valid) => {
|
|
65
|
+
if (valid) {
|
|
66
|
+
copyStorageReq(formData).then((res) => {
|
|
67
|
+
ElMessage.success('复制成功');
|
|
68
|
+
dialogVisible.value = false;
|
|
69
|
+
emit('close');
|
|
70
|
+
}).finally(() => {
|
|
71
|
+
saveLoading.value = false;
|
|
72
|
+
})
|
|
73
|
+
} else {
|
|
74
|
+
saveLoading.value = false;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
dialogVisible,
|
|
81
|
+
openDialog,
|
|
82
|
+
closeDialog,
|
|
83
|
+
formData,
|
|
84
|
+
rules,
|
|
85
|
+
storageCopyFormRef,
|
|
86
|
+
submitForm,
|
|
87
|
+
saveLoading
|
|
88
|
+
}
|
|
89
|
+
}
|