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.

66 lines
2.4 KiB

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