...
|
...
|
@@ -2,23 +2,23 @@ |
|
|
* Created by wangqianjun on 16/3/22.
|
|
|
*/
|
|
|
var $ = require('jquery');
|
|
|
common = require('../common/common');
|
|
|
datepicker = require('../util/datepicker');
|
|
|
common = require('../common/common');
|
|
|
datepicker = require('../util/datepicker');
|
|
|
|
|
|
var ENUM = {
|
|
|
GenderEnum: {
|
|
|
'1':'男',
|
|
|
'2':'女',
|
|
|
'3':'通用',
|
|
|
'1': '男',
|
|
|
'2': '女',
|
|
|
'3': '通用'
|
|
|
},
|
|
|
|
|
|
StatusEnum: {
|
|
|
'-1':'已关闭',
|
|
|
0:'未发布',
|
|
|
1:'开启',
|
|
|
},
|
|
|
'-1': '已关闭',
|
|
|
0: '未发布',
|
|
|
1: '已发布'
|
|
|
}
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//下拉框
|
|
|
new common.dropDown({
|
...
|
...
|
@@ -67,7 +67,7 @@ var Timmer = { |
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
|
|
size: 10,
|
|
|
parms: function() {
|
|
|
parms: function () {
|
|
|
|
|
|
return {
|
|
|
articleTitle: common.util.__input('articleTitle'),
|
...
|
...
|
@@ -77,7 +77,7 @@ var g = new common.grid({ |
|
|
status: $('#status').val(),//common.util.__input('status'),
|
|
|
orderBy: common.util.__input('orderBy'),
|
|
|
startTime: common.util.__input('starttime'),
|
|
|
endTime: common.util.__input('endtime'),
|
|
|
endTime: common.util.__input('endtime')
|
|
|
};
|
|
|
},
|
|
|
columns: [{
|
...
|
...
|
@@ -85,17 +85,17 @@ var g = new common.grid({ |
|
|
name: "id"
|
|
|
}, {
|
|
|
display: "缩略图",
|
|
|
render: function(item) {
|
|
|
render: function (item) {
|
|
|
|
|
|
item.coverImage = common.util.__template(item.coverImage,{mode:2,width:100,height:100});
|
|
|
item.coverImage = common.util.__template(item.coverImage, {mode: 2, width: 100, height: 100});
|
|
|
return '<img src="' + item.coverImage + '" width="100" height="60"/>'
|
|
|
}
|
|
|
}, {
|
|
|
display: '文章标题',
|
|
|
//name: "articleTitle",
|
|
|
width:'15%',
|
|
|
render: function(item) {
|
|
|
return '<span class="text-overflow"">'+item.articleTitle+'</span>'
|
|
|
width: '15%',
|
|
|
render: function (item) {
|
|
|
return '<span class="text-overflow"">' + item.articleTitle + '</span>'
|
|
|
}
|
|
|
}, {
|
|
|
display: '分类',
|
...
|
...
|
@@ -103,7 +103,7 @@ var g = new common.grid({ |
|
|
}, {
|
|
|
display: '性别',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.GenderEnum[item.articleGender] + "</p>";
|
|
|
return "<p>" + ENUM.GenderEnum[item.articleGender] + "</p>";
|
|
|
}
|
|
|
}, {
|
|
|
display: '作者',
|
...
|
...
|
@@ -111,29 +111,39 @@ var g = new common.grid({ |
|
|
}, {
|
|
|
display: '状态',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
|
|
|
return "<p>" + ENUM.StatusEnum[item.status] + "</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>";
|
|
|
if (item.createTime && item.createTime !== 0) {
|
|
|
var t = new Date(item.createTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
}
|
|
|
else {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}, {
|
|
|
display: "发布时间",
|
|
|
|
|
|
render: function (item) {
|
|
|
var t = new Date(item.publishTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
if (item.publishTime && item.publishTime !== 0) {
|
|
|
var t = new Date(item.publishTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
}
|
|
|
else {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
}, {
|
|
|
display: '操作',
|
|
|
//}
|
|
|
name: "status",
|
|
|
render: function(items) {
|
|
|
render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
|
|
|
if (items.status == 1) {
|
...
|
...
|
@@ -150,24 +160,23 @@ var g = new common.grid({ |
|
|
|
|
|
}
|
|
|
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="/guang/article/contentEdit/'+items.id+'" class="btn btn-primary btn-xs info-modify">编辑</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="/guang/article/contentEdit/' + items.id + '" class="btn btn-primary btn-xs info-modify">编辑</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
|
|
|
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
|
|
})
|
|
|
});
|
|
|
g.init('/guang/article/list');
|
|
|
|
|
|
|
|
|
|
|
|
//==================== 按钮点击事件 =====================//
|
|
|
$("#filter-btn").click(function() {
|
|
|
$("#filter-btn").click(function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
|
|
|
//关闭资讯
|
|
|
$(document).on('click', '.info-close', function() {
|
|
|
$(document).on('click', '.info-close', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -176,7 +185,7 @@ $(document).on('click', '.info-close', function() { |
|
|
id: item.id,
|
|
|
status: -1
|
|
|
}
|
|
|
}, function(res) {
|
|
|
}, function (res) {
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip('关闭资讯成功', 'success');
|
...
|
...
|
@@ -188,7 +197,7 @@ $(document).on('click', '.info-close', function() { |
|
|
});
|
|
|
|
|
|
//打开资讯
|
|
|
$(document).on('click', '.info-open', function() {
|
|
|
$(document).on('click', '.info-open', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -197,7 +206,7 @@ $(document).on('click', '.info-open', function() { |
|
|
id: item.id,
|
|
|
status: 1
|
|
|
}
|
|
|
}, function(res) {
|
|
|
}, function (res) {
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip('开启资讯成功', 'success');
|
...
|
...
|
@@ -209,7 +218,7 @@ $(document).on('click', '.info-open', function() { |
|
|
});
|
|
|
|
|
|
//推荐
|
|
|
$(document).on('click', '.info-recommend', function() {
|
|
|
$(document).on('click', '.info-recommend', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -218,7 +227,7 @@ $(document).on('click', '.info-recommend', function() { |
|
|
id: item.id,
|
|
|
isRecommend: 1
|
|
|
}
|
|
|
}, function(res) {
|
|
|
}, function (res) {
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip('成功推荐', 'success');
|
...
|
...
|
@@ -230,7 +239,7 @@ $(document).on('click', '.info-recommend', function() { |
|
|
});
|
|
|
|
|
|
//取消推荐
|
|
|
$(document).on('click', '.info-recommend-cancel', function() {
|
|
|
$(document).on('click', '.info-recommend-cancel', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -239,7 +248,7 @@ $(document).on('click', '.info-recommend-cancel', function() { |
|
|
id: item.id,
|
|
|
isRecommend: 0
|
|
|
}
|
|
|
}, function(res) {
|
|
|
}, function (res) {
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip('成功取消推荐', 'success');
|
...
|
...
|
@@ -253,24 +262,20 @@ $(document).on('click', '.info-recommend-cancel', function() { |
|
|
//定时
|
|
|
$(document).on("click", ".info-time", function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
//$('#title').val("title");
|
|
|
var data = function () {
|
|
|
|
|
|
var dateString = common.util.__input('datepicker');
|
|
|
if (dateString === '' || $.trim(dateString) === '') {
|
|
|
return "请填写时间";
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
publishTime: dateString,
|
|
|
id: item.id
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
Timmer.toast(common.util.__template2($("#template").html(), item), data);
|
|
|
|
|
|
$('#datepicker').fdatepicker({
|
|
|
format: 'yyyy-mm-dd'
|
|
|
format: 'yyyy-mm-dd hh:mm',
|
|
|
pickTime:true
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
@@ -282,7 +287,7 @@ $(document).on("click", ".info-del", function () { |
|
|
common.util.__ajax({
|
|
|
url: '/guang/article/del',
|
|
|
data: {
|
|
|
id:item.id
|
|
|
id: item.id
|
|
|
}
|
|
|
}, function () {
|
|
|
g.reload();
|
...
|
...
|
|