Skip to content

Commit

Permalink
Merge pull request #7 from koreait0000/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
eofoeofo authored Dec 14, 2021
2 parents 32fc18e + 49dc032 commit 8dbdcd1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/spring/nong4/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public int chkOverlap(UserEntity param) {

if(chkOverlap == null) { // email이 null (중복이 아닐때)
result = 1;

return result;
}
return 0;
Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/mybatis-mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@
,tel
FROM t_user
WHERE 1 = 1
<if test="email != null">
<if test="@org.apache.commons.lang3.StringUtils@isNotEmpty(email)">
AND email = #{email}
</if>
<!--<if test="@org.apache.commons.lang3.StringUtils@isNotEmpty(email)">
AND email = #{email}
</if>-->
<if test="@org.apache.commons.lang3.StringUtils@isNotEmpty(userNick)">
AND nick = #{userNick}
</if>
Expand Down
37 changes: 37 additions & 0 deletions src/main/webapp/res/js/user/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const phoneJ = /^01([0|1|6|7|8|9])-?([0-9]{4})-?([0-9]{4})$/;
const pwJ = /^[A-Za-z0-9]{4,12}$/; //A-Z,a~z,0~9로 시작하는 4~12자리 비밀번호
const nameJ = /^[가-힣]{2,6}$/; //가~힣,한글로 이뤄진 문자열 이름 2~6자리


// 회원가입 체크
if(joinBtnElem) {

let emailChk = 0;
let nickChk = 0;
let telChk = 0;
Expand All @@ -33,6 +37,27 @@ if(joinBtnElem) {
const nameJ = /^[가-힣]{2,6}$/; //가~힣,한글로 이뤄진 문자열 이름 2~6자리

function ajax() {


const param = {
email : EmailElem.value,
pw : pwElem.value,
nm : nmElem.value,
userNick : userNickElem.value,
tel : telElem.value
}

fetch('/user/join', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(param)
})
.then(res => res.json())
.then(myJson => {
proc(myJson);

var sum = emailChk + nickChk + telChk;
console.log('회원가입체크1')
if (sum == 3) {
Expand All @@ -49,6 +74,7 @@ if(joinBtnElem) {
'Content-Type': 'application/json',
},
body: JSON.stringify(param)

})
.then(res => res.json())
.then(myJson => {
Expand Down Expand Up @@ -80,6 +106,10 @@ if(joinBtnElem) {
pwReElem.focus();
return;
}




if(EmailElem.value == '' || pwElem.value == '' || nmElem.value == '' || userNickElem.value == '' || telElem.value == '') {
if(EmailElem.value == '') {
setTimeout(function(){EmailElem.focus();}, 1);
Expand All @@ -96,6 +126,10 @@ if(joinBtnElem) {
}
return false;
}




ajax();
}

Expand Down Expand Up @@ -199,8 +233,11 @@ function userNickKeyupProc() {
telChk = 1;
}
else {
msgTelElem.innerText = '중복된 휴대번호 입니다.';

msgTelElem.innerText = '중복된 휴대번호가 존재합니다.';
telChk = 0;

msgTelElem.focus();
return;
}
Expand Down

0 comments on commit 8dbdcd1

Please sign in to comment.