login.jsp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  2. <%@ page language="java" contentType="text/html; charset=UTF-8"
  3. pageEncoding="UTF-8"%>
  4. <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  5. <jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
  6. <script type="text/javascript">
  7. $( function(){
  8. $( "#ex_select" ).siblings('label').text( $( "#ex_select" ).children('option:selected').text() );
  9. $.validator.addMethod('selectcheck', function (value) {
  10. return (value != "0" );
  11. }, "" );
  12. $( "#loginForm" ).validate({
  13. rules : {
  14. id : {
  15. required: true
  16. },
  17. pw : {
  18. required: true
  19. },
  20. centerCode : {
  21. selectcheck : true
  22. }
  23. },
  24. errorPlacement: function( error, element ){
  25. if( element.attr( "name" ) == "centerCode" ) {
  26. $( "#errMsg" ).text( "생활센터를 선택해주세요" );
  27. } else if( element.attr( "name" ) == "id" || element.attr( "name" ) == "pw" ) {
  28. if( $( "#id" ).val().length == 0 ) {
  29. $( "#errMsg" ).text( "동호실번호 입력해주세요(동+호실)" );
  30. $( "#id" ).focus();
  31. } else if( $( "#pw" ).val().length == 0 ){
  32. $( "#errMsg" ).text( "생년월일 8자리를 입력해주세요." );
  33. $( "#pw" ).focus();
  34. }
  35. }
  36. },
  37. submitHandler: function(form) {
  38. getAjax( "./check", $("#loginForm").serialize(), function( data ){
  39. console.log("data -- > " + JSON.stringify(data));
  40. var resultCode = data.code;
  41. var resultMsg = data.message;
  42. if( data.code == "00" ) {
  43. localStorage.id = data.id;
  44. localStorage.pw = $( "#pw" ).val();
  45. localStorage.cc = data.cc;
  46. // if( isMobile() ) {
  47. // if( checkDevice() == "android" ) {
  48. // window.android.login(data.id, data.pw);
  49. // } else if( checkDevice() == "ios" ){
  50. // }
  51. // }
  52. location.replace( '/mobile/menu' );
  53. } else {
  54. $("#errMsg").text( resultMsg );
  55. };
  56. }, null, null );
  57. }
  58. });
  59. if (localStorage.getItem( "id" ) != null) {
  60. autoLogin();
  61. }
  62. });
  63. function autoLogin(){
  64. if( localStorage.getItem( "id" ) != null &&
  65. localStorage.getItem( "pw" ) != null &&
  66. localStorage.getItem( "cc" ) != null ) {
  67. $( "#centerList" ).val( localStorage.getItem( "cc" ) );
  68. $( "#id" ).val( localStorage.getItem( "id" ) );
  69. $( "#pw" ).val( localStorage.getItem( "pw" ) );
  70. $( "#submitBtn" ).trigger( "click" );
  71. }
  72. }
  73. </script>
  74. </head>
  75. <body>
  76. <div id="login">
  77. <div class="container">
  78. <div class="title">생활치료센터</br>비대면진료 서비스</div>
  79. <form id="loginForm" action="./check" method="post">
  80. <div class="login_box">
  81. <div class="visual">
  82. <img src="/resources/images/mobile/login_visual.png" />
  83. </div>
  84. <div class="form">
  85. <div class="part">
  86. <div class="selectbox">
  87. <label for="centerList">치료센터 선택</label>
  88. <select id="centerList" name="centerCode">
  89. <option value="0" selected>치료센터 선택</option>
  90. <c:forEach var="i" items="${centerList}">
  91. <option value="${i.centerCode}"> · <c:out value="${i.centerName}" /></option>
  92. </c:forEach>
  93. </select>
  94. </div>
  95. </div>
  96. <div class="part">
  97. <div class="input">
  98. <input type="text" id="id" name="id" class="login-id" placeholder="동호실번호" tabindex="1" maxlength="20" autocomplete="off" required>
  99. </div>
  100. </div>
  101. <div class="part">
  102. <div class="input">
  103. <input type="password" id="pw" name="pw" class="login-pw" placeholder="생년월일 8자리 (YYYYMMDD)" autocomplete="off" tabindex="2" autocomplete="off" maxlength="15" required>
  104. </div>
  105. </div>
  106. <div class="part">
  107. <div class="alert" id="errMsg"></div>
  108. </div>
  109. <div class="part">
  110. <div class="button">
  111. <!-- <button id="submitBtn">로그인</button> -->
  112. <button id="submitBtn" type="submit" class="btn btn-lg btn-primary">로그인</button>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </form>
  118. </div>
  119. </div>
  120. </body>
  121. </html>