From 545a86ed546748ef55eabc1453a53e82ad7ab666 Mon Sep 17 00:00:00 2001 From: liaozetao <1107136310@qq.com> Date: Mon, 20 Nov 2023 14:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=B8=8D=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=8F=91=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/resource/ResourceView.vue | 34 +++++++++++++++++------------ src/views/resource/SplashView.vue | 17 +++++++++------ 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/views/resource/ResourceView.vue b/src/views/resource/ResourceView.vue index dd1c818..046eb34 100644 --- a/src/views/resource/ResourceView.vue +++ b/src/views/resource/ResourceView.vue @@ -210,25 +210,31 @@ export default { methods: { uploadIcon() { let $this = this; - $('#iconUploadBtn').click(function () { - uploadFile('iconFile').then(res => { - if (res.path) { - $this.resource.icon = res.path; - $('#iconUploadInfo').val('上传成功'); - } + let file = $('#iconFile').val(); + if (file) { + $('#iconUploadBtn').click(function () { + uploadFile('iconFile').then(res => { + if (res.path) { + $this.resource.icon = res.path; + $('#iconUploadInfo').html('上传成功'); + } + }); }); - }); + } }, uploadUrl() { let $this = this; - $('#urlUploadBtn').click(function () { - uploadFile('urlFile').then(res => { - if (res.path) { - $this.resource.url = res.path; - $('#urlUploadInfo').val('上传成功'); - } + let file = $('#urlFile').val(); + if (file) { + $('#urlUploadBtn').click(function () { + uploadFile('urlFile').then(res => { + if (res.path) { + $this.resource.url = res.path; + $('#urlUploadInfo').html('上传成功'); + } + }); }); - }); + } }, getRule() { getResourceRuleList({ diff --git a/src/views/resource/SplashView.vue b/src/views/resource/SplashView.vue index 1b4b847..ace6035 100644 --- a/src/views/resource/SplashView.vue +++ b/src/views/resource/SplashView.vue @@ -175,14 +175,17 @@ export default { methods: { uploadUrl() { let $this = this; - $('#urlUploadBtn').click(function () { - uploadFile('urlFile').then(res => { - if (res.path) { - $this.resource.url = res.path; - $('#urlUploadInfo').val('上传成功'); - } + let file = $('#urlFile').val(); + if (file) { + $('#urlUploadBtn').click(function () { + uploadFile('urlFile').then(res => { + if (res.path) { + $this.resource.url = res.path; + $('#urlUploadInfo').html('上传成功'); + } + }); }); - }); + } }, getRule() { getResourceRuleList({