From 4cd5be26ad7f34842b63cc08bb2b0747c693d0d9 Mon Sep 17 00:00:00 2001 From: ckfear Date: Sun, 2 Apr 2023 16:55:55 +0800 Subject: [PATCH] fix: Fix the uploadInfo text from static text to dynamic --- .../components/editor/editor-modal-media.vue | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/client/components/editor/editor-modal-media.vue b/client/components/editor/editor-modal-media.vue index 100a36df..9bcaaecc 100644 --- a/client/components/editor/editor-modal-media.vue +++ b/client/components/editor/editor-modal-media.vue @@ -150,7 +150,7 @@ ) v-divider v-card-actions.pa-3 - .caption.grey--text.text-darken-2 Max 10 files, 5 MB each + .caption.grey--text.text-darken-2 Max {{config.uploadMaxFiles}} files, {{config.uploadMaxFileSize | prettyBytes}} each v-spacer v-btn.px-4(color='teal', dark, @click='upload') {{$t('common:actions.upload')}} @@ -239,6 +239,7 @@ import listFolderAssetQuery from 'gql/editor/editor-media-query-folder-list.gql' import createAssetFolderMutation from 'gql/editor/editor-media-mutation-folder-create.gql' import renameAssetMutation from 'gql/editor/editor-media-mutation-asset-rename.gql' import deleteAssetMutation from 'gql/editor/editor-media-mutation-asset-delete.gql' +import gql from 'graphql-tag' const FilePond = vueFilePond() const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i @@ -278,7 +279,11 @@ export default { renameAssetName: '', renameAssetLoading: false, deleteDialog: false, - deleteAssetLoading: false + deleteAssetLoading: false, + config: { + uploadMaxFileSize: 0, + uploadMaxFiles: 0 + } } }, computed: { @@ -546,6 +551,23 @@ export default { this.loading = isLoading this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-list-refresh') } + }, + config: { + query: gql` + { + site { + config { + uploadMaxFileSize + uploadMaxFiles + } + } + } + `, + fetchPolicy: 'network-only', + update: (data) => data.site.config, + watchLoading (isLoading) { + this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-config-refresh') + } } } }