修复文件查看加载错误的bug
This commit is contained in:
parent
f198fc96ae
commit
50b82303eb
|
|
@ -99,18 +99,24 @@ public class KindEditorController extends BladeController {
|
||||||
public AjaxResult initimg(@RequestParam String id) {
|
public AjaxResult initimg(@RequestParam String id) {
|
||||||
Map<String, Object> img = Db.findById("TFW_ATTACH", id);
|
Map<String, Object> img = Db.findById("TFW_ATTACH", id);
|
||||||
if (null != img) {
|
if (null != img) {
|
||||||
|
String url = ConstConfig.DOMAIN + img.get("URL");
|
||||||
|
img.put("URL", url);
|
||||||
return json(img);
|
return json(img);
|
||||||
} else {
|
} else {
|
||||||
return fail("获取图片失败!");
|
return fail("获取图片失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/initfile")
|
@RequestMapping("/initfile")
|
||||||
public AjaxResult initfile(@RequestParam String ids) {
|
public AjaxResult initfile(@RequestParam String ids) {
|
||||||
List<Map> file = Db.selectList("select ID as \"id\",NAME as \"name\",URL as \"url\" from TFW_ATTACH where ID in (#{join(ids)})", Paras.create().set("ids", ids.split(",")));
|
List<Map> file = Db.selectList("select ID as \"id\",NAME as \"name\",URL as \"url\" from TFW_ATTACH where ID in (#{join(ids)})", Paras.create().set("ids", ids.split(",")));
|
||||||
if (null != file) {
|
if (null != file) {
|
||||||
|
for (Map<String, Object> m : file) {
|
||||||
|
String url = ConstConfig.DOMAIN + m.get("url");
|
||||||
|
m.put("url", url);
|
||||||
|
}
|
||||||
return json(file);
|
return json(file);
|
||||||
} else {
|
} else {
|
||||||
return fail("获取附件失败!");
|
return fail("获取附件失败!");
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
|
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
|
||||||
var ids = _model[x];
|
var ids = _model[x];
|
||||||
$x.val(ids);
|
$x.val(ids);
|
||||||
initFileUpload(ids, "edit");
|
eval("_" + x + "_initFileUpload('" + ids + "', 'edit')");
|
||||||
}
|
}
|
||||||
else if(_model[x] != null && $x.attr("data-type") == "opentree"){
|
else if(_model[x] != null && $x.attr("data-type") == "opentree"){
|
||||||
var ids = _model[x];
|
var ids = _model[x];
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
}
|
}
|
||||||
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
|
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
|
||||||
var ids = _model[x];
|
var ids = _model[x];
|
||||||
initFileUpload(ids, "view");
|
eval("_" + x + "_initFileUpload('" + ids + "', 'view')");
|
||||||
$x.val(ids);
|
$x.val(ids);
|
||||||
}
|
}
|
||||||
else if($x.is("span")){
|
else if($x.is("span")){
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
for(var x = 0; x < file.length; x++){
|
for(var x = 0; x < file.length; x++){
|
||||||
var id = file[x].id;
|
var id = file[x].id;
|
||||||
var name = file[x].name;
|
var name = file[x].name;
|
||||||
var url = "${ctxPath}/kindeditor/renderFile/" + id;
|
var url = file[x].url;
|
||||||
if(type == "edit"){
|
if(type == "edit"){
|
||||||
$("#${x.index!}_file").append(_${x.index!}_getFile(url, id, name));
|
$("#${x.index!}_file").append(_${x.index!}_getFile(url, id, name));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
function initImgUpload(id){
|
function initImgUpload(id){
|
||||||
$.post("${ctxPath}/kindeditor/initimg", {id : id}, function(data){
|
$.post("${ctxPath}/kindeditor/initimg", {id : id}, function(data){
|
||||||
if(data.code === 0){
|
if(data.code === 0){
|
||||||
$("#_${x.index!}_IMG").attr("src", "${ctxPath}"+ data.data.URL);
|
$("#_${x.index!}_IMG").attr("src", data.data.URL);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* layer.alert("加载图片失败", {
|
/* layer.alert("加载图片失败", {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user