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.

69 lines
2.5 KiB

2 years ago
  1. $(function () {
  2. 'use strict';
  3. var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh',
  4. iPageIndex = 1,
  5. iPageCount = 6,
  6. /*
  7. * 目的 抓去服務花絮前n筆
  8. */
  9. fnGetNewsTop = function () {
  10. return g_api.ConnectLite(Service.apiwebcom, ComFn.GetNewsPage, {
  11. pageIndex: iPageIndex,
  12. pageSize: iPageCount,
  13. NewsType: '02'
  14. }, function (res) {
  15. if (res.RESULT) {
  16. var oRes = res.DATA.rel,
  17. sHtml = $('#temp_news').render(oRes.DataList);
  18. $('.gallery').html(sHtml + '<p class="clear"></p>');
  19. $(".rectThumb").imgLiquid({ fill: true });
  20. $("#pager").pagination({
  21. items: oRes.Total,
  22. itemsOnPage: iPageCount,
  23. currentPage: iPageIndex,
  24. displayedPages: 4,
  25. cssStyle: 'light-theme',
  26. onPageClick: fnChangePage
  27. });
  28. if (oRes.Total <= iPageCount) { $("#pager").hide(); }
  29. }
  30. });
  31. },
  32. /*
  33. * 目的 抓去活動資訊分頁資訊
  34. */
  35. fnChangePage = function () {
  36. iPageIndex = $("#pager").pagination('getCurrentPage');
  37. fnGetNewsTop();
  38. },
  39. init = function () {
  40. var myHelpers = {
  41. setDate: function (date) {
  42. return new Date(date).formate('yyyy/MM/dd');
  43. },
  44. setRangeDate: function (date1, date2) {
  45. var r1 = new Date(date1).formate('yyyy/MM/dd'),
  46. r2 = new Date(date2).formate('MM/dd');
  47. return r1 + '-' + r2;
  48. },
  49. setFilePath: function (val) {
  50. val = val || '';
  51. //return 'http://localhost:3466' + '/' + val.replace(/\\/g, "\/");
  52. return gServerUrl + '/' + val.replace(/\\/g, "\/");
  53. },
  54. setFileName: function (val) {
  55. val = val || '';
  56. return val.split('.')[0] || '';
  57. },
  58. setContent: function (val) {
  59. val = val || '';
  60. return val.length > 66 ? val.substr(0, 66) + '...' : val;
  61. }
  62. };
  63. $.views.helpers(myHelpers);
  64. fnGetNewsTop();
  65. };
  66. init();
  67. });