From 53327565269a69678357843f9300a04fb9e75849 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 19 Oct 2020 13:32:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=BC=BA=E5=B0=91ctx=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/html/add.html.vm | 18 +++---- .../src/main/resources/vm/html/edit.html.vm | 48 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm index d4e67f8c0..584464384 100644 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/add.html.vm @@ -243,26 +243,26 @@ $("input[name='" + this.id + "']").val(contents); }, onImageUpload: function(files) { - var obj = this; + var obj = this; var data = new FormData(); data.append("file", files[0]); $.ajax({ - type: "post", - url: ctx + "common/upload", + type: "post", + url: ctx + "common/upload", data: data, cache: false, contentType: false, processData: false, dataType: 'json', success: function(result) { - if (result.code == web_status.SUCCESS) { - $('#' + obj.id).summernote('insertImage', result.url); - } else { - $.modal.alertError(result.msg); - } + if (result.code == web_status.SUCCESS) { + $('#' + obj.id).summernote('insertImage', result.url); + } else { + $.modal.alertError(result.msg); + } }, error: function(error) { - $.modal.alertWarning("图片上传失败。"); + $.modal.alertWarning("图片上传失败。"); } }); } diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm index 539c72a65..f3de46805 100644 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm @@ -223,7 +223,7 @@ $(".file-upload").each(function (i) { var val = $("input[name='" + this.id + "']").val() $(this).fileinput({ - 'uploadUrl': '/common/upload', + 'uploadUrl': ctx + 'common/upload', initialPreviewAsData: true, initialPreview: [val], maxFileCount: 1, @@ -250,29 +250,29 @@ $("input[name='" + this.id + "']").val(contents); }, onImageUpload: function(files) { - var obj = this; - var data = new FormData(); - data.append("file", files[0]); - $.ajax({ - type: "post", - url: ctx + "common/upload", - data: data, - cache: false, - contentType: false, - processData: false, - dataType: 'json', - success: function(result) { - if (result.code == web_status.SUCCESS) { - $('#' + obj.id).summernote('insertImage', result.url); - } else { - $.modal.alertError(result.msg); - } - }, - error: function(error) { - $.modal.alertWarning("图片上传失败。"); - } - }); - } + var obj = this; + var data = new FormData(); + data.append("file", files[0]); + $.ajax({ + type: "post", + url: ctx + "common/upload", + data: data, + cache: false, + contentType: false, + processData: false, + dataType: 'json', + success: function(result) { + if (result.code == web_status.SUCCESS) { + $('#' + obj.id).summernote('insertImage', result.url); + } else { + $.modal.alertError(result.msg); + } + }, + error: function(error) { + $.modal.alertWarning("图片上传失败。"); + } + }); + } } }); var content = $("input[name='" + this.id + "']").val();