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.

61 lines
2.3 KiB

2 years ago
  1. $(function () {
  2. 'use strict';
  3. var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh-TW',
  4. sId = getUrlParam('Id'),
  5. /*
  6. * 目的 抓去服務項目菜單
  7. */
  8. fnSetServiceItems = function (org) {
  9. return fnGetWebSiteSetting(function (saRes) {
  10. if (saRes.length > 0) {
  11. var sHtml = $('<script />', { type: 'text/x-jsrender', html: '<li id="{{:Guid}}"><a href="javascript:void(0);">{{:Title}}</a></li>' }).render(saRes);
  12. $('#left>ul').html(sHtml).find('li').on('click', function () {
  13. var sGuid = this.id;
  14. $('#left>ul a').each(function () {
  15. $(this).css('color', '#666');
  16. });
  17. $(this).find('a').css('color', '#EC681E');
  18. fnGetServiceItem(sGuid);
  19. });
  20. if (sId) {
  21. $('#' + sId).find('a').css('color', '#EC681E');
  22. }
  23. else {
  24. $('#left>ul a:first').css('color', '#EC681E');
  25. fnGetServiceItem(saRes[0].Guid);
  26. }
  27. }
  28. }, 'ServiceItems', sLang)
  29. },
  30. /*
  31. * 目的 抓去服務項目內容
  32. * @param {String} id 服務項目id
  33. */
  34. fnGetServiceItem = function (id) {
  35. return fnGetWebSiteSetting(function (oRes) {
  36. $('#Title').html(oRes.Title);
  37. $('#Content').html(oRes.Content);
  38. $('#TitleEName').html(oRes.Memo);
  39. $('#TitleName').html(oRes.Title);
  40. }, 'ServiceItems', sLang, id, false, true);
  41. },
  42. init = function () {
  43. var myHelpers = {
  44. setFilePath: function (val) {
  45. val = val || '';
  46. return gServerUrl + '/' + val.replace(/\\/g, "\/");
  47. },
  48. setFileName: function (val) {
  49. return val.split('.')[0] || '';
  50. }
  51. };
  52. $.views.helpers(myHelpers);
  53. fnSetServiceItems();
  54. if (sId) {
  55. fnGetServiceItem(sId);
  56. }
  57. };
  58. init();
  59. });