|
@@ -4,79 +4,56 @@
|
|
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
|
|
<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
|
|
|
<script type="text/javascript">
|
|
|
-
|
|
|
-function checkMobile(){
|
|
|
-
|
|
|
- var varUA = navigator.userAgent.toLowerCase(); //userAgent 값 얻기
|
|
|
-
|
|
|
- if ( varUA.indexOf('android') > -1) {
|
|
|
- //안드로이드
|
|
|
- return "android";
|
|
|
- } else if ( varUA.indexOf("iphone") > -1||varUA.indexOf("ipad") > -1||varUA.indexOf("ipod") > -1 ) {
|
|
|
- //IOS
|
|
|
- return "ios";
|
|
|
- } else {
|
|
|
- //아이폰, 안드로이드 외
|
|
|
- return "other";
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
$( function(){
|
|
|
- $( "#id" ).focus();
|
|
|
+ $( "#ex_select" ).siblings('label').text( $( "#ex_select" ).children('option:selected').text() );
|
|
|
+
|
|
|
+ $.validator.addMethod('selectcheck', function (value) {
|
|
|
+ return (value != "0" );
|
|
|
+ }, "" );
|
|
|
|
|
|
$( "#loginForm" ).validate({
|
|
|
- onfocusout: function (element) {
|
|
|
- $( element ).valid();
|
|
|
-// $( "#msg" ).remove();
|
|
|
- },
|
|
|
- messages : {
|
|
|
+ rules : {
|
|
|
id : {
|
|
|
- required : "아이디를 입력해주세요."
|
|
|
+ required: true
|
|
|
},
|
|
|
pw : {
|
|
|
- required : "비밀번호를 입력해주세요."
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ centerCode : {
|
|
|
+ selectcheck : true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ errorPlacement: function( error, element ){
|
|
|
+ if( element.attr( "name" ) == "centerCode" ) {
|
|
|
+ $( "#errMsg" ).text( "생활센터를 선택해주세요" );
|
|
|
+ } else if( element.attr( "name" ) == "id" || element.attr( "name" ) == "pw" ) {
|
|
|
+ if( $( "#id" ).val().length == 0 ) {
|
|
|
+ $( "#errMsg" ).text( "병동번호 입력해주세요(동+호실)" );
|
|
|
+ $( "#id" ).focus();
|
|
|
+ } else if( $( "#pw" ).val().length == 0 ){
|
|
|
+ $( "#errMsg" ).text( "생년월일 6자리를 입력해주세요." );
|
|
|
+ $( "#pw" ).focus();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
submitHandler: function(form) {
|
|
|
-// $( "#submitLoading" ).toggleClass( "d-none", false );
|
|
|
-// $( "#submitBtn" ).toggleClass( "d-none", true );
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- url : "./check",
|
|
|
- data : $("#loginForm").serialize(),
|
|
|
- method : "POST",
|
|
|
- dataType : "json",
|
|
|
- success : function( data ){
|
|
|
- console.log("data -- > " + JSON.stringify(data));
|
|
|
- var resultCode = data.code;
|
|
|
- var resultMsg = data.message;
|
|
|
+ getAjax( "./check", $("#loginForm").serialize(), function( data ){
|
|
|
+ console.log("data -- > " + JSON.stringify(data));
|
|
|
+ var resultCode = data.code;
|
|
|
+ var resultMsg = data.message;
|
|
|
+
|
|
|
+ if( data.code == "00" ) {
|
|
|
+ console.log("checkMobile() -- > " + checkMobile());
|
|
|
|
|
|
- if( data.code == "00" ) {
|
|
|
- console.log("checkMobile() -- > " + checkMobile());
|
|
|
- if (checkMobile() == "android") {
|
|
|
- window.android.login(data.id, data.pw);
|
|
|
- }
|
|
|
-
|
|
|
- location.href="/mobile/menu";
|
|
|
- } else {
|
|
|
- $("#errMsg").text(resultMsg);
|
|
|
-// $( "#submitLoading" ).toggleClass( "d-none", true );
|
|
|
-// $( "#submitBtn" ).toggleClass( "d-none", false );
|
|
|
+ if (checkMobile() == "android") {
|
|
|
+ window.android.login(data.id, data.pw);
|
|
|
};
|
|
|
- },
|
|
|
- error : function(){
|
|
|
-// $("#errMsg").attr("")
|
|
|
-// $( "#submitLoading" ).toggleClass( "d-none", true );
|
|
|
-// $( "#submitBtn" ).toggleClass( "d-none", false );
|
|
|
- }
|
|
|
- }).done( function(){
|
|
|
-// if( $( "#saveId" ).is( ":checked" ) ) {
|
|
|
-// setCookie( "userInputId", $( "#id" ).val(), 365 );
|
|
|
-// } else {
|
|
|
-// deleteCookie( "userInputId" );
|
|
|
-// }
|
|
|
- });
|
|
|
+
|
|
|
+ location.href="/mobile/menu";
|
|
|
+ } else {
|
|
|
+ $("#errMsg").text( resultMsg );
|
|
|
+ };
|
|
|
+ }, null, null );
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -85,9 +62,7 @@ $( function(){
|
|
|
<body>
|
|
|
<div id="login">
|
|
|
<div class="container">
|
|
|
- <div class="title">
|
|
|
- 생활치료센터
|
|
|
- </div>
|
|
|
+ <div class="title">생활치료센터</div>
|
|
|
<form id="loginForm" action="./check" method="post">
|
|
|
<div class="login_box">
|
|
|
<div class="visual">
|
|
@@ -96,40 +71,33 @@ $( function(){
|
|
|
<div class="form">
|
|
|
<div class="part">
|
|
|
<div class="selectbox">
|
|
|
- <label for="ex_select">치료센터 확인</label>
|
|
|
- <select id="ex_select" name="centerCode">
|
|
|
+ <label for="centerList">치료센터 선택</label>
|
|
|
+ <select id="centerList" name="centerCode">
|
|
|
+ <option value="0" selected>치료센터 선택</option>
|
|
|
<c:forEach var="i" items="${centerList}">
|
|
|
- <option value="${i.centerCode}"><c:out value="${i.centerName}" /></option>
|
|
|
+ <option value="${i.centerCode}"> · <c:out value="${i.centerName}" /></option>
|
|
|
</c:forEach>
|
|
|
- <!-- <option selected>치료센터 확인</option> -->
|
|
|
- <!-- <option>레몬병원</option> -->
|
|
|
- <!-- <option>레몬병원</option> -->
|
|
|
- <!-- <option>레몬병원</option> -->
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part">
|
|
|
<div class="input">
|
|
|
- <input type="text" id="id" name="id" class="number1" placeholder="병동번호" tabindex="1" maxlength="20" required>
|
|
|
+ <input type="text" id="id" name="id" class="login-id" placeholder="병동번호" tabindex="1" maxlength="20" autocomplete="off" required>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part">
|
|
|
<div class="input">
|
|
|
- <input type="password" id="pw" name="pw" class="date1" placeholder="생년월일 6자리" autocomplete="off" tabindex="2" maxlength="15" required>
|
|
|
+ <input type="password" id="pw" name="pw" class="login-pw" placeholder="생년월일 6자리" autocomplete="off" tabindex="2" autocomplete="off" maxlength="15" required>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part">
|
|
|
- <div class="alert" id="errMsg">
|
|
|
-<!-- 입력하신 정보가 일치하지 않습니다. -->
|
|
|
- </div>
|
|
|
+ <div class="alert" id="errMsg"></div>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="part">
|
|
|
<div class="button">
|
|
|
<!-- <button id="submitBtn">로그인</button> -->
|
|
|
<button id="submitBtn" type="submit" class="btn btn-lg btn-primary">로그인</button>
|
|
|
- <div id="submitLoading" class="d-none align-bottom spinner-border text-primary" role="status">
|
|
|
- <span class="sr-only">Loading...</span>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|