From fb66f0c1054cd3a21ddea76b3dbf7fcbb8bdb536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Sun, 15 May 2022 18:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/magic/basic/mb-icon.vue | 7 +++--- .../src/components/magic/data/mb-tree.vue | 2 +- .../components/magic/form/mb-upload-file.vue | 24 +++++++++++++++---- .../components/magic/form/mb-upload-image.vue | 22 +++++++++++++---- .../src/components/magic/template/mb-list.vue | 5 +++- .../src/views/examples/test-mb-form.vue | 11 ++++++++- .../src/views/examples/upload-file.vue | 9 ++++--- .../src/views/system/menu/menu-list.vue | 4 ++-- .../src/views/system/office/office-list.vue | 2 +- .../org/ssssssss/magicboot/model/Global.java | 2 +- magic-boot/src/main/resources/application.yml | 12 ++-------- 11 files changed, 67 insertions(+), 33 deletions(-) diff --git a/magic-boot-ui/src/components/magic/basic/mb-icon.vue b/magic-boot-ui/src/components/magic/basic/mb-icon.vue index 541125b..064946e 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-icon.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-icon.vue @@ -10,18 +10,17 @@ const props = defineProps({ type: String, default: 'mb-icon' }, - icon: String, - size: String, + icon: String }); const symbolId = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon : `#${props.prefix}-${props.icon}`) const className = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon.substring(1) : `${props.prefix}-${props.icon}`) \ No newline at end of file + diff --git a/magic-boot-ui/src/components/magic/data/mb-tree.vue b/magic-boot-ui/src/components/magic/data/mb-tree.vue index 67657e5..77a28be 100644 --- a/magic-boot-ui/src/components/magic/data/mb-tree.vue +++ b/magic-boot-ui/src/components/magic/data/mb-tree.vue @@ -29,7 +29,7 @@ import { watch, ref, reactive, defineExpose, nextTick, getCurrentInstance, onBef const { proxy } = getCurrentInstance() -const emit = defineEmits(['update:modelValue', 'check-change', 'node-click', 'mounted']) +const emit = defineEmits(['update:modelValue', 'check-change', 'node-click']) const props = defineProps({ url: { diff --git a/magic-boot-ui/src/components/magic/form/mb-upload-file.vue b/magic-boot-ui/src/components/magic/form/mb-upload-file.vue index b03595a..3e2d038 100644 --- a/magic-boot-ui/src/components/magic/form/mb-upload-file.vue +++ b/magic-boot-ui/src/components/magic/form/mb-upload-file.vue @@ -85,6 +85,10 @@ export default { showRemoveTip: { type: Boolean, default: () => true + }, + join: { + type: Boolean, + default: true } }, data() { @@ -172,8 +176,13 @@ export default { } }) if (this.multiple) { - this.$emit('update:modelValue', this.urls) - this.$emit('change', this.urls) + if(this.join){ + this.$emit('update:modelValue', this.urls.join(',')) + this.$emit('change', this.urls.join(',')) + }else{ + this.$emit('update:modelValue', this.urls) + this.$emit('change', this.urls) + } } else { document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].removeAttribute('disabled') this.$emit('update:modelValue', '') @@ -196,10 +205,15 @@ export default { handleAvatarSuccess(res, file, fileList) { this.uploadLoading = false if (res.data) { + this.urls.push(res.data.url) if (this.multiple) { - this.urls.push(res.data.url) - this.$emit('update:modelValue', this.urls) - this.$emit('change', this.urls) + if(this.join){ + this.$emit('update:modelValue', this.urls.join(',')) + this.$emit('change', this.urls.join(',')) + }else{ + this.$emit('update:modelValue', this.urls) + this.$emit('change', this.urls) + } } else { document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].setAttribute('disabled', '') this.$emit('update:modelValue', res.data.url) diff --git a/magic-boot-ui/src/components/magic/form/mb-upload-image.vue b/magic-boot-ui/src/components/magic/form/mb-upload-image.vue index 12b83ad..567d73a 100644 --- a/magic-boot-ui/src/components/magic/form/mb-upload-image.vue +++ b/magic-boot-ui/src/components/magic/form/mb-upload-image.vue @@ -133,6 +133,10 @@ export default { tipColor: { type: String, default: '' + }, + join: { + type: Boolean, + default: true } }, data() { @@ -200,8 +204,13 @@ export default { }) this.$delete('/system/file/delete', { url: encodeURI(url) }) if (this.multiple) { - this.$emit('update:modelValue', this.urls) - this.$emit('change', this.urls) + if(this.join){ + this.$emit('update:modelValue', this.urls.join(',')) + this.$emit('change', this.urls.join(',')) + }else{ + this.$emit('update:modelValue', this.urls) + this.$emit('change', this.urls) + } } else { this.$emit('update:modelValue', '') this.$emit('change', '') @@ -221,8 +230,13 @@ export default { this.urls.push(res.data.url) // console.log(this.urls) if (this.multiple) { - this.$emit('update:modelValue', this.urls) - this.$emit('change', this.urls) + if(this.join){ + this.$emit('update:modelValue', this.urls.join(',')) + this.$emit('change', this.urls.join(',')) + }else{ + this.$emit('update:modelValue', this.urls) + this.$emit('change', this.urls) + } } else { this.$emit('update:modelValue', res.data.url) this.$emit('change', res.data.url) diff --git a/magic-boot-ui/src/components/magic/template/mb-list.vue b/magic-boot-ui/src/components/magic/template/mb-list.vue index 29024d5..1340b7f 100644 --- a/magic-boot-ui/src/components/magic/template/mb-list.vue +++ b/magic-boot-ui/src/components/magic/template/mb-list.vue @@ -8,7 +8,10 @@ {{ it.label || '添加' }} - + + + {{ it.label }} + diff --git a/magic-boot-ui/src/views/examples/test-mb-form.vue b/magic-boot-ui/src/views/examples/test-mb-form.vue index cd0eaa0..c4d5258 100644 --- a/magic-boot-ui/src/views/examples/test-mb-form.vue +++ b/magic-boot-ui/src/views/examples/test-mb-form.vue @@ -123,11 +123,20 @@ const formOptions = reactive({ component: 'upload-image', label: '头像', rules: [{ required: true, message: '请选择头像', trigger: 'change' }] + },{ + span: 12, + name: 'heads', + component: 'upload-image', + label: '多头像', + props: { + multiple: true + }, + rules: [{ required: true, message: '请选择头像', trigger: 'change' }] }] }] } }) function getFormData(){ - console.log(magicForm.value.getFormData().select) + console.log(magicForm.value.getFormData()) } diff --git a/magic-boot-ui/src/views/examples/upload-file.vue b/magic-boot-ui/src/views/examples/upload-file.vue index 107730e..04ba4e9 100644 --- a/magic-boot-ui/src/views/examples/upload-file.vue +++ b/magic-boot-ui/src/views/examples/upload-file.vue @@ -3,7 +3,7 @@

上传文件(单文件)

上传文件(多文件)

- +

上传图片(id)

上传图片(url、单图)

@@ -22,7 +22,7 @@ export default { externalId: this.$common.uuid(), externalType: '营业执照', imgUrl: '', - multipleImgUrl: ['userfiles/2022-05-13/6be62f3203904410a92530f8e300e233/QQ图片20220505165410.jpg'], + multipleImgUrl: '', fileUrl: '', fileUrls: '' } @@ -31,11 +31,14 @@ export default { fileChange() { console.log(this.fileUrl) }, + multipleFileChange() { + console.log(this.fileUrls) + }, imgChange() { console.log(this.imgUrl) }, multipleImgChange() { - // console.log(this.multipleImgUrl) + console.log(this.multipleImgUrl) } } } diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 765a2f2..284ab64 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -202,13 +202,13 @@ function reloadTable(){ function expand(){ refreshTable.value = false - tableOptions.el["default-expand-all"] = !tableOptions.el["default-expand-all"] + tableOptions.props["default-expand-all"] = !tableOptions.props["default-expand-all"] nextTick(() => refreshTable.value = true) } function searchMenu() { refreshTable.value = false - tableOptions.el["default-expand-all"] = true + tableOptions.props["default-expand-all"] = true nextTick(() => refreshTable.value = true) clearTimeout(searchTimeout) searchTimeout = setTimeout(() => { diff --git a/magic-boot-ui/src/views/system/office/office-list.vue b/magic-boot-ui/src/views/system/office/office-list.vue index f500bd7..e633596 100644 --- a/magic-boot-ui/src/views/system/office/office-list.vue +++ b/magic-boot-ui/src/views/system/office/office-list.vue @@ -234,7 +234,7 @@ watch(officeData, () => { function expand(){ refreshTable.value = false - tableOptions.el["default-expand-all"] = !tableOptions.el["default-expand-all"] + tableOptions.props["default-expand-all"] = !tableOptions.props["default-expand-all"] nextTick(() => refreshTable.value = true) } diff --git a/magic-boot/src/main/java/org/ssssssss/magicboot/model/Global.java b/magic-boot/src/main/java/org/ssssssss/magicboot/model/Global.java index 79673ab..bc3e88b 100644 --- a/magic-boot/src/main/java/org/ssssssss/magicboot/model/Global.java +++ b/magic-boot/src/main/java/org/ssssssss/magicboot/model/Global.java @@ -19,7 +19,7 @@ public class Global { return dir; } - @Value("${upload.dir:D:/psyduck/}") + @Value("${upload.dir:D:/mb/}") public void setDir(String dir) { this.dir = dir; } diff --git a/magic-boot/src/main/resources/application.yml b/magic-boot/src/main/resources/application.yml index c7feec6..8fee42a 100644 --- a/magic-boot/src/main/resources/application.yml +++ b/magic-boot/src/main/resources/application.yml @@ -59,19 +59,11 @@ spring: url-pattern: /* # 忽略过滤格式 exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" - +# 上传路径 upload: - # oss,disk(磁盘) - type: disk dir: D:/mb/ - oss: - endpoint: - access-key-id: - access-key-secret: - bucket-name: - # https,http - transport-protocol: +# 是否开启“验证码”验证 verification-code: enable: true