[Spring][쇼핑몰 프로젝트][48] 댓글 수정 - 2

https://kimvampa.tistory.com/298
This commit is contained in:
SeoJin Kim
2022-01-11 18:40:55 +09:00
parent 9c94c0390e
commit 38bfcc1752
4 changed files with 426 additions and 0 deletions

View File

@@ -425,6 +425,18 @@ const form = {
});
}
/* 리뷰 수정 버튼 */
$(document).on('click', '.update_reply_btn', function(e){
e.preventDefault();
let replyId = $(this).attr("href");
let popUrl = "/replyUpdate?replyId=" + replyId + "&bookId=" + '${goodsInfo.bookId}' + "&memberId=" + '${member.memberId}';
let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"
window.open(popUrl,"리뷰 수정",popOption);
});
/* 댓글(리뷰) 동적 생성 메서드 */
function makeReplyContent(obj){

View File

@@ -0,0 +1,201 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"></script>
<style type="text/css">
/* 창 여분 없애기 */
body{
margin : 0;
}
/* 전체 배경화면 색상 */
.wrapper_div{
background-color: #f5f5f5;
height: 100%;
}
/* 팝업창 제목 */
.subject_div{
width: 100%;
background-color: #7b8ed1;
color: white;
padding: 10px;
font-weight: bold;
}
/* 컨텐츠, 버튼 영역 padding */
.input_wrap{
padding: 30px;
}
.btn_wrap{
padding: 5px 30px 30px 30px;
text-align: center;
}
/* 버튼 영역 */
.cancel_btn{
margin-right:5px;
display: inline-block;
width: 130px;
background-color: #5e6b9f;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
.enroll_btn{
display: inline-block;
width: 130px;
background-color: #7b8ed1;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
/* 책제목 영역 */
.bookName_div h2{
margin : 0;
}
/* 평점 영역 */
.rating_div{
padding-top: 10px;
}
.rating_div h4{
margin : 0;
}
select{
margin: 15px;
width: 100px;
height: 40px;
text-align: center;
font-size: 16px;
font-weight: 600;
}
/* 리뷰 작성 영역 */
.content_div{
padding-top: 10px;
}
.content_div h4{
margin : 0;
}
textarea{
width: 100%;
height: 100px;
border: 1px solid #dadada;
padding: 12px 8px 12px 8px;
font-size: 15px;
color: #a9a9a9;
resize: none;
margin-top: 10px;
}
.update_btn{
display: inline-block;
width: 130px;
background-color: #7b8ed1;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
</style>
</head>
<body>
<div class="wrapper_div">
<div class="subject_div">
리뷰 수정
</div>
<div class="input_wrap">
<div class="bookName_div">
<h2>${bookInfo.bookName}</h2>
</div>
<div class="rating_div">
<h4>평점</h4>
<select name="rating">
<option value="0.5">0.5</option>
<option value="1.0">1.0</option>
<option value="1.5">1.5</option>
<option value="2.0">2.0</option>
<option value="2.5">2.5</option>
<option value="3.0">3.0</option>
<option value="3.5">3.5</option>
<option value="4.0">4.0</option>
</select>
</div>
<div class="content_div">
<h4>리뷰</h4>
<textarea name="content">${replyInfo.content}</textarea>
</div>
</div>
<div class="btn_wrap">
<a class="cancel_btn">취소</a><a class="update_btn">수정</a>
</div>
</div>
<script>
$(document).ready(function(){
let rating = '${replyInfo.rating}';
$("option").each(function(i,obj){
if(rating === $(obj).val()){
$(obj).attr("selected", "selected");
}
});
});
/* 취소 버튼 */
$(".cancel_btn").on("click", function(e){
window.close();
});
/* 등록 버튼 */
$(".update_btn").on("click", function(e){
const replyId = '${replyInfo.replyId}';
const bookId = '${replyInfo.bookId}';
const memberId = '${memberId}';
const rating = $("select").val();
const content = $("textarea").val();
const data = {
replyId : replyId,
bookId : bookId,
memberId : memberId,
rating : rating,
content : content
}
$.ajax({
data : data,
type : 'POST',
url : '/reply/update',
success : function(result){
$(opener.location).attr("href", "javascript:replyListInit();");
window.close();
}
});
});
</script>
</body>
</html>

View File

@@ -425,6 +425,18 @@ const form = {
});
}
/* 리뷰 수정 버튼 */
$(document).on('click', '.update_reply_btn', function(e){
e.preventDefault();
let replyId = $(this).attr("href");
let popUrl = "/replyUpdate?replyId=" + replyId + "&bookId=" + '${goodsInfo.bookId}' + "&memberId=" + '${member.memberId}';
let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"
window.open(popUrl,"리뷰 수정",popOption);
});
/* 댓글(리뷰) 동적 생성 메서드 */
function makeReplyContent(obj){

View File

@@ -0,0 +1,201 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"></script>
<style type="text/css">
/* 창 여분 없애기 */
body{
margin : 0;
}
/* 전체 배경화면 색상 */
.wrapper_div{
background-color: #f5f5f5;
height: 100%;
}
/* 팝업창 제목 */
.subject_div{
width: 100%;
background-color: #7b8ed1;
color: white;
padding: 10px;
font-weight: bold;
}
/* 컨텐츠, 버튼 영역 padding */
.input_wrap{
padding: 30px;
}
.btn_wrap{
padding: 5px 30px 30px 30px;
text-align: center;
}
/* 버튼 영역 */
.cancel_btn{
margin-right:5px;
display: inline-block;
width: 130px;
background-color: #5e6b9f;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
.enroll_btn{
display: inline-block;
width: 130px;
background-color: #7b8ed1;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
/* 책제목 영역 */
.bookName_div h2{
margin : 0;
}
/* 평점 영역 */
.rating_div{
padding-top: 10px;
}
.rating_div h4{
margin : 0;
}
select{
margin: 15px;
width: 100px;
height: 40px;
text-align: center;
font-size: 16px;
font-weight: 600;
}
/* 리뷰 작성 영역 */
.content_div{
padding-top: 10px;
}
.content_div h4{
margin : 0;
}
textarea{
width: 100%;
height: 100px;
border: 1px solid #dadada;
padding: 12px 8px 12px 8px;
font-size: 15px;
color: #a9a9a9;
resize: none;
margin-top: 10px;
}
.update_btn{
display: inline-block;
width: 130px;
background-color: #7b8ed1;
padding-top: 10px;
height: 27px;
color: #fff;
font-size: 14px;
line-height: 18px;
}
</style>
</head>
<body>
<div class="wrapper_div">
<div class="subject_div">
리뷰 수정
</div>
<div class="input_wrap">
<div class="bookName_div">
<h2>${bookInfo.bookName}</h2>
</div>
<div class="rating_div">
<h4>평점</h4>
<select name="rating">
<option value="0.5">0.5</option>
<option value="1.0">1.0</option>
<option value="1.5">1.5</option>
<option value="2.0">2.0</option>
<option value="2.5">2.5</option>
<option value="3.0">3.0</option>
<option value="3.5">3.5</option>
<option value="4.0">4.0</option>
</select>
</div>
<div class="content_div">
<h4>리뷰</h4>
<textarea name="content">${replyInfo.content}</textarea>
</div>
</div>
<div class="btn_wrap">
<a class="cancel_btn">취소</a><a class="update_btn">수정</a>
</div>
</div>
<script>
$(document).ready(function(){
let rating = '${replyInfo.rating}';
$("option").each(function(i,obj){
if(rating === $(obj).val()){
$(obj).attr("selected", "selected");
}
});
});
/* 취소 버튼 */
$(".cancel_btn").on("click", function(e){
window.close();
});
/* 등록 버튼 */
$(".update_btn").on("click", function(e){
const replyId = '${replyInfo.replyId}';
const bookId = '${replyInfo.bookId}';
const memberId = '${memberId}';
const rating = $("select").val();
const content = $("textarea").val();
const data = {
replyId : replyId,
bookId : bookId,
memberId : memberId,
rating : rating,
content : content
}
$.ajax({
data : data,
type : 'POST',
url : '/reply/update',
success : function(result){
$(opener.location).attr("href", "javascript:replyListInit();");
window.close();
}
});
});
</script>
</body>
</html>