You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
2.4 KiB

$(function () {
'use strict';
var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh-TW',
sId = getUrlParam('id') || '1',
iPageIndex = 1,
iPageCount = 10,
/*
* 目的 抓去活動資訊明細
* @param {String} id 當前消息ID
* @return {Object} ajax物件
*/
fnGetNewsInfo = function () {
return g_api.ConnectLite(Service.apiwebcom, ComFn.GetNewsInfo, {
Id: sId
}, function (res) {
if (res.RESULT) {
var saRes = res.DATA.rel,
sHtml = $('#temp_newsdetail').render(saRes);
$('#newsDetail').html(sHtml);
if ($(window).width() > 801) {
$("#newsDetail img").css({ 'width': '600px' });
} else {
$("#newsDetail img").css({ 'width': '100%' });
}
}
});
},
/*
* 目的 抓去活動資訊分頁資訊
* @return {Object} ajax物件
*/
fnGetNewsPage = function () {
return g_api.ConnectLite(Service.apiwebcom, ComFn.GetNewsPage, {
pageIndex: iPageIndex,
pageSize: iPageCount,
NewsType: '02'
}, function (res) {
if (res.RESULT) {
var oRes = res.DATA.rel,
sHtml = $('#temp_news').render(oRes.DataList);
$('.listNews').html(sHtml);
}
});
},
init = function () {
var myHelpers = {
setDate: function (date) {
return new Date(date).formate('yyyy/MM/dd');
},
setNewsContent: function (val) {
val = val || '';
val = val.replaceAll('http:', 'https:');
return val;
}
};
$.views.helpers(myHelpers);
fnGetNewsInfo();
//g_api.ConnectLite(Service.apiappcom, ComFn.GetSysSet, {
// SetItemID: 'NewsShowCount'
//}, function (res) {
// if (res.RESULT) {
// iPageCount = parseInt(res.DATA.rel || 10);
// }
//}).always(function () {
// fnGetNewsPage(iPageIndex);
//});
};
init();
});