NoticeFormMob.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  5. layout:decorator="mob/common/layout/AppLayoutMob">
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <!--
  8. *******************************************************************************
  9. * @source : NoticeFormMob.html
  10. * @desc : 알림함 Page
  11. *============================================================================
  12. * STYLE24
  13. * Copyright(C) 2021 TSIT, All rights reserved.
  14. *============================================================================
  15. * VER DATE AUTHOR DESCRIPTION
  16. * === =========== ========== =============================================
  17. * 1.0 2021.05.21 jsshin 최초 작성
  18. *******************************************************************************
  19. -->
  20. <body>
  21. <th:block layout:fragment="content">
  22. <main class="container app-only">
  23. <!-- ★ 컨텐츠 시작 -->
  24. <section id="notice" class="notice nodata">
  25. </section>
  26. <!-- ★ 컨텐츠 종료 -->
  27. </main>
  28. <script th:inline="javascript">
  29. $(document).ready(function(){
  30. $('#htopTitle').text('알림함');
  31. if (_isApp === 'true') {
  32. if (_osType === 'A') {
  33. window.style24.getPushList();
  34. } else if (_osType === 'I') {
  35. window.webkit.messageHandlers.getPushList.postMessage({"dummy":"dummy"});
  36. }
  37. } else {
  38. $('#notice').addClass('nodata');
  39. }
  40. });
  41. var pushListInfo = function (pushList) {
  42. let orgPushList;
  43. //IOS는 앱에서 BASE64로 인코딩 한후 전달 한다.
  44. if (_osType === 'I') {
  45. orgPushList = window.atob(pushList);
  46. } else if (_osType === 'A') {
  47. orgPushList = pushList;
  48. }
  49. if (!gagajf.isNull(orgPushList)) {
  50. let pushListJosn = JSON.parse(orgPushList);
  51. let html = '';
  52. $.each(pushListJosn.pushList, function(idx, item) {
  53. if (_osType === 'I') {
  54. alert('fnDecodeUnicode :' + fnDecodeUnicode(item.title.toLowerCase()) + 'escape :' + escape(item.title)
  55. + ' unescape :' + unescape(item.title)
  56. + ' encodeURI:' + encodeURI(item.title)
  57. + ' decodeURI:' + decodeURI(item.title)
  58. + ' encodeURIComponent:' + encodeURIComponent(item.title)
  59. + ' decodeURIComponent:' + decodeURIComponent(item.title)
  60. );
  61. }
  62. html += '<div class="inner">\n';
  63. html += ' <a href="'+item.link+'">\n';
  64. html += ' <dl>\n';
  65. html += ' <dt class="tit">\n';
  66. let title = '';
  67. if (_osType === 'I') {
  68. title = fnDecodeUnicode(item.title.toLowerCase());
  69. } else if(_osType === 'A') {
  70. title = item.title;
  71. }
  72. html += title;
  73. html += ' </dt>\n'
  74. html += ' <dd class="cont_txt">\n';
  75. let content = '';
  76. if (_osType === 'I') {
  77. content = fnDecodeUnicode(item.content.toLowerCase());
  78. } else if(_osType === 'A') {
  79. content = item.content;
  80. }
  81. html += content;
  82. html += ' </dd>\n';
  83. if (!gagajf.isNull(item.imgUrl)) {
  84. html += ' <dd class="cont_img">\n';
  85. html += ' <img src="'+ item.imgUrl +'" />\n';
  86. html += ' </dd>\n';
  87. }
  88. html += ' <dd class="cont_data">\n';
  89. html += ' <span>\n';
  90. html += fnDisplayDate(item.date);
  91. html += ' </span>\n';
  92. html += ' </dd>\n'
  93. html += ' </dl>\n'
  94. html += ' </a>';
  95. html += '</div>\n'
  96. });
  97. $('#notice').removeClass('nodata');
  98. $('#notice').html(html);
  99. } else {
  100. $('#notice').addClass('nodata');
  101. }
  102. }
  103. var fnDisplayDate = function (date) {
  104. let resultDate = '';
  105. if(!gagajf.isNull(date)) {
  106. let year = date.substring(0, 4);
  107. let month = date.substring(4, 6);
  108. let day = date.substring(6, 8);
  109. resultDate = year+'.'+month+'.'+day;
  110. }
  111. return resultDate;
  112. }
  113. var fnDecodeUnicode = function(context) {
  114. const regExp = /\\u([\d\w]{4})/gi;
  115. context = context.replace(regExp, function (match, grp)
  116. { return String.fromCharCode(parseInt(grp, 16)); } );
  117. return unescape(context);
  118. }
  119. </script>
  120. </th:block>
  121. </body>
  122. </html>