Authored by 姜敏

资讯管理定时发布时间样式,资源管理删除bug修复

... ... @@ -52,12 +52,12 @@ $('.hasDatepicker').fdatepicker({
var Timmer = {
toast: function (content, fn) {
common.dialog.confirm("定时发布", content, function () {
console.log("fn()",fn());
//console.log("fn()",fn());
common.util.__ajax({
url: '/guang/article/timmer',
data: fn()
}, function (res) {
if(res.code=='200'){
if (res.code == '200') {
g.reload();
loadTab();
}
... ... @@ -154,14 +154,11 @@ var g = new common.grid({
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-success btn-xs info-open">发布</a>');
}
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-time">定时</a>');
if (items.isRecommend == 1) {
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-recommend-cancel">取消推荐</a>');
} else {
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs info-recommend">推荐</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>');
... ... @@ -264,6 +261,14 @@ $(document).on('click', '.info-recommend-cancel', function () {
//定时
$(document).on("click", ".info-time", function () {
var item = g.rows[$(this).data("index")];
var item1= $.extend(true,{},item);
if(item.publishTime&&item.publishTime!=0){
var t = new Date(item.publishTime * 1000);
item1.publishTime= common.util.__dateFormat(t, "yyyy-MM-dd hh:mm");
}
else{
item1.publishTime="yyyy-MM-dd hh:mm"
}
var data = function () {
var dateString = common.util.__input('datepicker');
if (dateString === '' || $.trim(dateString) === '') {
... ... @@ -274,10 +279,10 @@ $(document).on("click", ".info-time", function () {
id: item.id
};
};
Timmer.toast(common.util.__template2($("#template").html(), item), data);
Timmer.toast(common.util.__template2($("#template").html(), item1), data);
$('#datepicker').fdatepicker({
format: 'yyyy-mm-dd hh:ii',
pickTime:true
pickTime: true
});
});
... ...
... ... @@ -14,20 +14,20 @@ var resSorts = {},
common.util.__ajax({
url: "/resources/getResSorts",//获取所有资源
data: {}
},function(res) {
}, function (res) {
$("#category-content").html(common.util.__template2($("#search-category").html(), res));
new common.dropDown({el: "#choose-category"});
resSorts = res.data;
},true);
}, true);
common.util.__ajax({
url: "/resources/getResPlatforms",//获取所有平台
data: {}
},function(res) {
}, function (res) {
$("#platform-content").html(common.util.__template2($("#search-platform").html(), res));
new common.dropDown({el: "#choose-platform"});
resPlatforms = res.data;
},true);
}, true);
var g = new common.grid({
el: "#content-list",
... ... @@ -40,23 +40,27 @@ var g = new common.grid({
platformId: common.util.__input('choose-platform')
};
},
columns:[
columns: [
{display: "ID", name: "id"},
{display: "资源", name: "name"},
{display: "分类", name: "sortName"},
{display: "平台", name: "platformName"},
{display: "位置码", name: "code"},
{display: "匹配码", name: "matchCode"},
{display: "创建时间", name: "", render: function(item) {
{
display: "创建时间", name: "", render: function (item) {
return Bll.getLocalTime(item.createTime);
}},
{display: "操作", name: "",render: function(item) {
}
},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-primary contentManage" data-index="' + item.__index + '" href="/resource/content/index/' + item.id + '">内容管理</a>');
arr.push('<a class="btn btn-primary add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-primary delbtn" data-index="' + item.__index + '">删除</a>');
return arr.join("");
}}
}
}
]
});
... ... @@ -64,7 +68,7 @@ g.init("/resources/queryResource");
var Bll = {
getLocalTime:function(nS) {
getLocalTime: function (nS) {
var date = new Date(parseInt(nS) * 1000);
var mm = date.getMonth() + 1;
var dd = date.getDate();
... ... @@ -78,60 +82,69 @@ var Bll = {
var e = new common.edit("#base-form");
item.resSorts = resSorts;
item.resPlatforms = resPlatforms;
var dialog=common.dialog.confirm(hint,
var dialog = common.dialog.confirm(hint,
common.util.__template2($("#edit-template").html(), item),
function() {
e.submit(url,function(option){
//option.data;
//console.log(option.data);
option.success=function(res){
function () {
e.submit(url, function (option) {
option.success = function (res) {
dialog.close();
util.__tip(res.data.message, 'success');
g.reload();
};
option.error=function(res){
option.error = function (res) {
dialog.close();
util.__tip(res.data.message);
}
});
return false;
});
//
e.init();
new common.dropDown({el: "#sortId"});
new common.dropDown({el: "#platformId"});
if(hint.indexOf("编辑") != -1) {
if (hint.indexOf("编辑") != -1) {
$("#code-content").show();
}
}
}
$(document).on("click", "#add-resource", function () {
var item = {};
var item = {};
item.resSorts = resSorts;
item.resPlatforms = resPlatforms;
console.log(item);
Bll.toast("/resources/saveResource", item, "新增资源");
});
$(document).on("click", "#filter-btn",function() {
$(document).on("click", "#filter-btn", function () {
g.reload(1);
});
$(document).on("click", ".add2", function() {
$(document).on("click", ".add2", function () {
var item = g.rows[$(this).data("index")];
item.resSorts = resSorts;
item.resPlatforms = resPlatforms;
Bll.toast("/resources/saveResource", item, "编辑资源");
});
$(document).on("click", ".delbtn", function() {
/**
* 预发布版本
*/
/*$(document).on("click", ".delbtn", function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告", "是否确认删除?",function() {
common.util.__ajax({
url: "/resources/deleteAllResourceByCode",
data: {code: item.code}
}, function () {
g.reload();
});
});
});*/
$(document).on("click", ".delbtn", function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告", "是否确认删除?",function() {
common.dialog.confirm("警告", "是否确认删除?", function () {
common.util.__ajax({
url: "/resources/deleteAllResourceByCode",
data: {code: item.code}
url: "/resources/deleteResourceById",
data: {id: item.id}
}, function () {
g.reload();
});
... ...
... ... @@ -99,7 +99,6 @@
</div>
</div>
<script type="text/template" id="template">
<div class="form-group">
<label class="col-sm-3 control-label">标题</label>
... ... @@ -113,7 +112,8 @@
<div class="col-sm-9">
<input type="text" readonly="true" class="form-control hasDatepicker" name="publish_time"
style="width:180px;" placeholder="yyyy-mm-dd hh:ii" id="datepicker" required="required">
value="[[publishTime]]"
style="width:180px;" id="datepicker" required="required">
</div>
</div>
</script>
... ...