From bbd94ec69720486287af9551b30ac47045241639 Mon Sep 17 00:00:00 2001 From: naeyoung123 Date: Sun, 19 Dec 2021 15:39:21 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[FEAT]=20=EC=BB=A4=EB=AE=A4=EB=8B=88?= =?UTF-8?q?=ED=8B=B0=20=EA=B4=80=EB=A0=A8=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20?= =?UTF-8?q?CSS=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/template.js | 4 +- public/images/create.png | Bin 0 -> 153277 bytes public/images/create2.png | Bin 0 -> 157311 bytes public/images/mypage2.png | Bin 0 -> 87933 bytes public/images/mypage3.png | Bin 0 -> 113542 bytes public/images/recommendation.png | Bin 0 -> 157823 bytes public/images/requirement.png | Bin 0 -> 173209 bytes routes/community/create_rec.js | 55 +++++++++++++++++------ routes/community/create_rec_process.js | 2 +- routes/community/create_req.js | 46 +++++++++++++++---- routes/community/create_req_process.js | 4 +- routes/community/main_rec.js | 52 ++++++++++++++++------ routes/community/main_req.js | 59 +++++++++++++++++-------- routes/community/page_rec.js | 48 +++++++++++++++----- routes/community/page_req.js | 48 +++++++++++++++----- routes/mypage/main_mypage.js | 37 ++++++++-------- 16 files changed, 257 insertions(+), 98 deletions(-) create mode 100644 public/images/create.png create mode 100644 public/images/create2.png create mode 100644 public/images/mypage2.png create mode 100644 public/images/mypage3.png create mode 100644 public/images/recommendation.png create mode 100644 public/images/requirement.png diff --git a/lib/template.js b/lib/template.js index e9f296c..8355319 100644 --- a/lib/template.js +++ b/lib/template.js @@ -66,7 +66,7 @@ module.exports = { + `; var html = template.HTML(title, head, body); response.send(html); diff --git a/routes/community/page_rec.js b/routes/community/page_rec.js index 5d50208..791de34 100644 --- a/routes/community/page_rec.js +++ b/routes/community/page_rec.js @@ -9,19 +9,47 @@ router.get('/community/recommendation/page/:pageId', function (request, response db.query(`SELECT * FROM recommendation WHERE id=?`, [pageId], function(err, res){ var title = '추천글보기'; var head = ` - .recommendation_page{ - margin-top:200px; - } - + `; var body = ` -
-
-

제목:${res[0].title}

-
-

내용:${res[0].content}

+
+
+

+
+
+
${res[0].title}
+
+
${res[0].content}
-
+
+
+ `; var html = template.HTML(title, head, body); response.send(html); diff --git a/routes/community/page_req.js b/routes/community/page_req.js index f44292e..45a8969 100644 --- a/routes/community/page_req.js +++ b/routes/community/page_req.js @@ -6,23 +6,49 @@ var path = require('path'); router.get('/community/requirement/page/:pageId', function (request, response) { var pageId = path.parse(request.params.pageId).base; - db.query(`SELECT * FROM requirement WHERE id=?`, [pageId], function(err, res){ + db.query(`SELECT * FROM requirement WHERE id=?`, [pageId], function (err, res) { var title = '건의글보기'; var head = ` - + `; var body = ` -
-
-

제목:${res[0].title}

+
+
+

+
+
+
${res[0].title}

-

내용:${res[0].content}

+
${res[0].content}
-
+
+
`; var html = template.HTML(title, head, body); response.send(html); diff --git a/routes/mypage/main_mypage.js b/routes/mypage/main_mypage.js index 3a62063..1ebdecd 100644 --- a/routes/mypage/main_mypage.js +++ b/routes/mypage/main_mypage.js @@ -11,7 +11,7 @@ router.get('/mypage', function (request, response) { var head = ` - `; - var list_store = ` - 제품 - '${post.search}'에 대한 검색 결과가 없습니다. - `; - var list_rec = ''; - var i = 0; - if(res.length === 0){ - list_rec += ` - 제품추천 - '${post.search}'에 대한 검색 결과가 없습니다. - `; - } else{ - list_rec += ` - 제품추천 - - No. - Title. - Writer - Date - - `; - while(i < res.length) { - list_rec += ` - - ${res[i].id} - - ${res[i].title} - - ${res[i].writer} - ${res[i].date} - - `; - i++; - } - } - var body = ` -
-
- - ${list_store} -
-
- - ${list_rec} -
-
-
- `; - var html = template.HTML(title, head, body); - response.send(html); + db.query(`SELECT * FROM recommendation WHERE content LIKE ? OR title LIKE ?`, ['%' + post.search + '%', '%' + post.search + '%'], function(err, rec){ + db.query(`SELECT * FROM pad WHERE company LIKE ? OR brand LIKE ? OR product LIKE ?`, ['%' + post.search + '%', '%' + post.search + '%', '%' + post.search + '%'], function(err, pad){ + db.query(`SELECT * FROM cpad WHERE company LIKE ? OR product LIKE ?`, ['%' + post.search + '%', '%' + post.search + '%'], function(err, cpad){ + db.query(`SELECT * FROM cup WHERE company LIKE ? OR product LIKE ?`, ['%' + post.search + '%', '%' + post.search + '%'], function(err, cup){ + db.query(`SELECT * FROM tampon WHERE company LIKE ? OR brand LIKE ? OR product LIKE ?`, ['%' + post.search + '%', '%' + post.search + '%', '%' + post.search + '%'], function(err, tampon){ + var title = '검색결과'; + var head = ` + + `; + var list_pad = ''; + if(pad.length === 0){ + list_pad += ` +

'${post.search}'에 대한 검색 결과가 없습니다.

+ `; + } else{ + for(i = 0; i < pad.length; i++) { + list_pad += ` + + `; + } + } + var list_cpad = ''; + if(cpad.length === 0){ + list_cpad += ` +

'${post.search}'에 대한 검색 결과가 없습니다.

+ `; + } else{ + for(i = 0; i < cpad.length; i++) { + list_cpad += ` + + `; + } + } + var list_cup = ''; + if(cup.length === 0){ + list_cup += ` +

'${post.search}'에 대한 검색 결과가 없습니다.

+ `; + } else{ + for(i = 0; i < cup.length; i++) { + list_cup += ` + + `; + } + } + var list_tampon = ''; + if(tampon.length === 0){ + list_tampon += ` +

'${post.search}'에 대한 검색 결과가 없습니다.

+ `; + } else{ + for(i = 0; i < tampon.length; i++) { + list_tampon += ` + + `; + } + } + var list_rec = ''; + if(rec.length === 0){ + list_rec += ` +

제품추천

+

'${post.search}'에 대한 검색 결과가 없습니다.

+ `; + } else{ + list_rec += ` + 제품추천 + + No. + Title. + Writer + Date + + `; + for(i = 0; i < rec.length; i++) { + list_rec += ` + + ${rec[i].id} + + ${rec[i].title} + + ${rec[i].writer} + ${rec[i].date} + + `; + } + } + var body = ` +
+
+ +

+
+
+
+

일회용 월경대

+ ${list_pad} +
+

+
+

면 월경대

+ ${list_cpad} +
+

+
+

월경컵

+ ${list_cup} +
+

+
+

탐폰

+ ${list_tampon} +
+

+
+ + ${list_rec} +
+
+
+
+ +
+
+ `; + var html = template.HTML(title, head, body); + response.send(html); + }) + }) + }) + }) }) }) }); From efe1fafdd90f7f2c1fa848a415841a583c9059f3 Mon Sep 17 00:00:00 2001 From: naeyoung123 Date: Sun, 19 Dec 2021 23:01:10 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[FEAT]=20=EC=B6=94=EC=B2=9C=20=EC=95=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=A6=98=20URL=20=EC=97=B0=EA=B2=B0,=20=20si?= =?UTF-8?q?gnup.html=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 93 ++++++++++++- routes/prod_rec/qna.js | 73 ++++++++++ routes/prod_rec/question.js | 163 ++++++++++++++++++++++ routes/prod_rec/start.js | 49 +++++++ signup.html | 270 ------------------------------------ 5 files changed, 375 insertions(+), 273 deletions(-) create mode 100644 routes/prod_rec/qna.js create mode 100644 routes/prod_rec/question.js create mode 100644 routes/prod_rec/start.js delete mode 100644 signup.html diff --git a/package-lock.json b/package-lock.json index b7315e8..b9f1f6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1365,6 +1365,11 @@ "precond": "0.2" } }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1419,6 +1424,15 @@ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==" }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "bson": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", @@ -1604,6 +1618,11 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, "configure": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/configure/-/configure-0.0.1.tgz", @@ -1828,6 +1847,11 @@ "streamsearch": "0.1.2" } }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, "dom-serializer": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", @@ -2150,6 +2174,11 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==" }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2275,6 +2304,11 @@ "resolved": "https://registry.npmjs.org/fs-capacitor/-/fs-capacitor-2.0.4.tgz", "integrity": "sha512-8S4f4WsCryNw2mJJchi46YgB6CR5Ze+4L1h8ewl9tEpL4SJ3ZO+c/bS4BWhB8bK+O3TMqhuZarTitd0S0eh2pA==" }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, "ftp": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", @@ -2416,6 +2450,19 @@ "git-up": "^1.0.0" } }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "got": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/got/-/got-5.7.1.tgz", @@ -2744,6 +2791,15 @@ "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", "integrity": "sha1-ogCTVlbW9fa8TcdQLhrstwMihBY=" }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -3432,6 +3488,14 @@ "mime-db": "1.51.0" } }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", @@ -5612,6 +5676,11 @@ "tslib": "^2.0.3" } }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -6131,9 +6200,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sanitize-html": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.5.3.tgz", - "integrity": "sha512-DGATXd1fs/Rm287/i5FBKVYSBBUL0iAaztOA1/RFhEs4yqo39/X52i/q/CwsfCUG5cilmXSBmnQmyWfnKhBlOg==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.6.1.tgz", + "integrity": "sha512-DzjSz3H5qDntD7s1TcWCSoRPmNR8UmA+y+xZQOvWgjATe2Br9ZW73+vD3Pj6Snrg0RuEuJdXgrKvnYuiuixRkA==", "requires": { "deepmerge": "^4.2.2", "escape-string-regexp": "^4.0.0", @@ -6199,6 +6268,14 @@ "send": "0.17.1" } }, + "session": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/session/-/session-0.1.0.tgz", + "integrity": "sha1-aumqbyYJO+Me0gBbzUJq6AqjoIU=", + "requires": { + "vows": "*" + } + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -6825,6 +6902,16 @@ } } }, + "vows": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/vows/-/vows-0.8.3.tgz", + "integrity": "sha512-PVIxa/ovXhrw5gA3mz6M+ZF3PHlqX4tutR2p/y9NWPAaFVKcWBE8b2ktfr0opQM/qFmcOVWKjSCJVjnYOvjXhw==", + "requires": { + "diff": "^4.0.1", + "eyes": "~0.1.6", + "glob": "^7.1.2" + } + }, "which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", diff --git a/routes/prod_rec/qna.js b/routes/prod_rec/qna.js new file mode 100644 index 0000000..352c5ea --- /dev/null +++ b/routes/prod_rec/qna.js @@ -0,0 +1,73 @@ +var express = require('express'); +const db = require('../../db.js'); +var router = express.Router(); +var template = require('../../lib/template.js'); + +router.get('/prod_rec/qna', function (request, response) { + var title = 'For me 나를 위해'; + var head = ` + + + + + + + `; + var body = ` +
+
+
+
+

나에게 딱맞는 월경용품 찾기

+
+ mainImage +
+

+ 시작하기 버튼을 눌러 시작해 주세요. +

+ +
+
+
+
+
+
+
+
+
+
+
+
+

나에게 딱맞는 월경용품 찾기

+
+ mainImage +
+
+ + +
+ +
+ + +
`; + +var html = template.HTML(title, head, body); +response.send(html); +}); + +module.exports = router; diff --git a/routes/prod_rec/question.js b/routes/prod_rec/question.js new file mode 100644 index 0000000..55b4dc6 --- /dev/null +++ b/routes/prod_rec/question.js @@ -0,0 +1,163 @@ +const QnAList = [{ + q: '월경이 규칙적인가요?', + a: [{ + answer: '예', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '아니오', + type: ['pad', 'tampon'] + }, + { + answer: '잘 모르겠어요', + type: ['pad', 'cotton', 'tampon'] + } + ] + }, + + { + q: '월경통이 어느 정도로 심각한가요?', + a: [{ + answer: '거의 없어요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '보통이에요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '심한 편이에요', + type: ['cotton', 'tampon'] + }, + { + answer: '아주 심해요', + type: ['cotton', 'cup'] + } + ] + }, + + { + q: '월경시 Y존 민감 증상(쓰라림, 가려움 등)이 있나요?', + a: [{ + answer: '거의 없어요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '보통이에요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '심한 편이에요', + type: ['cup', 'cotton', 'tampon'] + }, + { + answer: '아주 심해요', + type: ['cup', 'tampon'] + } + ] + }, + + { + q: '월경시 활동량은 많은 편인가요?', + a: [{ + answer: '거의 움직이지 않는 편이에요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '보통이에요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '매우 활발한 편이에요', + type: ['cup', 'tampon'] + } + ] + }, + + { + q: '구매에 대한 생각이 궁금해요!', + a: [{ + answer: '언제 어디서든 쉽게 구할 수 있었으면 좋겠어요', + type: ['pad'] + }, + { + answer: '인터넷에서 사서 상관없어요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '매달 구매하는 과정이 귀찮아요', + type: ['cotton', 'cup'] + } + ] + }, + + { + q: '유기농 제품에 대한 생각이 궁금해요', + a: [{ + answer: '잘 모르고 관심없어요', + type: ['pad', 'tampon'] + }, + { + answer: '관심은 있는 데 찾아서 사용하진 않아요', + type: ['pad', 'cotton', 'cup', 'tampon'] + }, + { + answer: '찾아서 사용하고 있어요', + type: ['pad', 'cotton', 'cup'] + } + ] + }, + + { + q: '월경용품을 사용하면서 가장 불편한 점은 무엇인가요?', + a: [{ + answer: '쓰레기가 너무 많이 나와요', + type: ['cotton', 'cup'] + }, + { + answer: '장시간 외출 시 사용이 불편해요', + type: ['pad', 'tampon'] + }, + { + answer: '판매하는 제품이 다양하지 않아요', + type: ['pad'] + } + ] + }, + + { + q: '삽입형 월경용품에 대한 거부감이 있나요?', + a: [{ + answer: '네 거부감이 있어요', + type: ['pad', 'cotton'] + }, + { + answer: '아뇨 없어요', + type: ['cup', 'tampon'] + }, + { + answer: '잘 모르겠어요', + type: ['pad', 'cup', 'cotton', 'tampon'] + } + ] + } +] + + +const infoList = [{ + name: '클래식 이즈 더 베스트 <일회용 월경대>', + desc: '가장 많은 사람들이 사용하고 있는 제품군이예요. 판매하는 제품군이 다양하고 언제 어디서나 쉽게 구할 수 있다는 게 큰 장점이에요.' + }, + { + name: ' <면 월경대>', + desc: '' + }, + { + name: '<월경컵>', + desc: '월경계의 신문물 월경컵! 활동이 많은 날도 사용할 수 있어요. 재사용이 가능하고 세척도 쉬운 편 ' + }, + { + name: ' <탐폰>', + desc: '활동이 많은 날에도 샘걱정 없이 사용할 수 있어요! 8시간 이상 사용은 권하지 않아요.' + } +] \ No newline at end of file diff --git a/routes/prod_rec/start.js b/routes/prod_rec/start.js new file mode 100644 index 0000000..84b06d8 --- /dev/null +++ b/routes/prod_rec/start.js @@ -0,0 +1,49 @@ +const main = document.querySelector("#main"); +const qna = document.querySelector("#qna"); +const endPoint = 7; + +function addAnswer(answerText, qIdx) { + var a = document.querySelector('.answerBox'); + var answer = document.createElement('button'); + answer.classList.add('answerList'); + a.appendChild(answer); + answer.innerHTML = answerText; + + answer.addEventListener("click", function () { + var children = document.querySelectorAll('.answerList'); + for (let i = 0; i < children.length; i++) { + children[i].disabled = true; + children[i].style.display = 'none'; + } + goNext(++qIdx); + }, false); + +} + +function goNext(qIdx) { + if (++qIdx === endPoint) { + goResult() + } + var q = document.querySelector('.qBox'); + q.innerHTML = QnAList[qIdx].q; + for (let i in QnAList[qIdx].a) { + addAnswer(QnAList[qIdx].a[i].answer, qIdx); + } + var status = document.querySelector('.statusBar'); + status.style.width = (100 / endPoint) * (qIdx + 1) + '%'; +} + +function begin() { + main.style.WebitAnimation = "fadeOut 1s"; + main.style.animation = "fadeOut 1s"; + setTimeout(() => { + qna.style.WebitAnimation = "fadeIn 1s"; + qna.style.animation = "fadeIn 1s"; + setTimeout(() => { + main.style.display = "none"; + qna.style.display = "block"; + }, 450) + let qIdx = 0; + goNext(qIdx); + }, 450); +} \ No newline at end of file diff --git a/signup.html b/signup.html deleted file mode 100644 index c9f137c..0000000 --- a/signup.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - 회원가입 - - - - - - - -
- -
- -
-


- -
-
- -
-

Email

- -
-

Password

- -
- -

Nickname

- -
- For me 정책에 동의합니다.
- -

───────────── OR ─────────────

-

Already have a account? Log in

-
-
-
-
- - - \ No newline at end of file From 440e28f27caccdd93a40085a785351063d8efca1 Mon Sep 17 00:00:00 2001 From: jeayoungKim529 Date: Mon, 20 Dec 2021 01:10:07 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[FEAT]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8/?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 16 ++++++++++++++++ lib/author.js | 16 ++++++++++++++++ lib/template.js | 4 ++-- routes/login.js | 7 +++---- routes/login_process.js | 34 ++++++++++++++++++++++++++++++++++ routes/logout_process.js | 21 +++++++++++++++++++++ routes/main.js | 3 ++- routes/signup_process.js | 17 ++++++++++------- 8 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 lib/author.js create mode 100644 routes/login_process.js create mode 100644 routes/logout_process.js diff --git a/app.js b/app.js index 4decc57..6fc1add 100644 --- a/app.js +++ b/app.js @@ -3,8 +3,12 @@ const fs = require('fs'); const url = require('url'); const path = require('path'); const db = require('./db.js'); +const session = require('express-session'); + const mainRouter = require('./routes/main.js'); const loginRouter = require('./routes/login.js'); +const loginProcessRouter = require('./routes/login_process.js'); +const logoutProcessRouter = require('./routes/logout_process.js'); const signupRouter = require('./routes/signup.js'); const signupProcessRouter = require('./routes/signup_process.js'); @@ -43,7 +47,19 @@ app.use(express.static('public')); app.use('/', mainRouter); +app.use(express.static('public')); +app.use(session({ + key:'my key', + secret: 'secret', + resave: false, + saveUninitialize: true, + cookie:{ + maxAge: 60 * 60 * 24 * 1 + } +})); app.get('/login', loginRouter); +app.post('/login_process',loginProcessRouter); +app.get('/logout_process',logoutProcessRouter); app.get('/signup', signupRouter); app.post('/signup_process', signupProcessRouter); diff --git a/lib/author.js b/lib/author.js new file mode 100644 index 0000000..39cfc5b --- /dev/null +++ b/lib/author.js @@ -0,0 +1,16 @@ +module.exports = { + isOwner:function(request, response) { + if (request.session.is_logined) { + return true; + } else { + return false; + } + }, + statusUI:function(request, response) { + var authStatusUI = '로그인' + if (this.isOwner(request, response)) { + authStatusUI = `| 로그아웃`; + } + return authStatusUI; + } +} \ No newline at end of file diff --git a/lib/template.js b/lib/template.js index 8355319..897c9e4 100644 --- a/lib/template.js +++ b/lib/template.js @@ -1,5 +1,5 @@ module.exports = { - HTML: function (title, head, body) { + HTML: function (title, head, body, authStatusUI = '로그인') { return ` @@ -83,7 +83,7 @@ module.exports = {