Authored by liangyi.chen@yoho.cn

增加文章预览功能

... ... @@ -108,6 +108,9 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
@Value("${api.yoho.url:http://api.yoho.cn}")
private String apiUrl;
@Value("${preview.url}")
private String previewUrl;
private ExecutorService taskExecutor = Executors.newFixedThreadPool(6);
@Override
... ... @@ -1379,6 +1382,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
rspBo.setCopyright(article.getCopyright());
rspBo.setActionUrl(linkMap.get(article.getId()) == null ? "" : linkMap.get(article.getId()));
rspBo.setHasPublished(article.getCreateTime() >= System.currentTimeMillis() ? "N" : "Y");
//拼接文章预览的url 类似:http://yoho-community-web.test3.ingress.dev.yohocorp.com/grass/article/1408536?type=preview
rspBo.setPreviewUrl(previewUrl + article.getId() + "?type=preview");
rspBoList.add(rspBo);
});
return rspBoList;
... ...
... ... @@ -64,7 +64,7 @@ rabbit_user=yoho
rabbit_password=yoho
#zookeeper address
zkAddress=127.0.0.1:2181
zkAddress=192.168.102.211:2181
#dev
web.context=pfcms
... ... @@ -251,3 +251,4 @@ qq.secretId = AKID6dwpKadiQgbDpXDtyNhppIHPO5qPv5GK
qq.secretKey = ACJkH9mg0DBA1PYpf0E7f3g534wBsQaW
uic.service.url = http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
preview.url = http://yoho-community-web.test3.ingress.dev.yohocorp.com/grass/article/
... ...
... ... @@ -236,4 +236,5 @@ qq.serverUri = ${qq.serverUri}
qq.secretId = ${qq.secretId}
qq.secretKey = ${qq.secretKey}
uic.service.url=${uic.service.url}
\ No newline at end of file
uic.service.url=${uic.service.url}
preview.url=${preview.url}
\ No newline at end of file
... ...
... ... @@ -532,8 +532,11 @@
}
str += "<a role='deleteR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' style='margin-left:10px'>删除</a>";
if(rowData.authStatus == 1){
str += "<a role='showDetail' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
str += "<a role='showDetail' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
}
str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
return str;
}
}
... ... @@ -571,6 +574,14 @@
}
});
$(this).datagrid("getPanel").find("a[role='preview']").linkbutton({
iconCls : "icon-save",
onClick: function () {
var previewUrl = $(this).attr("dataId");
articlePreview(previewUrl);
}
});
$(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
... ... @@ -664,6 +675,20 @@
}
});
// 预览
function articlePreview(previewUrl){
var articleEditer = $("<div id='articleEditer' style ='overflow:scroll;'>").appendTo($(document.body));
var title = "预览";
$(articleEditer).myDialog({
title: title,
width: "500px",
height: "800px",
resizable:false,
modal: true,
href: previewUrl
});
}
// 编辑
function articleEditer(data){
var articleEditer = $("<div id='articleEditer'>").appendTo($(document.body));
... ...