修复文件查看加载错误的bug

This commit is contained in:
zhuangqian 2016-11-20 19:45:09 +08:00
parent f198fc96ae
commit 50b82303eb
5 changed files with 11 additions and 5 deletions

View File

@ -99,18 +99,24 @@ public class KindEditorController extends BladeController {
public AjaxResult initimg(@RequestParam String id) {
Map<String, Object> img = Db.findById("TFW_ATTACH", id);
if (null != img) {
String url = ConstConfig.DOMAIN + img.get("URL");
img.put("URL", url);
return json(img);
} else {
return fail("获取图片失败!");
}
}
@SuppressWarnings("rawtypes")
@SuppressWarnings({ "rawtypes", "unchecked" })
@ResponseBody
@RequestMapping("/initfile")
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(",")));
if (null != file) {
for (Map<String, Object> m : file) {
String url = ConstConfig.DOMAIN + m.get("url");
m.put("url", url);
}
return json(file);
} else {
return fail("获取附件失败!");

View File

@ -164,7 +164,7 @@
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
var ids = _model[x];
$x.val(ids);
initFileUpload(ids, "edit");
eval("_" + x + "_initFileUpload('" + ids + "', 'edit')");
}
else if(_model[x] != null && $x.attr("data-type") == "opentree"){
var ids = _model[x];

View File

@ -86,7 +86,7 @@
}
else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
var ids = _model[x];
initFileUpload(ids, "view");
eval("_" + x + "_initFileUpload('" + ids + "', 'view')");
$x.val(ids);
}
else if($x.is("span")){

View File

@ -64,7 +64,7 @@
for(var x = 0; x < file.length; x++){
var id = file[x].id;
var name = file[x].name;
var url = "${ctxPath}/kindeditor/renderFile/" + id;
var url = file[x].url;
if(type == "edit"){
$("#${x.index!}_file").append(_${x.index!}_getFile(url, id, name));
}

View File

@ -69,7 +69,7 @@
function initImgUpload(id){
$.post("${ctxPath}/kindeditor/initimg", {id : id}, function(data){
if(data.code === 0){
$("#_${x.index!}_IMG").attr("src", "${ctxPath}"+ data.data.URL);
$("#_${x.index!}_IMG").attr("src", data.data.URL);
}
else{
/* layer.alert("加载图片失败", {