Authored by liangyi.chen@yoho.cn

Fix

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include_grass.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<script src="/pfcms/js/jquery.imageUpload.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.config.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.all.min.js"></script>
<link rel="stylesheet" href="/pfcms/css/swiper.min.css">
<script src="/pfcms/js/utils/swiper.min.js"></script>
<!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/pfcms/ueditor/lang/zh-cn/zh-cn.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.yoho.js"></script>
<script charset="utf-8" src="/pfcms/js/grass_article.js"></script>
<style>
/* 可以设置样式,也可以不设置*/
.swiper-container {
width: 700px;
height: 400px;
}
.btn-long {
width: 120px;
height: 37px;
line-height: 37px;
font-size: 15px;
color: white;
border-radius: 5px;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-long:hover {
opacity: 0.9;
}
</style>
</head>
<!--<body class="easyui-layout" fit="true" style="overflow-y: scroll" >-->
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<!--<div region="north" style="height: 30%;">-->
<script>
document.write(addHead('种草社区管理', '种草内容管理'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
<input class="easyui-combobox" id="isRecommend">
</input>
<input class="easyui-combobox" id="isTop">
</input>
<input class="easyui-textbox" id="publisher">
</input>
<input class="easyui-textbox" id="publisherUid">
</input>
<input class="easyui-textbox" id="articleId">
</input>
<input class="easyui-combobox" id="source">
</input>
<input class="easyui-combobox" id="userType">
</input>
<input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(开始)'"/>
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(结束)'"/>
</input>
<input class="easyui-combobox" id="recommendSort">
</input>
<input class="easyui-combobox" id="authStatus">
</input>
<input class="easyui-combobox" id="sortParam">
</input>
<input class="easyui-combobox" id="markFlag">
</input>
<a id="searchBtn" class="btn-info">筛选</a>
<!--<a id="addActivityBtn" class="btn-success">新增</a>-->
<a id="allBtn" class="btn-info">全部 </a>
</div></div>
<div region="center" id="activityList" style="margin-left: 20px" >
<table id="activityListTable" ></table>
</div>
</body>
<script>
$(function() {
//用于页面刷新后的数据行定位
var index ="";
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
//清空筛选数据
$("#publisher").textbox("setValue","");
$("#articleId").textbox("setValue","");
$("#source").combobox("setValue","");
$("#userType").combobox("setValue","");
$("#isRecommend").combobox("setValue","");
$("#isTop").combobox("setValue","");
$("#startTimeStr").datetimebox('setValue',"");
$("#endTimeStr").datetimebox('setValue',"");
$("#authStatus").combobox("setValue","-1");
$("#activityListTable").datagrid("load", {
authStatus: "1"
});
}
});
$("#publisher").textbox({
required:false,
prompt: "用户昵称"
});
$("#publisherUid").textbox({
required:false,
prompt: "uid"
});
$("#articleId").textbox({
required:false,
prompt: "文章id"
});
$("#isRecommend").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择推荐状态",
data:[{text:"全部",value:"8"},{text:"未推荐",value:"0"},{text:"已推荐",value:"1"}]
});
$("#isTop").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择置顶状态",
data:[{text:"全部",value:"8"},{text:"未置顶",value:"0"},{text:"已置顶",value:"1"}]
});
$("#source").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择来源",
data:[{text:"全部",value:"0"},{text:"社区",value:"1"},{text:"资讯",value:"2"},{text:"晒单",value:"4"},{text:"now",value:"5"},{text:"mars",value:"3"},{text:"爬虫数据",value:"7"}]
});
$("#userType").combobox({
valueField: "id",
textField: "groupName",
required: false,
prompt: "请选择用户身份",
selectOnNavigation : true,
url : serverContextPath + "/grassUserManage/getAllVirtualGroup",
loadFilter: function (data) {
var data = defaultLoadFilter(data);
data.unshift({'id': '0', 'groupName': '全部'});
return data;
}
});
//推荐顺序
$("#recommendSort").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择推荐顺序",
data:[{text:"选择推荐顺序",value:"0"},{text:"推荐降序",value:"desc"},{text:"推荐升序",value:"asc"}]
});
//是否屏蔽
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#sortParam").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "文章内容类型",
data:[{text:"全部",value:"0"},{text:"普通笔记",value:"1"},{text:"长文章",value:"2"},{text:"H5跳转链接",value:"3"},{text:"短视频",value:"4"}]
});
$("#markFlag").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "是否已打标",
data:[{text:"全部",value:"-1"},{text:"是",value:"1"},{text:"否",value:"0"}]
});
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if (action == 'uploadimage' || action == 'uploadfile') {
return serverContextPath + "/fileupload/uploadFile4Editor.do?bucket=grassImg";
} else {
return this._bkGetActionUrl.call(this, action);
}
};
// 检索按钮
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
var startTime="";
var endTime="";
if ($("#startTimeStr").datetimebox('getValue')!='') {
startTime = parseInt(new Date($("#startTimeStr").datetimebox('getValue')).getTime() );
}
if ($("#endTimeStr").datetimebox('getValue')!='') {
endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() );
}
$("#activityListTable").datagrid("load", {
authStatus: $("#authStatus").combobox("getValue"),
publisher: $("#publisher").textbox("getValue"),
authorUid: $("#publisherUid").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").combobox("getValue"),
userType: $("#userType").combobox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
isRecommend: $("#isRecommend").combobox("getValue"),
isTop: $("#isTop").combobox("getValue"),
startTimeStr:startTime,
endTimeStr:endTime,
sort:$("#sortParam").combobox("getValue"),
markFlag:$("#markFlag").combobox("getValue")
});
}
});
$("#activityListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
queryParams: {
publisher: $("#publisher").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").textbox("getValue"),
userType: $("#userType").textbox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
authStatus: $("#authStatus").combobox("getValue")
},
url: serverContextPath + "/grassArticle/articleList",
method: 'POST',
loadFilter: function (data) {
var tmp = defaultLoadFilter(data);
tmp.rows = tmp.list;
return tmp;
},
columns: [[
{
title: "内容id",
field: "articleId",
width: 25,
align: "center"
},
{
title: "内容",
field: "articleContent",
width: 60,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '<div style=" margin-left: 15px">';
if(rowData.sort == 1 || rowData.sort == 4){
if(rowData.articleContent!='' && rowData.articleContent!=null){
if(rowData.articleContent.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent +'</p>'
}
}
}else{
if(rowData.articleTitle!='' && rowData.articleTitle!=null){
if(rowData.articleTitle.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle +'</p>'
}
}
}
var imgList = rowData.imgList;
str =str + '<p>';
if(imgList !=null){//可能没有图片
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[0] + '?imageView/2/w/60/h/60" >' ;
}
if(rowData.sort == 4 && rowData.coverImg != ''){
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ rowData.coverImg + '?imageView/2/w/60/h/60" >' ;
}
str = str + "<a role='showDetail' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>查看详情</a>";
str =str + '</p>';
//标签替换成话题
var topicName = rowData.topicName;
if( null != topicName && topicName != '' ){
str =str + "<p> #"+topicName+"# </p>";
}
str = str + '</div>';
return str;
}
},
{
title: "用户名",
field: "nickName",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var uid ="uid:"+ rowData.authorUid;
var nickName ="昵称:"+ rowData.nickName;
return uid+"<br>"+nickName;
}
},{
title: "用户身份",
field: "userTypeStr",
width: 20,
align: "left"
},{
title: "发布时间",
field: "publishTime",
width: 30,
align: "left"
},{
title: "审核时间",
field: "authTimeStr",
width: 30,
align: "left"
},{
title: "内容来源",
field: "source",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.source == '1'){
str = "社区";
}
if(rowData.source == '2'){
str = "资讯";
}
if(rowData.source == '3'){
str = "mars";
}
if(rowData.source == '4'){
str = "晒单";
}
if(rowData.source == '5'){
str = "now";
}
if(rowData.source == '7'){
str = "爬虫数据";
}
return str;
}
},{
title: "内容类型",
field: "sort",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.sort == '1'){
str = "笔记";
}
if(rowData.sort == '2'){
str = "长文章";
}
if(rowData.sort == '3'){
str = "H5跳转链接";
}
if(rowData.sort == '4'){
str = "短视频";
}
return str;
}
},{
title: "数据统计",
field: "praiseCount",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
return "回复:" + rowData.commentCount + "<br>" + "收藏:"+ rowData.favorCount + "<br>" + "点赞:" + rowData.praiseCount;
}
},
// {
// title: "被回复",
// field: "commentCount",
// width: 25,
// align: "left"
// },
// {
// title: "被收藏",
// field: "favorCount",
// width: 20,
// align: "left"
// },
// {
// title: "被赞",
// field: "praiseCount",
// width: 20,
// align: "left"
// },
/*{
title: "推荐时间",
field: "recomTimeStr",
width: 30,
align: "left"
},*/
{
title: "推荐状态",
field: "isRecommend",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.isRecommend == '1'){
str = "已推荐";
}else{
str = "未推荐";
}
return str;
}
},
{
title: "置顶状态",
field: "isTop",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.isTop == '1'){
str = "已置顶";
}else{
str = "未置顶";
}
return str;
}
},
{
title: "屏蔽状态",
field: "authStatus",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
if(rowData.authStatus == '4'){
return "已屏蔽";
}else{
return "未屏蔽";
}
}
},
{
title: "操作",
field: "ddg",
width: 50,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str='';
str += "<a role='edit'";
var classStr = "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId +"' sort='"+ rowData.sort + "' index='"+ rowIndex + "' style='margin-left:10px'>";
var optStr = "编辑</a>" ;
str += optStr;
if(rowData.authStatus == 1){
str += "<a role='switchR'";
var classStr = rowData.isRecommend == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isRecommend + "' style='margin-left:10px'>";
var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>";
str += optStr;
if(rowData.isRecommend == 1){
str += "<a role='switchT'";
var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>";
var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>";
str += optStr;
}
}
if(rowData.authStatus == 0){
str += "待审核"
}
if(rowData.authStatus == 2){
str += "审核未通过"
}
if(rowData.authStatus == 4){
str += "<a role='shieldR' class='btn-success' dataId='"+rowData.articleId+ "' dataAuthStatus='1' index='"+ rowIndex + "' style='margin-left:10px'>取消屏蔽</a>";
}else{
str += "<a role='shieldR' class='btn-success' dataId='"+rowData.articleId+ "' dataAuthStatus='4' index='"+ rowIndex + "' style='margin-left:10px'>屏蔽</a>";
}
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' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
}
str += "<a role='markR'";
var classStr = rowData.markFlag == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' markFlag='" + rowData.markFlag + "' style='margin-left:10px'>";
var optStr = rowData.markFlag == 1 ? "取消打标</a>" : "打标</a>";
str += optStr;
//str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
return str;
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
if(index != ""){
$(this).datagrid("scrollTo",index);
index = "";
}else{
$(this).datagrid("scrollTo",0);
}
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
var sort = $(this).attr("sort");
index = $(this).attr("index");
editor(sort, data.rows[index]);
}
});
$(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 () {
var status = $(this).attr("status");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(status == 1){
message = "取消推荐";
}
if(status == 0){
message = "推荐";
}
$.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
if(flag){
switchRecommend(dataId, status);
}
});
}
});
$(this).datagrid("getPanel").find("a[role='markR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var markFlag = $(this).attr("markFlag");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(markFlag == 1){
message = "确认将该文章取消打标到达人搭配吗?";
}
if(markFlag == 0){
message = "确认将该文章打标到达人搭配吗?";
}
$.messager.confirm("确认", message, function (flag) {
if(flag){
switchMark(dataId, markFlag);
}
});
}
});
$(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var status = $(this).attr("status");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(status == 1){
message = "取消置顶";
}
if(status == 0){
message = "置顶";
}
$.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
if(flag){
switchTop(dataId, status);
}
});
}
});
// 编辑
$(this).datagrid("getPanel").find("a[role='showDetail']").linkbutton({
iconCls : "icon-edit",
onClick : function() {
index = $(this).attr("index");
var articleId = $(this).attr("dataId");
var row = $("#activityListTable").datagrid('getData').rows[index];
getDetailDialog(row);
}
});
$(this).datagrid("getPanel").find("a[role='deleteR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
$.messager.confirm("确认", "确认删除这篇文章吗?", function (flag) {
if(flag){
$.post(serverContextPath + "/grassArticle/deleteArticle?articleId=" + dataId, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
}
});
$(this).datagrid("getPanel").find("a[role='shieldR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
var authStatus = $(this).attr("dataAuthStatus");//取消屏蔽则恢复为审核通过状态
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + dataId+"&authStatus="+authStatus+"&operateType=2", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
}
});
// 预览
function articlePreview(previewUrl){
var articleEditer = $("<div id='articleEditer' style ='overflow:scroll;'>").appendTo($(document.body));
var content = '<iframe src="' + previewUrl + '" width="500px" height="800px" frameborder="0"></iframe>';
$(articleEditer).myDialog({
content: content,
noheader: true,
border: true,
resizable: false,//定义对话框是否可调整尺寸。
maximized: false,//默认最大化,可调整为false,改成弹出框模式。
modal: false,
buttons:[
{
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(articleEditer).dialog("close");
}
}
]
});
}
// 编辑
function editor(sort, data) {
var editorFilePath = "";
if (sort == 1) {
editorFilePath = "/html/grass/article/editArticle.html"
}
else if (sort == 4) {
editorFilePath = "/html/grass/article/editorVideoDetail.html";
}
else {
editorFilePath = "/html/grass/longArticle/edit.html"
}
var articleEditer = $("<div id='articleEditer'>").appendTo($(document.body));
var title = "编辑";
data.editFlag = 1;
window.self.paramObject.mkData = data;
$(articleEditer).myDialog({
title: title,
width: "80%",
height: "100%",
resizable:false,
modal: true,
href: contextPath + editorFilePath
});
}
function switchRecommend(id, status) {
var switchStatus = status == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isRecommend=" + switchStatus+ "&operateType=0", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
function switchMark(id, markFlag) {
var switchMark = markFlag == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateMarkFlag.do?articleId=" + id + "&markFlag=" + switchMark, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
function switchTop(id, status) {
var switchStatus = status == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
// 审核 文章详情页
function getDetailDialog(rowData){
var articleId = rowData.articleId;
var detailUrl = "";
if(rowData.sort == 1 || rowData.sort == 4){
detailUrl = "/html/grass/articleAuthorizeManage/articleDetail.html?articleId";
}else{
detailUrl = "/html/grass/articleAuthorizeManage/longArticleDetail.html?articleId";
}
var activityList = $("<div id='activityList'>").appendTo($(document.body));
var title = "内容详情";
// var textVar = articleId == null ? "保存":"保存";
window.self.paramObject.mkData = articleId;
$(activityList).myDialog({
title: title,
width: "98%",
height: "98%",
resizable:false,
buttons:[
{
id:"authBtn",
text: "审核通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=1&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},
{
id:"unAuthBtn",
text: "审核不通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核--不通过
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=2&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},{
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(activityList).dialog("close");
}
}
],
modal: true,
href: contextPath + detailUrl + articleId
});
}
</script>
</html>
\ No newline at end of file