From c94965523a2a35c0de68f3c7825a41fa7a71384f Mon Sep 17 00:00:00 2001 From: SeoJin Kim Date: Sun, 9 Jan 2022 19:24:26 +0900 Subject: [PATCH] =?UTF-8?q?[Spring][=EC=87=BC=ED=95=91=EB=AA=B0=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8][46]=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=95=20-=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://kimvampa.tistory.com/294 --- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 129 +++++++++++++++++- .../maven/com.vam/controller/pom.properties | 2 +- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 129 +++++++++++++++++- .../maven/com.vam/controller/pom.properties | 2 +- 4 files changed, 258 insertions(+), 4 deletions(-) diff --git a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp index c56114f..b43f704 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -168,7 +168,52 @@
- + + +
+ +
+ +
+ +
+ @@ -254,6 +299,88 @@ $(document).ready(function(){ point = Math.floor(point); $(".point_span").text(point); + /* 리뷰 리스트 출력 */ + + const bookId = '${goodsInfo.bookId}'; + + $.getJSON("/reply/list", {bookId : bookId}, function(obj){ + + if(obj.list.length === 0){ + $(".reply_not_div").html('리뷰가 없습니다.'); + $(".reply_content_ul").html(''); + $(".pageMaker").html(''); + } else{ + + $(".reply_not_div").html(''); + + const list = obj.list; + const pf = obj.pageInfo; + const userId = '${member.memberId}'; + + /* list */ + + let reply_list = ''; + + $(list).each(function(i,obj){ + reply_list += '
  • '; + reply_list += '
    '; + reply_list += '
    '; + /* 아이디 */ + reply_list += ''+ obj.memberId+''; + /* 날짜 */ + reply_list += ''+ obj.regDate +''; + /* 평점 */ + reply_list += '평점 : '+ obj.rating +''; + if(obj.memberId === userId){ + reply_list += '수정삭제'; + } + reply_list += '
    '; //
    + reply_list += '
    '; + reply_list += '
    '+ obj.content +'
    '; + reply_list += '
    ';//
    + reply_list += '
    ';//
    + reply_list += '
  • '; + }); + + $(".reply_content_ul").html(reply_list); + + /* 페이지 버튼 */ + + let reply_pageMaker = ''; + + /* prev */ + if(pf.prev){ + let prev_num = pf.pageStart -1; + reply_pageMaker += ''; + } + /* numbre btn */ + for(let i = pf.pageStart; i < pf.pageEnd+1; i++){ + reply_pageMaker += '
  • '; + reply_pageMaker += ''+i+''; + reply_pageMaker += '
  • '; + } + /* next */ + if(pf.next){ + let next_num = pf.pageEnd +1; + reply_pageMaker += ''; + } + + $(".pageMaker").html(reply_pageMaker); + + } + + + }); + + }); //$(document).ready(function(){ diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 59e8d33..ffd551e 100644 --- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Fri Jan 07 17:32:29 KST 2022 +#Sun Jan 09 17:57:01 KST 2022 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa m2e.projectName=VamPa groupId=com.vam diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp index c56114f..b43f704 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -168,7 +168,52 @@
    - + + +
    + +
    + +
    + +
    + @@ -254,6 +299,88 @@ $(document).ready(function(){ point = Math.floor(point); $(".point_span").text(point); + /* 리뷰 리스트 출력 */ + + const bookId = '${goodsInfo.bookId}'; + + $.getJSON("/reply/list", {bookId : bookId}, function(obj){ + + if(obj.list.length === 0){ + $(".reply_not_div").html('리뷰가 없습니다.'); + $(".reply_content_ul").html(''); + $(".pageMaker").html(''); + } else{ + + $(".reply_not_div").html(''); + + const list = obj.list; + const pf = obj.pageInfo; + const userId = '${member.memberId}'; + + /* list */ + + let reply_list = ''; + + $(list).each(function(i,obj){ + reply_list += '
  • '; + reply_list += '
    '; + reply_list += '
    '; + /* 아이디 */ + reply_list += ''+ obj.memberId+''; + /* 날짜 */ + reply_list += ''+ obj.regDate +''; + /* 평점 */ + reply_list += '평점 : '+ obj.rating +''; + if(obj.memberId === userId){ + reply_list += '수정삭제'; + } + reply_list += '
    '; //
    + reply_list += '
    '; + reply_list += '
    '+ obj.content +'
    '; + reply_list += '
    ';//
    + reply_list += '
    ';//
    + reply_list += '
  • '; + }); + + $(".reply_content_ul").html(reply_list); + + /* 페이지 버튼 */ + + let reply_pageMaker = ''; + + /* prev */ + if(pf.prev){ + let prev_num = pf.pageStart -1; + reply_pageMaker += ''; + } + /* numbre btn */ + for(let i = pf.pageStart; i < pf.pageEnd+1; i++){ + reply_pageMaker += '
  • '; + reply_pageMaker += ''+i+''; + reply_pageMaker += '
  • '; + } + /* next */ + if(pf.next){ + let next_num = pf.pageEnd +1; + reply_pageMaker += ''; + } + + $(".pageMaker").html(reply_pageMaker); + + } + + + }); + + }); //$(document).ready(function(){ diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 14ba800..2eeb6f2 100644 --- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Fri Jan 07 17:32:30 KST 2022 +#Sun Jan 09 17:57:01 KST 2022 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa_MySQL m2e.projectName=VamPa_MySQL groupId=com.vam