Authored by 王钱钧

增加-逛-评论 功能代码

... ... @@ -33,6 +33,7 @@ var urlObj = {
'guangGetAuthorList':'/guang/article/getAuthorList', // 逛-获取作者
'guangGetSortList':'/guang/article/getSortList', // 逛-获取作者
'guangGetTagCategoryByStatus':'/guang/tagSort/getTagItems',
'guangCommentGetFilterItems':'/guang/comment/getItems', // 逛-评论列表-获取筛选条件
};
var minimumResultsForSearch=["sortbybrand","getjitSup","sortsize2"];
... ...
/**
* Created by wangqianjun on 16/3/22.
*/
var $ = require('jquery'),
common = require('../common/common');
/**
* Created by wangqianjun on 16/3/22.
*/
'use strict';
var $ = require('jquery'),
common = require('../common/common');
var STATUS = 0;
var ENUM = {
HotEnum: {
'1': '是',
'0': '否',
},
StatusEnum: {
'-1':'屏蔽',
0:'待审核',
1:'通过',
},
}
new common.dropDown({
el: "#condNum",
ajax: 'guangCommentGetFilterItems',
});
var g = new common.grid({
el: '#basicTable',
parms: function () {
return {
status: STATUS,
condNum: common.util.__input('condNum'),
condContent: common.util.__input('condContent'),
};
},
columns: [
{
display: '',
type: 'checkbox'
},
{display: "ID", name: "id"},
{display: "用户/id", render:function(item){
var value = item.username +'/'+ item.uid;
return "<p>" + value + "</p>";
}},
{
display: "回复时间",
render: function (item) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
{display: "回复内容", name: "content"},
{display: "回复文章", name: "articleTitle"},
{display: "编辑", name: "editorName"},
{
display: '状态',
render: function (item) {
return "<p>" + ENUM.StatusEnum[item.auditStatus] + "</p>";
}
},
{
display: "操作时间",
hidden: true,
render: function (item) {
var t = new Date(item.operationTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
{
display: '操作',
//}
name: "status",
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs comment-pass">通过</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs comment-mask">屏蔽</a>');
return HtmArr.join('');
}
}
]
});
g.init('/guang/comment/getList');
var BllPass = {
toast: function (content, fn) {
common.dialog.confirm("温馨提示", content, function () {
common.util.__ajax({
url: '/guang/comment/audit',
data: fn()
}, function () {
g.reload();
});
});
}
}
//==================== 按钮点击事件 =====================//
//批量通过
$(document).on('click', '#batch-pass-btn', function() {
var selectedArr = g.selected,
len = selectedArr.length,
idList = [];
if (len <= 0) {
common.util.__tip('请选择评论', 'warning');
return;
}
var data = function () {
$.each(selectedArr, function (i, value) {
idList.push(value['id']);
});
return {
id: idList.toString(),
status:1
};
}
BllPass.toast("确定要通过该申请吗?", data);
g.reload();
});
//批量屏蔽
$(document).on('click', '#mask-btn', function() {
var selectedArr = g.selected,
len = selectedArr.length,
idList = [];
if (len <= 0) {
common.util.__tip('请选择评论', 'warning');
return;
}
var data = function () {
$.each(selectedArr, function (i, value) {
idList.push(value['id']);
});
return {
id: idList.toString(),
status:-1
};
}
BllPass.toast("确定要通过该申请吗?", data);
g.reload();
});
//单个通过
$(document).on('click', '.comment-pass', function() {
var item = g.rows[$(this).data("index")];
var data = function () {
return {
id: item.id,
status:1
};
}
BllPass.toast("确定要通过该评论吗?", data);
g.reload();
});
//单个屏蔽
$(document).on('click', '.comment-mask', function() {
var item = g.rows[$(this).data("index")];
var data = function () {
return {
id: item.id,
status:-1
};
}
BllPass.toast("确定要屏蔽该评论吗?", data);
g.reload();
});
//待审核
$(document).on('click', '#check-btn', function() {
//articleCategoryOP("新增", '/guang/author/addAuthor', {});
STATUS = 0;
$('#filter-div').hide();
g.options.columns[9].hidden = false;
g.options.columns[8].hidden = true;
g.init('/guang/comment/getList');
});
//已审核
$(document).on('click', '#pass-btn', function() {
//articleCategoryOP("新增", '/guang/author/addAuthor', {});
STATUS = 1;
g.options.columns[9].hidden = true;
g.options.columns[8].hidden = false;
$('#filter-div').hide();
g.init('/guang/comment/getList');
});
//全部
$(document).on('click', '#all-btn', function() {
$('#filter-div').show();
STATUS = '';
g.options.columns[9].hidden = false;
g.options.columns[8].hidden = true;
g.init('/guang/comment/getList');
});
//筛选
$(document).on('click', '#filter-btn', function() {
g.reload();
});
//
////删除
//$(document).on('click', '.info-del', function() {
// var item = g.rows[$(this).data("index")];
//
// common.dialog.confirm("温馨提示","确定要删除该作者?" , function() {
// common.util.__ajax({
// url: '/guang/author/delAuthor',
// data: {
// uid: item.uid,
// }
// }, function(res) {
// if (res.code == 200) {
// g.reload();
// } else {
// common.util.__tip(res.message);
// }
// });
// });
//});
function commentOP(prefix, url, item) {
var a =new common.edit(".confirm", {
"bucket" : "color"
});
common.dialog.confirm(prefix+'作者', common.util.__template2($("#template").html(), item), function () {
//
return a.submit(url,function(option){
option.success=function(res){
res=res.data;
if(res.code=="200"){
a.$tip("提交成功", function() {
g.reload();
}, 'growl-success');
}else{
a.$tip(res.message);
}
return false;
},
option.error=function(res){
a.$tip(res.message);
}
});
});
a.init();
}
\ No newline at end of file
... ...
... ... @@ -259,6 +259,34 @@ exports.res = [
data: {
iscreate: true
}
}, {
// 评论管理列表数据
route: '/guang/comment/getList',
method: 'POST',
url: '/guang/comment/getList',
params: [
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'},
{name: 'status', type: 'Number'},
{name: 'condContent', type: 'String'},
{name: 'condNum', type: 'Number'},
]
}, {
// 评论管理-审核
route: '/guang/comment/audit',
method: 'POST',
url: '/guang/comment/audit',
params: [
{name: 'id', type: 'String'},
{name: 'status', type: 'Number'},
]
}, {
// 评论管理-获取筛选条件
route: '/guang/comment/getItems',
method: 'POST',
url: '/guang/comment/getItems',
},
//=================================【作者管理】
... ...
... ... @@ -37,6 +37,7 @@
<div class="form-group">
<input type="hidden" name="" value="[[uid]]" id="uid" class="form-control" pattern="" title="">
<label for="username" class="col-sm-2 control-label">作者名称:</label>
<div class="col-sm-10">
<input type="text" value="[[username]]" name="content" id="username" placeholder="作者名称" required="required" class="form-control">
... ...
... ... @@ -21,11 +21,42 @@
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<a id="check-btn" href="javascript:;" class="btn btn-danger">待审核</a>
<a id="pass-btn" href="javascript:;" class="btn btn-success">已审核</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
<div class="row" style="margin-bottom:10px;">
<a id="batch-pass-btn" href="javascript:;" class="btn btn-success">批量通过</a>
<a id="mask-btn" href="javascript:;" class="btn btn-danger">批量屏蔽</a>
</div>
<div class="row" style="margin-bottom:10px;">
<a id="check-btn" href="javascript:;" class="btn btn-danger">待审核</a>
<a id="pass-btn" href="javascript:;" class="btn btn-success">已审核</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
</div>
<div class="row" id="filter-div" style="margin-bottom:10px;" hidden="true">
<div >
<select id="condNum" class="form-control" style="width:100px">
<option value="-1">请选择</option>
</select>
</div>
<div class="panel-col2">
<input type="text" id="condContent" class="form-control" placeholder="输入关键字"
style="height: 39px;"/>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-success">查询</a>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div id="basicTable_wrapper" class="dataTables_wrapper no-footer">
... ... @@ -39,43 +70,3 @@
</div>
<script type="text/template" id="template">
<div class="form-group">
<label for="tagName" class="col-sm-2 control-label">标签名称:</label>
<div class="col-sm-10">
<input type="text" value="[[tagName]]" name="content" id="tagName" placeholder="标签名称" required="required" class="form-control">
</div>
</div>
<div class="form-group" id="maxsord">
<label for="classifyId" class="col-sm-2 control-label">标签分类:</label>
<div class="col-sm-10">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control" pattern="" title="">
<select id="classifyId" value="[[classifyId]]" class="form-control">
<option value="-1">请选择分类</option>
</select>
</div>
</div>
<div class="form-group">
<label for="isHot" class="col-sm-2 control-label">是否热门:</label>
<div class="radio">
<label><input type="radio" value="1" name="isHot" kl_vkbd_parsed="true"></label>
<label><input type="radio" value="0" name="isHot" kl_vkbd_parsed="true"></label>
</div>
<input id="isHot" type="hidden" value="[[isHot]]" for="radio" required="required" kl_vkbd_parsed="true">
</div>
<div class="form-group">
<label for="status1" class="col-sm-2 control-label">是否启用:</label>
<div class="radio">
<label><input type="radio" value="1" name="status1" kl_vkbd_parsed="true"></label>
<label><input type="radio" value="0" name="status1" kl_vkbd_parsed="true"></label>
</div>
<input id="status1" type="hidden" value="[[status]]" for="radio" required="required" kl_vkbd_parsed="true">
</div>
</script>
... ...