merge master into develop - CscListRForm.jsp FAQ 아코디언 버그 수정

This commit is contained in:
jilee4unity
2026-05-28 23:34:06 +09:00
7250 changed files with 570509 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,216 @@
let bnfInnb = "";
// StepcntSettings.js - 만보기 설정 관련 스크립트
$(document).ready(function() {
// bnfInnb 값 가져오기
bnfInnb = $("#bnfInnb").val();
console.log("bnfInnb ::: ", bnfInnb);
// 1. 초기 로딩 시 만보기 동의 여부 확인
checkStepcntAgreement();
// 2. 이벤트 설명 로딩
loadEventDescription();
// 3. 토글 스위치 이벤트 리스너 등록
$("#stepcntUseYn").on("change", function() {
updateStepcntAgreement($(this).is(":checked") ? "Y" : "N");
});
});
/**
* 현재 만보기 동의 상태 확인
*/
function checkStepcntAgreement() {
$.ajax({
url: "/sopmal/bnft/checkCurrentStepcntAgreement",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
bnfInnb: bnfInnb
}),
success: function(response) {
try {
// 응답 파싱
const resultData = response.resBody ? JSON.parse(response.resBody.result) : response;
// 응답이 정상이고 데이터가 존재하는 경우
if (response.statusCode === 0 && resultData) {
// 동의 상태에 따라 토글 스위치 설정
const useAt = resultData.useAt === "Y";
$("#stepcntUseYn").prop("checked", useAt);
} else {
// 기본값으로 체크 해제
$("#stepcntUseYn").prop("checked", false);
console.error("만보기 동의 상태 조회 실패:", response);
showToast("만보기 동의 상태 조회 중 오류가 발생했습니다.");
}
} catch (e) {
console.error("응답 파싱 오류:", e);
$("#stepcntUseYn").prop("checked", false);
showToast("만보기 동의 상태 조회 중 오류가 발생했습니다.");
}
},
error: function(xhr, status, error) {
console.error("AJAX 오류:", error);
showToast("만보기 동의 상태 조회 중 오류가 발생했습니다.");
}
});
}
/**
* 만보기 동의 상태 업데이트
* @param {string} agreeYn - 동의 여부 (Y/N)
*/
function updateStepcntAgreement(agreeYn) {
$.ajax({
url: "/sopmal/bnft/updateStepcntAgreement",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
agreeYn: agreeYn,
bnfInnb: bnfInnb
}),
success: function(response) {
try {
// 응답 파싱
const resultData = response.resBody ? JSON.parse(response.resBody.result) : response;
// 응답이 정상인 경우
if (response.statusCode === 0) {
// 성공 메시지 표시
if (agreeYn === "Y") {
showToast("만보기 기능이 활성화되었습니다.");
} else {
showToast("만보기 기능이 비활성화되었습니다.");
}
} else {
// 실패 시 토글 상태 되돌리기
$("#stepcntUseYn").prop("checked", agreeYn !== "Y");
console.error("만보기 동의 상태 업데이트 실패:", response);
showToast("만보기 설정 변경 중 오류가 발생했습니다.");
}
} catch (e) {
// 오류 발생 시 토글 상태 되돌리기
$("#stepcntUseYn").prop("checked", agreeYn !== "Y");
console.error("응답 파싱 오류:", e);
showToast("만보기 설정 변경 중 오류가 발생했습니다.");
}
},
error: function(xhr, status, error) {
// 오류 발생 시 토글 상태 되돌리기
$("#stepcntUseYn").prop("checked", agreeYn !== "Y");
console.error("AJAX 오류:", error);
showToast("만보기 설정 변경 중 오류가 발생했습니다.");
}
});
}
/**
* 토스트 메시지 표시
* @param {string} message - 표시할 메시지
*/
function showToast(message) {
// 토스트 요소가 없으면 동적으로 생성
if ($("#toastPop").length === 0) {
$("body").append('<div id="toastPop" class="toastPop"><p></p></div>');
}
$('#toastPop p').text(message);
$('#toastPop').addClass('show');
// 2초 후 토스트 메시지 숨김
setTimeout(function() {
$('#toastPop').removeClass('show');
}, 2000);
}
/**
* 이벤트 설명만 별도로 로딩하는 함수
*/
function loadEventDescription() {
console.log("loadEventDescription 함수 시작");
$.ajax({
url: "/sopmal/bnft/selectStepcntGuide",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
bnfInnb: bnfInnb
}),
success: function(response) {
console.log("loadEventDescription 응답:", response);
try {
// 응답이 정상이고 resBody와 result가 존재하는 경우
if (response.statusCode === 0 && response.resBody && response.resBody.result) {
console.log("응답 상태 정상, result 파싱 시작");
// result를 JSON으로 파싱
const resultData = JSON.parse(response.resBody.result);
console.log("파싱된 resultData:", resultData);
if (resultData && resultData.bnfWordsCn) {
console.log("bnfWordsCn 데이터 존재:", resultData.bnfWordsCn);
// comment-box 요소 확인
const commentBox = $(".comment-box");
console.log("comment-box 요소 찾기:", commentBox.length);
if (commentBox.length > 0) {
// comment-box에 이벤트 설명 표시
const htmlContent = `
<p style="font-size:14px; font-weight:bold; margin-bottom:5px;">이벤트 설명</p>
<p style="color:rgba(0,0,0,0.6); font-size:14px;">${resultData.bnfWordsCn}</p>
`;
console.log("설정할 HTML 내용:", htmlContent);
commentBox.html(htmlContent);
console.log("comment-box 내용 설정 완료");
} else {
console.error("comment-box 요소를 찾을 수 없습니다");
}
} else {
console.log("bnfWordsCn 데이터가 없어서 기본 설명 표시");
showDefaultDescription();
}
} else {
console.log("응답 상태 오류 또는 데이터 없음, 기본 설명 표시");
showDefaultDescription();
}
} catch (e) {
console.error("이벤트 설명 파싱 오류:", e);
showDefaultDescription();
}
},
error: function(xhr, status, error) {
console.error("이벤트 설명 조회 오류:", error);
showDefaultDescription();
}
});
}
/**
* 기본 이벤트 설명 표시
*/
function showDefaultDescription() {
$(".comment-box").html(`
<p style="font-size:14px; font-weight:bold; margin-bottom:5px;">이벤트 설명</p>
<div style="font-size:13px; line-height:1.4; color:#666;">
만보기 이벤트에 참여하여 다양한 혜택을 받아보세요!<br>
매일 만보를 달성하시면 마일리지와 깜짝선물을 받을 수 있습니다.
</div>
`);
}
/**
* 세션에서 bnfInnb 값을 가져오는 함수 (필요시)
*/
function getBnfInnb() {
// 세션 저장소나 다른 방법으로 bnfInnb 값을 가져오는 로직
// 현재는 서버에서 자동으로 세션 값을 사용하므로 빈 값으로 처리
return null;
}