365 lines
14 KiB
HTML
365 lines
14 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="이름을 입력해 주세요" 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">02</li>
|
|
<li class="option" data-value="31">31</li>
|
|
<li class="option" data-value="033">033</li>
|
|
<li class="option" data-value="042">042</li>
|
|
<li class="option" data-value="043">043</li>
|
|
<li class="option" data-value="051">051</li>
|
|
<li class="option" data-value="052">052</li>
|
|
<li class="option" data-value="053">053</li>
|
|
<li class="option" data-value="054">054</li>
|
|
<li class="option" data-value="055">055</li>
|
|
<li class="option" data-value="061">061</li>
|
|
<li class="option" data-value="062">062</li>
|
|
<li class="option" data-value="063">063</li>
|
|
<li class="option" data-value="064">064</li>
|
|
<li class="option" data-value="010">010</li>
|
|
<li class="option" data-value="011">011</li>
|
|
<li class="option" data-value="111">111</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" placeholder=0000 th:field="*{tel2}" maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')"/>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" placeholder=0000 th:field="*{tel3}" maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 휴대폰 번호 -->
|
|
<div class="input-flex-group type-num">
|
|
<div class="input-label">
|
|
<label for="phoneId" class="label-txt">
|
|
휴대폰 번호 <i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="d-flex">
|
|
<div class="select-group">
|
|
|
|
|
|
<div id="phoneId" class="component-select bottom-sheet" th:data-props-default="${userInfo.phone1}" data-props-type="bottomSheet">
|
|
<input type="hidden" th:field="*{phone1}" 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="010">010</li>
|
|
<li class="option" data-value="011">011</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_0006" placeholder=0000 th:field="*{phone2}" maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')">
|
|
</div>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_0007" placeholder=0000 th:field="*{phone3}" maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')">
|
|
</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" th:field="*{regionMainCode}" 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 : ${regionMainList}">
|
|
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}">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}" >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
|
|
},
|
|
submitted: false,
|
|
};
|
|
|
|
let formControl = {
|
|
init(){
|
|
this._bindUI();
|
|
ajaxUtil._alert('select 010->10으로 노출\n 최초값 지정 및 값 취득 함수 필요\n 개인정보 작성 필요\n 모달 내부 스크롤 기능 추가 필요',null);
|
|
|
|
},
|
|
_bindUI(){
|
|
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
|
|
},
|
|
confirmPopup(){
|
|
ENV.module.confirmPopup.open();
|
|
},
|
|
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;
|
|
}
|
|
|
|
|
|
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()
|
|
});
|
|
} 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> |