휴대폰번호 출력/저장 로직 변경
This commit is contained in:
@@ -26,24 +26,30 @@
|
||||
<div class="form-label-wrapper label-offset">
|
||||
<span class="form-label-text">휴대폰 번호</span> <span class="required-badge">필수</span>
|
||||
</div>
|
||||
<div class="form-field-wrapper input-with-button" th:with="parts=${#strings.arraySplit(mobileNumber, '-')}">
|
||||
<div class="form-field-wrapper input-with-button"
|
||||
th:with="hasHyphen=${mobileNumber != null and #strings.contains(mobileNumber, '-')},
|
||||
parts=${hasHyphen ? #strings.arraySplit(mobileNumber, '-') : null},
|
||||
len=${mobileNumber != null ? #strings.length(mobileNumber) : 0},
|
||||
mobilePrefix=${hasHyphen ? (parts != null and #arrays.length(parts) > 0 ? parts[0] : '') : (len >= 3 ? #strings.substring(mobileNumber, 0, 3) : '')},
|
||||
mobileMiddle=${hasHyphen ? (parts != null and #arrays.length(parts) > 1 ? parts[1] : '') : (len == 11 ? #strings.substring(mobileNumber, 3, 7) : (len == 10 ? #strings.substring(mobileNumber, 3, 6) : ''))},
|
||||
mobileLast=${hasHyphen ? (parts != null and #arrays.length(parts) > 2 ? parts[2] : '') : (len == 11 ? #strings.substring(mobileNumber, 7, 11) : (len == 10 ? #strings.substring(mobileNumber, 6, 10) : ''))}">
|
||||
<div class="compound-input">
|
||||
<input type="text"
|
||||
th:value="${parts != null and parts.length > 0 ? parts[0] : ''}"
|
||||
th:value="${mobilePrefix}"
|
||||
name="mobilePrefix"
|
||||
class="form-input input-readonly"
|
||||
maxlength="3"
|
||||
disabled="disabled">
|
||||
<span class="separator">-</span>
|
||||
<input type="text"
|
||||
th:value="${parts != null and parts.length > 1 ? parts[1] : ''}"
|
||||
th:value="${mobileMiddle}"
|
||||
name="mobileMiddle"
|
||||
class="form-input input-readonly"
|
||||
maxlength="4"
|
||||
disabled="disabled">
|
||||
<span class="separator">-</span>
|
||||
<input type="text"
|
||||
th:value="${parts != null and parts.length > 2 ? parts[2] : ''}"
|
||||
th:value="${mobileLast}"
|
||||
name="mobileLast"
|
||||
class="form-input input-readonly"
|
||||
maxlength="4"
|
||||
@@ -277,14 +283,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 기존 휴대폰 번호 가져오기
|
||||
// 기존 휴대폰 번호 가져오기 (하이픈 없이)
|
||||
const originalPrefix = document.querySelector('[name="mobilePrefix"]').value;
|
||||
const originalMiddle = document.querySelector('[name="mobileMiddle"]').value;
|
||||
const originalLast = document.querySelector('[name="mobileLast"]').value;
|
||||
const originalMobileNumber = `${originalPrefix}-${originalMiddle}-${originalLast}`;
|
||||
const originalMobileNumber = `${originalPrefix}${originalMiddle}${originalLast}`;
|
||||
|
||||
// 새 번호에서도 하이픈 제거하여 비교
|
||||
const newMobileRaw = newMobileNumber.replace(/-/g, '');
|
||||
|
||||
// 동일한 번호인지 체크
|
||||
if (newMobileNumber === originalMobileNumber) {
|
||||
if (newMobileRaw === originalMobileNumber) {
|
||||
customPopups.showAlert("동일한 휴대폰 번호입니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user