Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대철
/
CafeRecommend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최정민
2021-05-28 03:25:10 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
62b1bdfac6fb0367aa79e820723247ab94bafd4a
62b1bdfa
1 parent
e2e06e4b
CHORE : 페이지 디자인 수정
-
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
27 deletions
routes/index.js
sessions/tbg8ejYW80RsSgS8AydKQN4v1HdbjBUn.json
views/login.ejs
views/review.ejs
routes/index.js
View file @
62b1bdf
...
...
@@ -86,21 +86,38 @@ router.get("/login", checkAuthenticated, (req, res) => {
});
router
.
post
(
"/login"
,
(
req
,
res
)
=>
{
console
.
log
(
"구글로그인 성공"
);
//입력을 다하였는지
if
(
!
req
.
body
.
nickname
||
!
req
.
body
.
age
||
!
req
.
body
.
gender
||
!
req
.
body
.
price
||
!
req
.
body
.
kindness
||
!
req
.
body
.
accessibility
){
console
.
log
(
"입력받지 않은 데이터 존재"
);
return
res
.
render
(
"login"
,
{
user
:
req
.
session
.
user
,
message
:
"need data"
,
});
}
var
set
=
new
Set
([
req
.
body
.
price
,
req
.
body
.
accessibility
,
req
.
body
.
kindness
,
req
.
body
.
noise
]);
//db에 동일 닉네임있는지 검사(닉네임은 유일해야함)
var
sql
=
" SELECT * FROM USER WHERE NICKNAME=?"
;
var
parameter
=
[
req
.
body
.
nickname
];
connection
.
query
(
sql
,
parameter
,
function
(
err
,
row
)
{
if
(
err
)
{
console
.
log
(
err
);
}
if
(
row
.
length
>
0
)
{
else
if
(
row
.
length
>
0
)
{
console
.
log
(
"동일 닉네임있음"
);
return
res
.
render
(
"login"
,
{
user
:
req
.
session
.
user
,
message
:
"same nickname"
,
});
}
else
{
}
//중복순위제
else
if
(
set
.
size
!=
4
){
console
.
log
(
"중복된 순위 존재"
);
return
res
.
render
(
"login"
,
{
user
:
req
.
session
.
user
,
message
:
"wrong preference"
,
});
}
else
{
req
.
session
.
user
.
nickname
=
req
.
body
.
nickname
;
req
.
session
.
user
.
age
=
req
.
body
.
age
;
req
.
session
.
user
.
gender
=
req
.
body
.
gender
;
...
...
@@ -109,24 +126,40 @@ router.post("/login", (req, res) => {
req
.
session
.
user
.
noise
=
req
.
body
.
noise
;
req
.
session
.
user
.
accessibility
=
req
.
body
.
accessibility
;
var
sql
=
"INSERT INTO USER(EMAIL,NICKNAME, AGE, GENDER
, PICTURE, KINDNESS, NOISE, ACCESSIBILITY) VALUES(?,?,?,?,
?,?,?,?)"
;
"INSERT INTO USER(EMAIL,NICKNAME, AGE, GENDER
) VALUES(
?,?,?,?)"
;
var
parameter
=
[
req
.
session
.
user
.
email
,
req
.
session
.
user
.
nickname
,
req
.
session
.
user
.
age
,
req
.
session
.
user
.
gender
,
];
connection
.
query
(
sql
,
parameter
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
return
res
.
render
(
"/"
);
}
else
{
console
.
log
(
"새로운 user데이터 입력"
);
}
});
var
sql2
=
"INSERT INTO PREFERENCE(NICKNAME, PRICE, KINDNESS, NOISE, ACCESSIBILITY) VALUES(?,?,?,?,?)"
;
var
parameter2
=
[
req
.
session
.
user
.
nickname
,
req
.
session
.
user
.
price
,
req
.
session
.
user
.
kindness
,
req
.
session
.
user
.
noise
,
req
.
session
.
user
.
accessibility
];
connection
.
query
(
sql
,
parameter
,
function
(
err
)
{
connection
.
query
(
sql
2
,
parameter2
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
return
res
.
render
(
"/"
);
}
else
{
console
.
log
(
"새로운 user데이터 입력"
);
console
.
log
(
"새로운 PREFERENCE데이터 입력"
);
}
});
return
res
.
render
(
"map"
,
{
user
:
req
.
session
.
user
});
}
});
...
...
@@ -159,6 +192,15 @@ router.get("/logout", function (req, res) {
res
.
redirect
(
"/"
);
});
router
.
get
(
"/map"
,
function
(
req
,
res
,
next
){
if
(
req
.
session
.
user
)
{
res
.
render
(
"map"
,
{
user
:
req
.
session
.
user
});
}
else
{
res
.
render
(
"/"
)
}
})
router
.
get
(
"/review/:cafeId"
,
function
(
req
,
res
)
{
const
cafeId
=
req
.
params
.
cafeId
;
res
.
render
(
"review"
,
{
cafeId
:
cafeId
});
...
...
@@ -200,4 +242,5 @@ router.post("/review", function (req, res) {
);
});
module
.
exports
=
router
;
...
...
sessions/tbg8ejYW80RsSgS8AydKQN4v1HdbjBUn.json
View file @
62b1bdf
{
"cookie"
:{
"originalMaxAge"
:
null
,
"expires"
:
null
,
"httpOnly"
:
true
,
"path"
:
"/"
},
"__lastAccess"
:
1622135361726
,
"user"
:{
"email"
:
"cjm104174@gmail.com"
,
"picture"
:
"https://lh3.googleusercontent.com/a-/AOh14Gh3nytGsPbviGhkznR8HIwrL6o7xBIoFL08nIeU=s96-c"
,
"nickname"
:
"cjm"
,
"age"
:
"19"
,
"gender"
:
"male"
,
"price"
:
"1"
,
"kindness"
:
"2"
,
"noise"
:
"3"
,
"accessibility"
:
"4"
}}
\ No newline at end of file
{
"cookie"
:{
"originalMaxAge"
:
null
,
"expires"
:
null
,
"httpOnly"
:
true
,
"path"
:
"/"
},
"__lastAccess"
:
1622139888672
,
"user"
:{
"email"
:
"cjm104174@gmail.com"
,
"picture"
:
"https://lh3.googleusercontent.com/a-/AOh14Gh3nytGsPbviGhkznR8HIwrL6o7xBIoFL08nIeU=s96-c"
,
"nickname"
:
"Mayf"
,
"age"
:
25
,
"gender"
:
"male"
}}
\ No newline at end of file
...
...
views/login.ejs
View file @
62b1bdf
...
...
@@ -89,13 +89,14 @@
<hr
class=
"my-2"
style=
"background-color: white"
>
<div
class=
"pricing-header px-3 py-1 pt-md-3 pb-md-1 mx-auto text-center"
>
<h5
class=
"display- "
>
PREFERENCE
</h5>
<hr
class=
"my-1"
style=
"background-color: white"
>
<p>
카페를 선택할 떄 중요하게 여기는 요소들의 순위를 매겨주세요.
</p>
<p>
(순위가 중복되면 안됩니다. ex) 가격 1순위, 친절 1순위(X)
</p>
<p>
[ 순위가 중복되면 안됩니다. ex) 가격 1순위, 친절 1순위(X) ]
</p>
</div>
<div
class=
"text-center"
>
<label
for=
"price_form"
class=
"form-label font-weight-bold"
style=
"margin-right: 15px"
>
가격
</label>
<div
class=
"form-check form-check-inline"
id=
"price_form"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"price"
id=
"price1"
value=
"1"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"price"
id=
"price1"
value=
"1"
checked
>
<label
class=
"form-check-label"
for=
"price1"
>
1순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
...
...
@@ -118,7 +119,7 @@
<label
class=
"form-check-label"
for=
"kindness"
>
1순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"kindness"
id=
"kindness2"
value=
"2"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"kindness"
id=
"kindness2"
value=
"2"
checked
>
<label
class=
"form-check-label"
for=
"kindness2"
>
2순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
...
...
@@ -132,7 +133,7 @@
<hr
class=
"my-1"
style=
"background-color: white"
/>
<label
for=
"noise_form"
class=
"form-label font-weight-bold"
style=
"margin-right: 15px"
>
소
</label>
<label
for=
"noise_form"
class=
"form-label font-weight-bold"
style=
"margin-right: 15px"
>
소
음
</label>
<div
class=
"form-check form-check-inline"
id=
"noise_form"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"noise"
id=
"noise1"
value=
"1"
>
<label
class=
"form-check-label"
for=
"noise"
>
1순위
</label>
...
...
@@ -142,7 +143,7 @@
<label
class=
"form-check-label"
for=
"kindness2"
>
2순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"noise"
id=
"noise3"
value=
"3"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"noise"
id=
"noise3"
value=
"3"
checked
>
<label
class=
"form-check-label"
for=
"noise3"
>
3순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
...
...
@@ -166,7 +167,7 @@
<label
class=
"form-check-label"
for=
"accessibility3"
>
3순위
</label>
</div>
<div
class=
"form-check form-check-inline"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"accessibility"
id=
"accessibility4"
value=
"4"
>
<input
class=
"form-check-input"
type=
"radio"
name=
"accessibility"
id=
"accessibility4"
value=
"4"
checked
>
<label
class=
"form-check-label"
for=
"accessibility4"
>
4순위
</label>
</div>
</div>
...
...
@@ -186,6 +187,24 @@
);
</script>
<
%}%>
<
%if (message=='need data'){%>
<script
type=
"text/javascript"
>
alert
(
"입력하시지 않은 정보가 있습니다."
+
"모든 정보를 입력해주시길 바라겠습니다."
);
</script>
<
%}%>
<
%if (message=='wrong preference'){%>
<script
type=
"text/javascript"
>
alert
(
"중복된 선호도 순위가 있습니다."
+
"순위를 겹치지 않게해주세요(ex 1 3 2 4)"
);
</script>
<
%}%>
</body>
<script>
function
signOut
()
{
...
...
views/review.ejs
View file @
62b1bdf
...
...
@@ -35,19 +35,25 @@
</style>
</head>
<body>
<nav
class=
"navbar navbar-expand-lg navbar-dark bg-dark"
>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
</nav>
<nav
class=
"navbar navbar-expand-lg navbar-dark bg-dark"
>
<a
class=
"navbar-brand"
href=
"/"
><img
src=
"/images/home.png"
width=
"40"
height=
"40"
alt=
""
/>
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<a
class=
"navbar-brand"
href=
"/"
><strong>
Home
</strong></a>
</div>
</nav>
<div
class=
"pricing-header px-3 py-1 pt-md-3 pb-md-1 mx-auto text-center"
>
<h3
class=
"display-6 font-weight-bold"
>
후기 등록
</h3>
...
...
@@ -117,4 +123,6 @@
</div>
</section>
</body>
<script
src=
"/javascripts/bootstrap.js"
></script>
<script
src=
"https://code.jquery.com/jquery-3.1.1.min.js"
></script>
</html>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment