diff --git a/dist/assets/images/affiliates04.png b/dist/assets/images/affiliates04.png new file mode 100644 index 0000000..39c5b7c Binary files /dev/null and b/dist/assets/images/affiliates04.png differ diff --git a/dist/assets/images/affiliates12.png b/dist/assets/images/affiliates12.png new file mode 100644 index 0000000..f5be46e Binary files /dev/null and b/dist/assets/images/affiliates12.png differ diff --git a/dist/index.html b/dist/index.html index f65b7b2..4b93c1c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -502,28 +502,28 @@
- 기업명 - + 기업명 (필수) +
- 담당자명 - + 담당자명 (필수) +
연락처 (필수)
- 이메일 - + 이메일 (필수) +
예산범위
- 문의내용 - + 문의내용 (필수) +
@@ -636,12 +636,15 @@ $(this).focus(); return; } + else { + $(this).val(transNum) + } }); $('body').on('blur', '[data-regex="email-address"]', function(e){ if($(this).val() == '') return; var trans_num = $(this).val().regex('email'); - + console.log(trans_num) if(! trans_num) { alert('유효하지 않은 이메일주소 입니다.'); $(this).val(""); @@ -652,7 +655,6 @@ $('[data-form="request-form"]').on('submit',function(e) { e.preventDefault(); - if($('[name="type"]:checked').length === 0) { alert("상담 분야를 선택하세요"); return; @@ -683,8 +685,10 @@ alert("상담 신청이 완료되었습니다.") $('[data-form="request-form"]').reset() }, - error: function() { - alert("상담 신청도중 오류가 잘생하였습니다.") + error: function(err) { + var message = err?.responseJSON?.error ?? "상담 신청도중 오류가 발생하였습니다.\\n서버 관리자에게 문의하세요" + alert(message) + } }) }) diff --git a/src-server/email.ts b/src-server/email.ts index bd2f0c3..1041042 100644 --- a/src-server/email.ts +++ b/src-server/email.ts @@ -14,7 +14,8 @@ export const sendEmail = async (subject: string, text: string) => { const mailOptions = { from: "support@wheeparam.com", - to : "songwritersg@naver.com", + //to: "songwritersg@naver.com", + to : "whee0716@gmail.com", subject, text, }; diff --git a/src-server/server.ts b/src-server/server.ts index ef1514a..22fa00c 100644 --- a/src-server/server.ts +++ b/src-server/server.ts @@ -29,12 +29,38 @@ app.post("/request", async (req: Request, res: Response) => { contents } = await req.body; + if(company_name.trim().length === 0) { + res.status(400).json({ error: "기업명을 입력하셔야 합니다." }); + return + } + + if(manager_name.trim().length === 0) { + res.status(400).json({ error: "담당자명을 입력하셔야 합니다." }); + return + } + + if(type.trim().length === 0) { + res.status(400).json({ error: "상담 분야를 입력하셔야 합니다." }); + return + } - if (!email || !contents) { - res.status(400).json({ error: "모든 필드가 필요합니다." }); + if(phone.trim().length === 0) { + res.status(400).json({ error: "연락처를 입력하셔야 합니다." }); return } + if(email.trim().length === 0) { + res.status(400).json({ error: "이메일 주소를 입력하셔야 합니다." }); + return + } + + + if(contents.trim().length === 0) { + res.status(400).json({ error: "문의 내용을 입력하셔야 합니다." }); + return + } + + try { await sendEmail(`${type} 문의`, ` 문의 유형: ${type} diff --git a/src/html/index.html b/src/html/index.html index df1744a..adef68e 100644 --- a/src/html/index.html +++ b/src/html/index.html @@ -412,28 +412,28 @@
- 기업명 - + 기업명 (필수) +
- 담당자명 - + 담당자명 (필수) +
연락처 (필수)
- 이메일 - + 이메일 (필수) +
예산범위
- 문의내용 - + 문의내용 (필수) +
@@ -546,12 +546,15 @@ $(this).focus(); return; } + else { + $(this).val(transNum) + } }); $('body').on('blur', '[data-regex="email-address"]', function(e){ if($(this).val() == '') return; var trans_num = $(this).val().regex('email'); - + console.log(trans_num) if(! trans_num) { alert('유효하지 않은 이메일주소 입니다.'); $(this).val(""); @@ -562,7 +565,6 @@ $('[data-form="request-form"]').on('submit',function(e) { e.preventDefault(); - if($('[name="type"]:checked').length === 0) { alert("상담 분야를 선택하세요"); return; @@ -593,8 +595,10 @@ alert("상담 신청이 완료되었습니다.") $('[data-form="request-form"]').reset() }, - error: function() { - alert("상담 신청도중 오류가 잘생하였습니다.") + error: function(err) { + var message = err?.responseJSON?.error ?? "상담 신청도중 오류가 발생하였습니다.\\n서버 관리자에게 문의하세요" + alert(message) + } }) })