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({