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.

72 lines
2.4 KiB

2 years ago
  1. $(function () {
  2. 'use strict';
  3. var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh-TW',
  4. sId = getUrlParam('id') || '1',
  5. iPageIndex = 1,
  6. iPageCount = 10,
  7. /*
  8. * 目的 抓去活動資訊明細
  9. * @param {String} id 當前消息ID
  10. * @return {Object} ajax物件
  11. */
  12. fnGetNewsInfo = function () {
  13. return g_api.ConnectLite(Service.apiwebcom, ComFn.GetNewsInfo, {
  14. Id: sId
  15. }, function (res) {
  16. if (res.RESULT) {
  17. var saRes = res.DATA.rel,
  18. sHtml = $('#temp_newsdetail').render(saRes);
  19. $('#newsDetail').html(sHtml);
  20. if ($(window).width() > 801) {
  21. $("#newsDetail img").css({ 'width': '600px' });
  22. } else {
  23. $("#newsDetail img").css({ 'width': '100%' });
  24. }
  25. }
  26. });
  27. },
  28. /*
  29. * 目的 抓去活動資訊分頁資訊
  30. * @return {Object} ajax物件
  31. */
  32. fnGetNewsPage = function () {
  33. return g_api.ConnectLite(Service.apiwebcom, ComFn.GetNewsPage, {
  34. pageIndex: iPageIndex,
  35. pageSize: iPageCount,
  36. NewsType: '02'
  37. }, function (res) {
  38. if (res.RESULT) {
  39. var oRes = res.DATA.rel,
  40. sHtml = $('#temp_news').render(oRes.DataList);
  41. $('.listNews').html(sHtml);
  42. }
  43. });
  44. },
  45. init = function () {
  46. var myHelpers = {
  47. setDate: function (date) {
  48. return new Date(date).formate('yyyy/MM/dd');
  49. },
  50. setNewsContent: function (val) {
  51. val = val || '';
  52. val = val.replaceAll('http:', 'https:');
  53. return val;
  54. }
  55. };
  56. $.views.helpers(myHelpers);
  57. fnGetNewsInfo();
  58. //g_api.ConnectLite(Service.apiappcom, ComFn.GetSysSet, {
  59. // SetItemID: 'NewsShowCount'
  60. //}, function (res) {
  61. // if (res.RESULT) {
  62. // iPageCount = parseInt(res.DATA.rel || 10);
  63. // }
  64. //}).always(function () {
  65. // fnGetNewsPage(iPageIndex);
  66. //});
  67. };
  68. init();
  69. });