-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10 review errer(The given id must not be null!)
- Loading branch information
Showing
9 changed files
with
279 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
body, html { | ||
padding: 0; | ||
width: 400px; height: 400px; | ||
} | ||
|
||
div#review { | ||
width: 400px; height: 400px; | ||
} | ||
|
||
table { | ||
width: 400px; height: 400px; | ||
border-collapse: collapse; | ||
} | ||
|
||
tr { | ||
display: flex; | ||
} | ||
|
||
th { | ||
width: 100%; | ||
text-align: left; | ||
padding: 5px; | ||
} | ||
|
||
td { | ||
width: 100%; | ||
padding: 5px; | ||
} | ||
|
||
div.bg { | ||
display: flex; | ||
background-image: url("/img/grade_big.png"); | ||
background-size: 150px 30px; | ||
background-repeat: no-repeat; | ||
width: 150px; height: 30px; | ||
overflow: hidden; | ||
} | ||
|
||
div.star { | ||
cursor: pointer; | ||
opacity: 0; | ||
background-image: url("/img/star_one.png"); | ||
background-repeat: no-repeat; | ||
width: 30px; height: 30px; | ||
overflow: hidden; | ||
} | ||
|
||
div.star.hover { | ||
opacity: 1.0; | ||
} | ||
|
||
div.star.fixed { | ||
opacity: 1.0; | ||
} | ||
|
||
input[type=text] { | ||
outline: 0; | ||
width: 100%; | ||
padding: 5px; | ||
} | ||
|
||
textarea { | ||
outline: 0; | ||
width: 100%; | ||
padding: 5px; | ||
resize: none; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
$(document).ready(function() { | ||
var popX = window.outerWidth/2 - 225; | ||
var popY = window.outerHeight/2 - 225; | ||
//리뷰작성 버튼 | ||
$(document).on("click", ".btn.review", function(e) { | ||
let productNo = e.target.dataset.productnum; | ||
let productName = e.target.dataset.productname; | ||
let property = "width=450, height=450"; | ||
let a ='status=no, height=' + 450 + ', width=' + 450 + ', left='+ popX + ', top='+ popY | ||
window.open("/writereview?productNo="+productNo+"&productName="+productName, 'review', a); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
$(document).ready(function() { | ||
var productNo = Number(getParam("productNo")); | ||
var productName = decodeURI(getParam("productName")); | ||
|
||
$("a")[0].href = "/product-detail/"+productNo; | ||
$("#productNo")[0].value = productNo; | ||
$("#productName")[0].innerHTML = productName; | ||
|
||
//평가 | ||
$(document).on("click", "div.star", function(e){ | ||
$("div.star").removeClass("fixed"); | ||
$(this).prevAll().addClass("fixed"); | ||
$(this).addClass("fixed"); | ||
$("#grade")[0].value = e.target.dataset.value; | ||
}); | ||
|
||
//보내기(ajax로 true false 체크 후) | ||
$(document).on("click", "#submit", function(e) { | ||
e.preventDefault(); | ||
var token = $("meta[name='_csrf']").attr("content"); | ||
var header = $("meta[name='_csrf_header']").attr("content"); | ||
let form = $("#review-form")[0]; | ||
let params = new FormData(form); | ||
|
||
$.ajax({ | ||
type : "POST", | ||
url : "/review", | ||
data : params, | ||
processData : false, | ||
async : true, | ||
cache : false, | ||
beforeSend : function(xhr) { | ||
xhr.setRequestHeader(header, token); | ||
} | ||
}) | ||
.done(function(response) { | ||
if(response.result) { | ||
alert("리뷰 작성 완료!"); | ||
opener.href.replace("/"); | ||
window.close(); | ||
} else { | ||
alert("리뷰 작성에 실패.. 다시 시도해주세요."); | ||
} | ||
}) | ||
.fail(function(response) { | ||
console.dir("통신 실패"); | ||
}) | ||
}); | ||
}); | ||
|
||
opener.popup = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> | ||
<head> | ||
<meta charset="UTF-8" name="viewport" content="width=device-width initial-scale=1.0"> | ||
<meta name="_csrf" th:content="${_csrf.token}"/> | ||
<meta name="_csrf_header" th:content="${_csrf.headerName}"/> | ||
<title>리뷰작성</title> | ||
<!-- 폰트 --> | ||
<link href="https://fonts.googleapis.com/css2?family=Nanum+Gothic+Coding&family=Noto+Sans&family=Noto+Sans+KR&display=swap" rel="stylesheet"> | ||
<!-- | ||
한글 폰트 | ||
font-family: 'Nanum Gothic Coding', monospace; | ||
font-family: 'Noto Sans KR', sans-serif; | ||
영문 폰트 | ||
font-family: 'Noto Sans', sans-serif; | ||
보통은(한/영 둘다) Noto Sans로 하고 | ||
정보표시는 Nanum Gothic Coding. | ||
--> | ||
<!-- fontawesome CDN --> | ||
<script src="https://kit.fontawesome.com/88eb152a32.js" crossorigin="anonymous"></script> | ||
<!-- css --> | ||
<link rel="stylesheet" href="/css/reset.css" /> | ||
<link rel="stylesheet" href="/css/mypage/writereview.css" /> | ||
<!-- 스크립트 --> | ||
<script src="https://code.jquery.com/jquery-3.5.0.min.js"></script> | ||
<script src="/js/reset.js"></script> | ||
<script src="/js/mypage/writereview.js"></script> | ||
</head> | ||
<body> | ||
<div th:id="review"> | ||
<form th:id="review-form" th:classappend="|align-mid vertical|"> | ||
<table> | ||
<tr> | ||
<th th:text="|상품정보|"></th> | ||
</tr> | ||
<tr> | ||
<td><a th:id="productName" target="_blank"></a></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<input th:type="text" th:placeholder="|제목|" name="reviewTitle" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<textarea th:cols="40" th:rows="8" th:placeholder="|내용을 입력해주세요|" name="reviewContent"></textarea> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th th:text="|평가|"></th> | ||
</tr> | ||
<tr> | ||
<td th:classappend="|align-left horizontal|"> | ||
<div th:classappend="bg"> | ||
<div th:classappend="star" data-value="1"></div> | ||
<div th:classappend="star" data-value="2"></div> | ||
<div th:classappend="star" data-value="3"></div> | ||
<div th:classappend="star" data-value="4"></div> | ||
<div th:classappend="star" data-value="5"></div> | ||
</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td th:classappend="|align-mid horizontal|"> | ||
<button th:id="submit" th:text="|작성|"></button> | ||
</td> | ||
</tr> | ||
</table> | ||
<input th:id="productNo" th:type="hidden" name="productNo" /> | ||
<input th:id="grade" th:type="hidden" th:name="reviewGrade" th:value="0" /> | ||
<input th:type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" /> | ||
</form> | ||
</div> | ||
<script th:inline="javascript"> | ||
</script> | ||
</body> | ||
</html> |