Authored by leo

Update: 更新发布时间时,对发布时间和结束时间做校验

... ... @@ -632,6 +632,14 @@ $(document).on("click", "#saveTime", function() {
return;
}
}
// "首页翻转页面"资源位更新"发布时间"时,不能晚于"end_time"
var count = updateRollingOverPublishTime(resources[currIndex]);
// 如果时间不符合,不得保存发布时间
if(count > 0) {
common.util.__tip('"首页翻转页面"中,"发布时间"不能晚于"结束时间",请先更新"结束时间"!', 'warning');
return false;
}
common.util.__ajax({
url: "/resources/updateResPublishTime",
data: {
... ... @@ -1464,4 +1472,24 @@ function chooseChannelActive(channel) {
$(this).parent().addClass("active");
}
});
}
function updateRollingOverPublishTime(resource) {
var count = 0;
var publishTime = resource.resource.publishTime;
$.each(resource.contentData, function(index, item) {
var contentData = item.contentData;
if((typeof contentData) == 'string') {
contentData = JSON.parse(contentData);
}
var templateName = contentData.template_name;
if(templateName == 'rollingOverSlider') {
var endTimeStr = contentData.data.end_time;
if(dateStrToSeconds(endTimeStr) <= publishTime) {
count++;
}
}
});
return count;
}
\ No newline at end of file
... ...