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.

62 lines
2.3 KiB

3 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. console.log(this);
  17. });
  18. $(this).find('a').css('color', '#EC681E');
  19. fnGetServiceItem(sGuid);
  20. });
  21. if (sId) {
  22. $('#' + sId).find('a').css('color', '#EC681E');
  23. }
  24. else {
  25. $('#left>ul a:first').css('color', '#EC681E');
  26. fnGetServiceItem(saRes[0].Guid);
  27. }
  28. }
  29. }, 'ServiceItems', sLang)
  30. },
  31. /*
  32. * 目的 抓去服務項目內容
  33. * @param {String} id 服務項目id
  34. */
  35. fnGetServiceItem = function (id) {
  36. return fnGetWebSiteSetting(function (oRes) {
  37. $('#Title').html(oRes.Title);
  38. $('#Content').html(oRes.Content);
  39. $('#TitleEName').html(oRes.Memo);
  40. $('#TitleName').html(oRes.Title);
  41. }, 'ServiceItems', sLang, id, false, true);
  42. },
  43. init = function () {
  44. var myHelpers = {
  45. setFilePath: function (val) {
  46. val = val || '';
  47. return gServerUrl + '/' + val.replace(/\\/g, "\/");
  48. },
  49. setFileName: function (val) {
  50. return val.split('.')[0] || '';
  51. }
  52. };
  53. $.views.helpers(myHelpers);
  54. fnSetServiceItems();
  55. if (sId) {
  56. fnGetServiceItem(sId);
  57. }
  58. };
  59. init();
  60. });