mirror of https://gitee.com/y_project/RuoYi.git
修复代码生成模板文件上传组件缺少ctx的问题
parent
260370c328
commit
5332756526
|
@ -243,26 +243,26 @@
|
||||||
$("input[name='" + this.id + "']").val(contents);
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
},
|
},
|
||||||
onImageUpload: function(files) {
|
onImageUpload: function(files) {
|
||||||
var obj = this;
|
var obj = this;
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("file", files[0]);
|
data.append("file", files[0]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: ctx + "common/upload",
|
url: ctx + "common/upload",
|
||||||
data: data,
|
data: data,
|
||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
if (result.code == web_status.SUCCESS) {
|
||||||
$('#' + obj.id).summernote('insertImage', result.url);
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
} else {
|
} else {
|
||||||
$.modal.alertError(result.msg);
|
$.modal.alertError(result.msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
$.modal.alertWarning("图片上传失败。");
|
$.modal.alertWarning("图片上传失败。");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@
|
||||||
$(".file-upload").each(function (i) {
|
$(".file-upload").each(function (i) {
|
||||||
var val = $("input[name='" + this.id + "']").val()
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
$(this).fileinput({
|
$(this).fileinput({
|
||||||
'uploadUrl': '/common/upload',
|
'uploadUrl': ctx + 'common/upload',
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
initialPreview: [val],
|
initialPreview: [val],
|
||||||
maxFileCount: 1,
|
maxFileCount: 1,
|
||||||
|
@ -250,29 +250,29 @@
|
||||||
$("input[name='" + this.id + "']").val(contents);
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
},
|
},
|
||||||
onImageUpload: function(files) {
|
onImageUpload: function(files) {
|
||||||
var obj = this;
|
var obj = this;
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("file", files[0]);
|
data.append("file", files[0]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: ctx + "common/upload",
|
url: ctx + "common/upload",
|
||||||
data: data,
|
data: data,
|
||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
if (result.code == web_status.SUCCESS) {
|
||||||
$('#' + obj.id).summernote('insertImage', result.url);
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
} else {
|
} else {
|
||||||
$.modal.alertError(result.msg);
|
$.modal.alertError(result.msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
$.modal.alertWarning("图片上传失败。");
|
$.modal.alertWarning("图片上传失败。");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var content = $("input[name='" + this.id + "']").val();
|
var content = $("input[name='" + this.id + "']").val();
|
||||||
|
|
Loading…
Reference in New Issue