427 lines
15 KiB
HTML
427 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
xmlns:th="http://www.thymeleaf.org">
|
|
|
|
|
|
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
|
<main id="content" role="main">
|
|
<div class="inner">
|
|
|
|
<p class="form-desc">필수입력</p>
|
|
|
|
<section class="form-group">
|
|
<form method="post" name="reqForm" id="reqForm" onsubmit="formControl.authInfoUser();"
|
|
th:action="@{/api/front/info/user/update}" th:object="${userInfo}">
|
|
<!-- 이름 -->
|
|
<div class="component-input">
|
|
<div class="input-label">
|
|
<label for="temp_input_0001" class="label-txt">
|
|
이름<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_0001" placeholder="이름을 입력해 주세요" name="ownerName" th:field="*{ownerName}"
|
|
maxlength="10">
|
|
</div>
|
|
</div>
|
|
<!-- 연령 -->
|
|
<div class="component-input">
|
|
<div class="input-label">
|
|
<label for="temp_input_0002" class="label-txt">
|
|
연령<span>(만 나이)</span> <i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_0002" placeholder="만 나이를 입력해 주세요" th:field="*{ownerAge}"
|
|
maxlength="3" oninput="this.value=this.value.replace(/[^0-9]/g,'')">
|
|
</div>
|
|
</div>
|
|
<!-- 가구연락처 -->
|
|
<div class="input-flex-group type-num">
|
|
<div class="input-label">
|
|
<label for="tel1Id" class="label-txt">
|
|
가구 연락처
|
|
</label>
|
|
</div>
|
|
<div class="d-flex">
|
|
<div class="select-group">
|
|
|
|
<div id="tel1Id" class="component-select bottom-sheet"
|
|
th:data-props-default="${userInfo.tel1}" data-props-type="bottomSheet">
|
|
<input type="hidden" th:field="*{tel1}" data-type="select">
|
|
<button type="button" class="select-box">
|
|
<span class="select-txt"></span>
|
|
</button>
|
|
<div class="select-options">
|
|
<div class="select-header">
|
|
<p>가구 연락처</p>
|
|
<button type="button" class="select-close">
|
|
<span class="hide-txt">닫기</span>
|
|
</button>
|
|
</div>
|
|
<div class="select-scroll">
|
|
<ul class="">
|
|
<li class="option" data-value="02" th:classappend="${userInfo.tel1 == '02'?' current':'' }">02</li>
|
|
<li class="option" data-value="031" th:classappend="${userInfo.tel1 == '031'?' current':'' }">31</li>
|
|
<li class="option" data-value="033" th:classappend="${userInfo.tel1 == '033'?' current':'' }">033</li>
|
|
<li class="option" data-value="042" th:classappend="${userInfo.tel1 == '042'?' current':'' }">042</li>
|
|
<li class="option" data-value="043" th:classappend="${userInfo.tel1 == '043'?' current':'' }">043</li>
|
|
<li class="option" data-value="051" th:classappend="${userInfo.tel1 == '051'?' current':'' }">051</li>
|
|
<li class="option" data-value="052" th:classappend="${userInfo.tel1 == '052'?' current':'' }">052</li>
|
|
<li class="option" data-value="053" th:classappend="${userInfo.tel1 == '053'?' current':'' }">053</li>
|
|
<li class="option" data-value="054" th:classappend="${userInfo.tel1 == '054'?' current':'' }">054</li>
|
|
<li class="option" data-value="055" th:classappend="${userInfo.tel1 == '055'?' current':'' }">055</li>
|
|
<li class="option" data-value="061" th:classappend="${userInfo.tel1 == '061'?' current':'' }">061</li>
|
|
<li class="option" data-value="062" th:classappend="${userInfo.tel1 == '062'?' current':'' }">062</li>
|
|
<li class="option" data-value="063" th:classappend="${userInfo.tel1 == '063'?' current':'' }">063</li>
|
|
<li class="option" data-value="064" th:classappend="${userInfo.tel1 == '064'?' current':'' }">064</li>
|
|
<li class="option" data-value="010" th:classappend="${userInfo.tel1 == '010'?' current':'' }">010</li>
|
|
<li class="option" data-value="011" th:classappend="${userInfo.tel1 == '011'?' current':'' }">011</li>
|
|
<li class="option" data-value="111" th:classappend="${userInfo.tel1 == '111'?' current':'' }">111</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="number" th:field="*{tel2}"
|
|
maxlength="4" inputmode="numeric" pattern="[0-9]*" oninput="kri.form.maxlength(this)"/>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="number" th:field="*{tel3}"
|
|
maxlength="4" inputmode="numeric" pattern="[0-9]*" oninput="kri.form.maxlength(this)"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 휴대폰 번호 -->
|
|
<div class="input-flex-group type-num">
|
|
<div class="input-label">
|
|
<label for="phone1Id" class="label-txt">
|
|
휴대폰 번호 <i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="d-flex">
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="number" id="phone1Id" name="phone1" th:value="${userInfo.phone1}" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="number" id="temp_input_0006" th:field="*{phone2}"
|
|
maxlength="4" inputmode="numeric" pattern="[0-9]*" oninput="kri.form.maxlength(this)">
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="number" id="temp_input_0007" th:field="*{phone3}"
|
|
maxlength="4" inputmode="numeric" pattern="[0-9]*" oninput="kri.form.maxlength(this)">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 도로명 주소 -->
|
|
<div class="input-col-group">
|
|
<div class="select-group">
|
|
<div class="select-label">
|
|
<p class="label-txt">
|
|
도로명 주소
|
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div id="regionMainCodeId" class="component-select bottom-sheet" data-props-default="지역 선택"
|
|
data-props-type="bottomSheet">
|
|
<input type="hidden" name="regionMainCode" data-type="select" th:value="${userInfo.regionMainCode}">
|
|
<button type="button" class="select-box">
|
|
<span class="select-txt">선택</span>
|
|
</button>
|
|
<div class="select-options">
|
|
<div class="select-header">
|
|
<p>지역 선택</p>
|
|
<button type="button" class="select-close">
|
|
<span class="hide-txt">닫기</span>
|
|
</button>
|
|
</div>
|
|
<div class="select-scroll">
|
|
|
|
<ul class="">
|
|
<th:block th:each="item : ${regionMainList}">
|
|
<li class="option" th:data-value="${item.id}"
|
|
th:text="${item.codeText}"
|
|
th:classappend="${item.id eq userInfo.regionMainCode ? 'current' : ''}">option1
|
|
</li>
|
|
</th:block>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="select-group">
|
|
<div id="regionSubCodeId" class="component-select bottom-sheet"
|
|
data-props-default="세부지역 선택" data-props-type="bottomSheet">
|
|
<input type="hidden" th:field="*{regionSubCode}" data-type="select">
|
|
<button type="button" class="select-box">
|
|
<span class="select-txt">선택</span>
|
|
</button>
|
|
<div class="select-options">
|
|
<div class="select-header">
|
|
<p>세부지역 선택</p>
|
|
<button type="button" class="select-close">
|
|
<span class="hide-txt">닫기</span>
|
|
</button>
|
|
</div>
|
|
<div class="select-scroll">
|
|
<ul class="">
|
|
<th:block th:each="item : ${regionSubList}">
|
|
<li class="option" th:data-value="${item.id}"
|
|
th:text="${item.codeText}"
|
|
th:classappend="${item.id eq userInfo.regionSubCode ? 'current' : ''}"
|
|
>option1
|
|
</li>
|
|
</th:block>
|
|
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_00023" placeholder="세부 주소를 입력해 주세요"
|
|
th:field="*{address}" maxlength="50"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="component-btns">
|
|
<div class="btns-row">
|
|
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.confirmPopup()">
|
|
<span class="btn-txt">변경</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
|
|
<!-- 모달 팝업 -->
|
|
<div class="layer-wrap">
|
|
<div class="component-modal confirmPopup" data-props-dimm-click="true">
|
|
<div class="modal-dimm"></div>
|
|
<div class="modal-frame">
|
|
<div class="modal-container">
|
|
<div class="modal-header">
|
|
<h3 class="modal-tit">개인정보 수집 및 활용 동의</h3>
|
|
</div>
|
|
<div class="modal-content">
|
|
<div class="modal-content-inner">
|
|
<div>
|
|
이런 저런 내용<br><br><br><br><br><br><br><br><br>모달 스크롤 적용필요!!!
|
|
</div>
|
|
<div class="component-btns">
|
|
<div class="btns-row two-col">
|
|
<div class="btns-col-1">
|
|
<button type="button" class="btn btn-full btn-l btn-secondary"
|
|
onclick="ENV.module.confirmPopup.close();">
|
|
<span class="btn-txt">동의 안함</span>
|
|
</button>
|
|
</div>
|
|
<div class="btns-col-2">
|
|
<button type="button" class="btn btn-full btn-l btn-primary"
|
|
onclick="formControl.confirmPopupOk()">
|
|
<span class="btn-txt">동의</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button class="modal-close"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- //모달 팝업 -->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<section layout:fragment="script">
|
|
<script th:inline="javascript">
|
|
let ENV = {
|
|
httpUrl: {
|
|
root: /*[[#{uri.front.info.user.path}]]*/'rootUrl',
|
|
user: /*[[|/api/front#{uri.front.info.user.path}/update|]]*/'updateUrl',
|
|
myInfo: /*[[#{uri.front.info.path}]]*/'myInfoUrl',
|
|
},
|
|
module: {
|
|
confirmPopup: null
|
|
},
|
|
select:{
|
|
select1:null,
|
|
select2:null,
|
|
select3:null,
|
|
select4:null
|
|
},
|
|
submitted: false,
|
|
};
|
|
|
|
let formControl = {
|
|
init() {
|
|
console.log("init")
|
|
setTimeout(function(){
|
|
formControl._bindUI();
|
|
},300);
|
|
|
|
//ajaxUtil._alert('select 010->10으로 노출\n 최초값 지정 및 값 취득 함수 필요\n 개인정보 작성 필요\n 모달 내부 스크롤 기능 추가 필요', null);
|
|
ENV.initialOwnerName = document.querySelector('input[name="ownerName"]').value;
|
|
},
|
|
_bindUI() {
|
|
|
|
console.log("bind")
|
|
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
|
|
|
|
const $select1 = document.querySelector('#regionMainCodeId');
|
|
ENV.select.select1 = new etUI.components.SelectBox();
|
|
ENV.select.select1.core.init($select1, {
|
|
selectItemCallback({selectValue, dataValue}){
|
|
|
|
document.querySelector('#regionMainCode').value = dataValue;
|
|
}
|
|
});
|
|
|
|
const $select2 = document.querySelector('#regionSubCodeId');
|
|
ENV.select.select2 = new etUI.components.SelectBox();
|
|
ENV.select.select2.core.init($select2, {
|
|
selectItemCallback({selectValue, dataValue}){
|
|
document.querySelector('#regionSubCode').value = dataValue;
|
|
}
|
|
});
|
|
|
|
const $select3 = document.querySelector('#tel1Id');
|
|
ENV.select.select3 = new etUI.components.SelectBox();
|
|
ENV.select.select3.core.init($select3, {
|
|
selectItemCallback({selectValue, dataValue}){
|
|
document.querySelector('#tel1').value = dataValue;
|
|
}
|
|
});
|
|
|
|
|
|
const $select4 = document.querySelector('#phone1Id');
|
|
ENV.select.select4 = new etUI.components.SelectBox();
|
|
ENV.select.select4.core.init($select4, {
|
|
selectItemCallback({selectValue, dataValue}){
|
|
document.querySelector('#phone1').value = dataValue;
|
|
}
|
|
});
|
|
|
|
|
|
// selectboxInstance1.setValue($('input[name=regionMainCode]').val());
|
|
},
|
|
confirmPopup() {
|
|
const currentName = document.querySelector('input[name="ownerName"]').value.trim();
|
|
|
|
if (currentName === '') { // 이름 비어있을 경우 유효성검사 실시
|
|
formControl.updateUserInfo();
|
|
} else if (currentName !== ENV.initialOwnerName) { // 이름이 변경됐을 경우 개인정보동의 모달창 띄우기
|
|
ENV.module.confirmPopup.open();
|
|
} else {
|
|
formControl.updateUserInfo();
|
|
}
|
|
},
|
|
confirmPopupOk() {
|
|
ENV.module.confirmPopup.close();
|
|
|
|
setTimeout(function () {
|
|
formControl.updateUserInfo();
|
|
}, 500);
|
|
},
|
|
updateUserInfo() {
|
|
|
|
const f = document.reqForm;
|
|
// // TODO 어쩔수 없이 이렇게 하는데..... 콤포넌트값 핸들링 방법 UX에서 지정하면 수정해야함.
|
|
// const tel1Element = document.getElementById('tel1Id');
|
|
// const phone1IdElement = document.getElementById('phone1Id');
|
|
// const regionMainCodeIdElement = document.getElementById('regionMainCodeId');
|
|
// const regionSubCodeIdElement = document.getElementById('regionSubCodeId');
|
|
// if (tel1Element && tel1Element.value) {
|
|
// f.tel1.value = tel1Element.value;
|
|
// }
|
|
// if (phone1IdElement && phone1IdElement.value) {
|
|
// f.phone1.value = phone1IdElement.value;
|
|
// }
|
|
// if (regionMainCodeIdElement && regionMainCodeIdElement.value) {
|
|
// f.regionMainCode.value = regionMainCodeIdElement.value;
|
|
// }
|
|
// if (regionSubCodeIdElement && regionSubCodeIdElement.value) {
|
|
// f.regionSubCode.value = regionSubCodeIdElement.value;
|
|
// }
|
|
|
|
f.regionMainCode.value = ENV.select.select1.getValue();
|
|
f.regionSubCode.value = ENV.select.select2.getValue();
|
|
f.tel1.value = ENV.select.select3.getValue();
|
|
f.phone1.value = ENV.select.select4.getValue();
|
|
|
|
|
|
|
|
|
|
const obj = $(f).serializeObject();
|
|
console.log(obj)
|
|
ajaxUtil._ajaxAsync(
|
|
ENV.httpUrl.user,
|
|
obj,
|
|
function (rstData, status) {
|
|
if (rstData.code === 'SUCCESS') {
|
|
ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, function () {
|
|
/**
|
|
* TODO
|
|
* 내정보에서만 들어온다는 가정하에서 back을 하게함 SB에는 내정보로 이동하게 되어 있음.
|
|
*/
|
|
// history.back();
|
|
location.href = '/info';
|
|
});
|
|
} else if (rstData.code === 'ERROR') {
|
|
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);
|
|
}
|
|
},
|
|
);
|
|
},
|
|
|
|
telAndPhoneCheck(tel1, tel2, tel3) {
|
|
// 공백 제거
|
|
tel1 = tel1.trim();
|
|
tel2 = tel2.trim();
|
|
tel3 = tel3.trim();
|
|
|
|
const telRegex = /^[0-9]+$/;
|
|
if (!telRegex.test(tel1) || !telRegex.test(tel2) || !telRegex.test(tel3)) {
|
|
return null;
|
|
}
|
|
if (!((tel1.length === 2 || tel1.length === 3) && tel2.length === 4 && tel3.length === 4)) {
|
|
return null;
|
|
}
|
|
const formatted = `${tel1}-${tel2}-${tel3}`;
|
|
return formatted;
|
|
}
|
|
|
|
|
|
};
|
|
</script>
|
|
</section>
|
|
|
|
|
|
</html> |