修复文件查看加载错误的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) {
|
||||
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("获取附件失败!");
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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")){
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("加载图片失败", {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user