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.

65 lines
2.3 KiB

2 years ago
  1. $(function () {
  2. 'use strict';
  3. var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh',
  4. iPageIndex = 1,
  5. iPageCount = 2,
  6. /**
  7. * 目的 抓去活動資訊分頁資訊
  8. * @return {Object} ajax物件
  9. */
  10. fnGetFilesPage = function () {
  11. return fnGetWebSiteSettingPage({
  12. pageIndex: iPageIndex,
  13. pageSize: iPageCount,
  14. SetType: 'Downloads',
  15. LangId: sLang,
  16. CallBack: function (res) {
  17. var sHtml = $('#temp_download').render(res.DataList);
  18. $('ul#download').html(sHtml + '<p class="clear">&nbsp;</p>').find('li a').on('click', function () {
  19. var sName = $(this).attr('filename'),
  20. sPath = $(this).attr('filepath');
  21. DownLoadFile(sPath, sName);
  22. });
  23. $("#pager").pagination({
  24. items: res.Total,
  25. itemsOnPage: iPageCount,
  26. currentPage: iPageIndex,
  27. displayedPages: 4,
  28. cssStyle: 'light-theme',
  29. onPageClick: fnChangePage
  30. });
  31. if (res.Total <= iPageCount) { $("#pager").hide(); }
  32. }
  33. });
  34. },
  35. /*
  36. * 目的 抓去活動資訊分頁資訊
  37. */
  38. fnChangePage = function () {
  39. iPageIndex = $("#pager").pagination('getCurrentPage');
  40. fnGetFilesPage();
  41. },
  42. init = function () {
  43. var myHelpers = {
  44. setFileTitle: function (name, desc) {
  45. return name + (!desc ? '' : '(' + desc + ')');
  46. },
  47. getFileName: function (val) {
  48. return val.split('.')[0];
  49. }
  50. };
  51. $.views.helpers(myHelpers);
  52. g_api.ConnectLite(Service.apiappcom, ComFn.GetSysSet, {
  53. SetItemID: 'FilesShowCount'
  54. }, function (res) {
  55. if (res.RESULT) {
  56. iPageCount = parseInt(res.DATA.rel || 10);
  57. }
  58. }).always(function () {
  59. fnGetFilesPage(iPageIndex);
  60. });
  61. };
  62. init();
  63. });