; (function ($) {
window.HomeHandler = {};
HomeHandler.ServiceTimeOutId;
HomeHandler.InterfaceTimeOutId;
HomeHandler.ServiceShowDefaultTimeOutId;
////初始化 首页Banner 数据
//HomeHandler.getBannerData = function (catalogId, selectorId, urlString) {
// UserWeb.AjaxHandler.post({
// url: urlString,
// data: { catalogId: catalogId },
// noAlert: true,
// success: function (data) {
// var $parent = $(selectorId);
// if (data.length > 0) {
// $.each(data, function (key, value) {
// var $html = $('
');
// var tempImgUrl = value.ListImage == null || value.ListImage == "" ? "/Content/images/nami-banner.png" : value.ListImage;
// var tempLinkUrl = value.Chain == null ? "/ArticleDetail/Index?combId=" + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id : value.Chain;
// $html.find('img').attr('src', tempImgUrl);
// $html.find('a').attr('href', tempLinkUrl);
// $parent.append($html);
// });
// }
// HomeHandler.InitialBannerCarousel($parent);
// }
// });
//};
////初始化 Banner UX
//HomeHandler.InitialBannerCarousel = function ($parent) {
// //banner
// $parent.owlCarousel({
// navSpeed: 300,
// dotsSpeed: 400,
// items: 1,
// autoplay: true,
// autoplayTimeout: 3000,
// loop: true,
// dots: true
// });
// // Custom Navigation Events
// $(".banner-next").click(function () {
// $parent.trigger('next.owl.carousel');
// });
// $(".banner-prev").click(function () {
// $parent.trigger('prev.owl.carousel');
// });
//};
//初始化 首页组织简介 数据
HomeHandler.getSingleArticleData = function (comboId, selectorId, urlString) {
UserWeb.AjaxHandler.post({
url: urlString,
data: { comboId: comboId },
noAlert: true,
success: function (data) {
var tempDescription = data.Description != null ? data.Description : "暂无";
var tempLinkUrl = data.GetLinkUrl;
if (data.Description != null && data.Description.length > 130) {
tempDescription = data.Description.substring(0, 120) + '...';
}
$(selectorId).find('p').html(tempDescription);
$(selectorId).find('a').attr('href', tempLinkUrl);
}
});
};
// 初始化 近期会议 数据
HomeHandler.getNewsInfoData = function (catalogId, selectorId, urlString) {
UserWeb.AjaxHandler.post({
url: urlString,
data: { catalogId: catalogId, number: 8 },
noAlert: true,
success: function (data) {
var $html = $('');
var $htmlnewsfirst = $('');
var $htmlul = $('');
$.each(data, function (index, value) {
var tempTitle = value.Title;
var jumburl = value.Chain != null && value.Chain != "" ? value.Chain : virtualPath + '/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id;
var tempNewTag = '';
var tempCreatedTime = value.AddDateString;
if (value.Title.length > 50) {
tempTitle = value.Title.substring(0, 49) + '...';
}
if (value.IsNewArticle) {
tempNewTag = '';
}
if (index == 0) {
var tempImgUrl = value.ListImage == null ? virtualPath + "/Content/images/pic-info-01.png" : virtualPath + value.ListImage;
var tempCreatedTimeString = '发布时间:' + value.AddDateString;
var tempDescription = value.Description;
if (value.Description.length > 70) {
tempDescription = value.Description.substring(0, 69) + '...';
}
$htmlnewsfirst.find('.index-main-panel-img img').attr('src', tempImgUrl);
$htmlnewsfirst.find('.index-main-panel-info a')
.attr('href', jumburl)
.html(tempTitle);
$htmlnewsfirst.find('.index-main-panel-info h4')
.append(tempNewTag);
$htmlnewsfirst.find('.index-main-panel-info span')
.text(tempCreatedTimeString);
$htmlnewsfirst.find('.index-main-panel-info p')
.html(tempDescription);
} else {
var $htmlulli = $('');
$htmlulli.find('a')
.attr('href', jumburl)
.html(tempTitle);
$htmlulli.find('a')
.after(tempNewTag);
$htmlulli.find('span')
.text(tempCreatedTime);
$htmlul.append($htmlulli);
}
});
$html.append($htmlnewsfirst);
$html.append($htmlul);
$(selectorId).append($html);
$(selectorId).children('div').first().fadeIn(200);
}
});
};
// 初始化 历史会议 数据
HomeHandler.getImportantInfoData = function (catalogId, selectorId, urlString) {
UserWeb.AjaxHandler.post({
url: urlString,
data: { catalogId: catalogId, number: 7 },
noAlert: true,
success: function (data) {
var $html = $('');
var $htmlul = $('');
$.each(data, function (index, value) {
var tempTitle = value.Title;
var jumburl = value.Chain != null && value.Chain != "" ? value.Chain : virtualPath + '/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id;
var tempNewTag = '';
var tempCreatedTime = value.AddDateString;
if (value.Title.length > 50) {
tempTitle = value.Title.substring(0, 49) + '...';
}
if (value.IsNewArticle) {
tempNewTag = '';
}
var $htmlulli = $('');
$htmlulli.find('a')
.attr('href', jumburl)
.html(tempTitle);
$htmlulli.find('a')
.after(tempNewTag);
$htmlulli.find('span')
.text(tempCreatedTime);
$htmlul.append($htmlulli);
});
$html.append($htmlul);
$(selectorId).append($html);
$(selectorId).children('div').first().fadeIn(200);
}
});
};
//初始化 根据栏目id获取数据
HomeHandler.getHomeArtileListDataById = function (catalogId, selectorId, urlString, getCount) {
UserWeb.AjaxHandler.post({
url: urlString,
data: { catalogId: catalogId, number: getCount },
noAlert: true,
success: function (data) {
var $html = $('');
$.each(data, function (index, value) {
var $htmlA = $('');
$htmlA.html(value.Title);
$htmlA.attr('href', value.Chain);
$html.append($htmlA);
});
$(selectorId).append($html);
$(selectorId).children('div').first().fadeIn(200);
}
});
};
//初始化 首页单个文章链接 数据
HomeHandler.getHomeFirstArticleData = function (catalogId, selectorIds, urlString) {
UserWeb.AjaxHandler.post({
url: urlString,
data: { catalogId: catalogId },
noAlert: true,
success: function (data) {
var selectors = selectorIds.split(',');
var linkString = data.PageUrl == null || data.PageUrl == '' ? 'javascript:;' : data.PageUrl;
$.each(selectors, function (key, value) {
$(value).attr('href', linkString);
});
}
});
};
//首页页面大小调整
HomeHandler.fnWindowResize = function () {
$(window).resize(function () {
$('.service-show').css('height', $('.service-show img').height());
});
};
})(jQuery);