From 8efbefa7d38f9104dbb90499ad17d0f7e528895e Mon Sep 17 00:00:00 2001 From: leezu2020 Date: Mon, 10 May 2021 23:51:00 +0900 Subject: [PATCH] =?UTF-8?q?Update=209-Home-JS/=EC=B4=88=EA=B8=B0=ED=99=94?= =?UTF-8?q?=20=EB=B3=B4=EC=99=84,=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=20=EC=84=B8=ED=8C=85,=20=EC=9D=B8=EA=B8=B0?= =?UTF-8?q?=EC=88=9C&=EC=B5=9C=EC=8B=A0=EC=88=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/bookpot/web/search/PageDto.java | 2 +- src/main/webapp/WEB-INF/views/index.jsp | 12 +- src/main/webapp/WEB-INF/views/join/signup.jsp | 148 +++------------ src/main/webapp/WEB-INF/views/user/Mypage.jsp | 9 +- src/main/webapp/resources/css/Home CSS.css | 4 +- src/main/webapp/resources/css/Mypage CSS.css | 16 +- src/main/webapp/resources/css/Sign-up CSS.css | 155 ++++++++-------- src/main/webapp/resources/icon/like_green.svg | 2 +- src/main/webapp/resources/js/Home JS.js | 168 +++++++++++++----- src/main/webapp/resources/js/Mypage JS.js | 99 ++++++----- .../com/bookpot/web/search/PageDto.class | Bin 2412 -> 2414 bytes .../maven/com.bookpot/bookpot/pom.properties | 2 +- 12 files changed, 305 insertions(+), 312 deletions(-) diff --git a/src/main/java/com/bookpot/web/search/PageDto.java b/src/main/java/com/bookpot/web/search/PageDto.java index 1d77cd1..6393b1b 100644 --- a/src/main/java/com/bookpot/web/search/PageDto.java +++ b/src/main/java/com/bookpot/web/search/PageDto.java @@ -14,7 +14,7 @@ public class PageDto { // 현재 페이지 private int page; // 한번에 보여줄 페이지 수 - private int pageCnt = 5; + private int pageCnt = 10; public PageDto() { // TODO Auto-generated constructor stub diff --git a/src/main/webapp/WEB-INF/views/index.jsp b/src/main/webapp/WEB-INF/views/index.jsp index 91ab908..a4f1abb 100644 --- a/src/main/webapp/WEB-INF/views/index.jsp +++ b/src/main/webapp/WEB-INF/views/index.jsp @@ -43,7 +43,7 @@ (function(){ $.ajax({ - url: "/writings/search?keyword=&division=&categories=&sort=date&page=9", + url: "/writings/search?keyword=&division=&categories=&sort=date&page=1", type: "get", dataType: "json", success: function(data){ @@ -230,7 +230,7 @@ alt="book image">
- +
@@ -255,7 +255,7 @@ alt="book image">
- +
@@ -281,7 +281,7 @@ alt="book image">
- +
@@ -306,7 +306,7 @@ alt="book image">
- +
@@ -368,7 +368,7 @@
-
+
1
2
3
diff --git a/src/main/webapp/WEB-INF/views/join/signup.jsp b/src/main/webapp/WEB-INF/views/join/signup.jsp index 7bbe2cf..02a8e26 100644 --- a/src/main/webapp/WEB-INF/views/join/signup.jsp +++ b/src/main/webapp/WEB-INF/views/join/signup.jsp @@ -16,137 +16,22 @@ 책단지 "> - - + + + - -
\n'; - gridContent += '
' + likeIcon + '\n
\n'; - gridContent += '
\n

' + searchResult.writing[index].title + '

\n'; - gridContent += '

' + searchResult.writing[index].booktitle + '

\n'; - gridContent += '

' + searchResult.writing[index].content + '

\n
\n'; - gridContent += '
\n
\n\n'; - gridContent += '' + searchResult.writing[index].nickname + '\n
'; - gridContent += '' + searchResult.writing[index].regDate + '\n
\n'; - - listContent += '
\n
' + index+1 + '
\n'; - listContent += '
' + searchResult.writing[index].title + '
\n'; - listContent += '
' + searchResult.writing[index].booktitle + '
\n'; - listContent += '
' + searchResult.writing[index].nickname + '
\n'; - listContent += '
' + searchResult.writing[index].regDate + '
\n
\n'; - } - $("#grid-view").append(gridContent); - }, + success : showResult(data) + , error : function(e){ console.log(e); } @@ -175,17 +164,35 @@ $(document).ready(function(){ $(".best").click(function() { $(".best").toggleClass("array-selected"); $(".latest").removeClass("array-selected"); + qsSort = "good" + resultUrl += "/writing/search?keyword=&division=" + qsDivision + qsCategories + "&sort=good"; + $.ajax({ + url : resultUrl, + type : "get", + dataType : "json", + success : showResult(data) + }) }) $(".latest").click(function() { $(".latest").toggleClass("array-selected"); $(".best").removeClass("array-selected"); + qsSort = "date"; + resultUrl += "/writing/search?keyword=&division=" + qsDivision + qsCategories + "&sort=date" + $.ajax({ + url : resultUrl, + type : "get", + dataType : "json", + success : showResult(data) + }) }) //scrap 아이콘 $(".scrap-icon").click(function() { var contentIndex = $(".scrap-icon").index(this); //클릭된 콘텐츠의 인덱스 + console.log("클릭된 콘텐츠의 인덱스 : " + contentIndex); let contentId = searchResult.writing[contentIndex].no; //콘텐츠의 고유 번호 var clickScrap = $(".scrap-icon:eq(" + contentIndex + ")"); + console.log(clickScrap.attr("src")); //스크랩 추가 if (clickScrap.attr("src") == "/resources/icon/scrap_white.svg") { clickScrap.attr("src", "/resources/icon/scrap_green.svg"); @@ -194,6 +201,7 @@ $(document).ready(function(){ type : "post", }) } else { //스크랩 삭제 + clickScrap.attr("src", "icon/scrap_white.svg"); $.ajax ({ url : "/writings/" + contentId + "/scrap", type : "delete", @@ -202,6 +210,72 @@ $(document).ready(function(){ }) }) +//좋아요 아이콘 +$(".like-icon").click(function() { + var contentIndex = $(".like-icon").index(this); //클릭된 콘텐츠의 인덱스 + console.log("클릭된 콘텐츠의 인덱스 : " + contentIndex); + let contentId = searchResult.writing[contentIndex].no; //콘텐츠의 고유 번호 + var clickLike = $(".like-icon:eq(" + contentIndex + ")"); + console.log(clickLike.attr("src")); + //좋아요 추가 + if (clickLike.attr("src") == "icon/like_white.svg") { + clickLike.attr("src", "icon/like_green.svg"); + $.ajax ({ + url : "/writings/" + contentId + "/good", + type : "post", + }) + } else { //좋아요 삭제 + clickLike.attr("src", "icon/like_white.svg"); + $.ajax ({ + url : "/writings/" + contentId + "/good", + type : "delete", + }) + } +}) + +function showResult(data) { + $("#grid-view").empty(); + $("#list-view").empty(); + $("#page").empty(); + searchResult = data; + contentNumber = searchResult.writing.length; + let gridPage = Math.cell(contentNumber / 9); + let listPage = Math.cell(contentNumber / 12); + let gridContent = ""; //grid 콘텐츠 들어갈 공간 + let listContent = ""; //list 콘텐츠 들어갈 공간 + let page = "" //page 번호들 들어갈 공간 + for (let index = 0; index < contentNumber; index++) { + let likeIcon = '\n'; + let scrapIcon = '' + 'book image\n
\n'; + gridContent += '
' + likeIcon + '\n
\n'; + gridContent += '
\n

' + searchResult.writing[index].title + '

\n'; + gridContent += '

' + searchResult.writing[index].booktitle + '

\n'; + gridContent += '

' + searchResult.writing[index].content + '

\n
\n'; + gridContent += '
\n
\n\n'; + gridContent += '' + searchResult.writing[index].nickname + '\n
'; + gridContent += '' + searchResult.writing[index].regDate + '\n
\n'; + + listContent += '
\n
' + index+1 + '
\n'; + listContent += '
' + searchResult.writing[index].title + '
\n'; + listContent += '
' + searchResult.writing[index].booktitle + '
\n'; + listContent += '
' + searchResult.writing[index].nickname + '
\n'; + listContent += '
' + searchResult.writing[index].regDate + '
\n
\n'; + } + for (let index = 1; index <= pageNumber; index++) { + page += '
'+ index +'
' + } + $("#grid-view").append(gridContent); + $("#list-view").append(listContent); + $("#page").append(page); +} + function showLoginError() { console.log("showLoginError 함수 실행됨"); loginFormErrormessage = document.getElementById("login-form-error-message"); diff --git a/src/main/webapp/resources/js/Mypage JS.js b/src/main/webapp/resources/js/Mypage JS.js index 02c1118..890d4d7 100644 --- a/src/main/webapp/resources/js/Mypage JS.js +++ b/src/main/webapp/resources/js/Mypage JS.js @@ -42,7 +42,6 @@ inputImage.addEventListener("change", e => { /* 유효성 검사항목 - 1. 닉네임 조건 충족: 한글, 영 대소문자(특수기호, 공백 사용 불가) 2~10자 2. 비밀번호 조건 충족: 8~16자 영문 대 소문자, 문자와 숫자는 최소 하나 3. 비밀번호 일치 충족: 비밀번호와 동일 @@ -126,60 +125,66 @@ $(document).ready( function() { $("#nickname-info").prop("disabled", true); $(document).ready( function() { - $('#pwd-button').click( function(){ - - let pwdData = {pwd : $('#pwd-forchange').val()} - $.ajax({ - url : "/users/checkPwd", - type : "post", - data : pwdData, - success : function(result){ - if(result == "match"){ - $("#nickname-info").prop("disabled", false); - $('#pwd-forchange').val('') - - /*비번 일치 검사 후 숨기기*/ - $('#pwd-set').hide(); - - $('#change-button').hide(); - $('.upload-buttons').show(); - $('#nickname-info').width('386'); - $('#nickname-button').show(); - $('#password-set').show(); - $('#password-2-set').show(); - - $('#nickname-info').css('font-weight', 'normal'); - } - }, - error : function(){ - $('#alertpwd-forcheck').text('비밀번호를 확인해주세요.'); - } - }) - }) + + $('#pwd-button').click(function() { + console.log($('#pwd-button').is('disabled')); + $("#nickname-info").prop("disabled", false); + + /*비번 일치 검사 후 숨기기*/ + $('#pwd-set').hide(); + $('#change-button').hide(); + $('.upload-buttons').show(); + $('#nickname-info').width('386'); + $('#nickname-button').show(); + $('#password-set').show(); + $('#password-2-set').show(); + + $('#nickname-info').css('font-weight', 'normal'); + -}); + }); + + }); /*적용&취소 버튼 클릭 시 이벤트*/ -$(document).ready( function() { - - $( '.upload-buttons' ).click( function() { - $('#change-button').show(); - - $('.upload-buttons').hide(); - $('#nickname-info').width('506'); - $('#nickname-button').hide(); - $('#password-set').hide(); - $('#password-2-set').hide(); - $('#nickname-info').css('font-weight', 'bold'); + $(document).ready( function() { + + $( '.upload-buttons' ).click( function() { + $('#change-button').show(); + + $('.upload-buttons').hide(); + $('#nickname-info').width('506'); + $('#nickname-button').hide(); + $('#password-set').hide(); + $('#password-2-set').hide(); + $('#nickname-info').css('font-weight', 'bold'); + + console.log($('#pwd-button').is('disabled')); + $("#nickname-info").prop("disabled", true); + + }); + + }); + - console.log($('#pwd-button').is('disabled')); - $("#nickname-info").prop("disabled", true); + // 회원탈퇴 버튼 클릭 시 이벤트 - }); -}); + function alertWithdrawl() { + var result = confirm("정말로 탈퇴하시겠습니까?"); + + result; + if (result == true) { + // 회원탈퇴 처리 + deleteInfo(); + console.log(true); + } + else { + console.log(false); + } + } /*아이디 중복 확인*/ function fn_checkNickname(){ diff --git a/target/classes/com/bookpot/web/search/PageDto.class b/target/classes/com/bookpot/web/search/PageDto.class index 75dca64b97bc7da17e590dc722194397312e5a58..79283ce2c5e8b14ef596a951a4b0dee04dab7383 100644 GIT binary patch delta 232 zcmXwz&8k6R7=@p``J_$R?WkiTk<)Q@icT3aGW9n#+C$f1qPPT^D`l*XatAJeD=<`Y z3(mqZd3)aVt@W<&>fO9;$+#_SEFcl=$po&mXqfDeLk3@B^7TZHyfzDuf@WHH#t@Ts zddDW_Jaza`FsrCfQIV$X9np{yBg%wSnDEJxFIH69@Xd~ZgZN18S=oM_{jXF3DJhR1 io^VC>le(ga?#}3mqO7UYe;5q|8OFr#guj>A-2MZ%H6LjJ delta 230 zcmXYr%?d$b5QZOzPe{>;a{NYwlhP?m*;xD8TG_eH7tc`^ah`2|RZfNBh#|x7rEiL-%kRhwehfPj7A-rM;O1u2GX67~z zlTy!7q{(ZerRgpOh7=i5VoaGS71mVQP-91(11=}=na1~G=jZyrD1Ty7KL1^ai>xp8 bM1J`$=!*huX)^c>8i_C=^kRIt2bb0xgLNM( diff --git a/target/m2e-wtp/web-resources/META-INF/maven/com.bookpot/bookpot/pom.properties b/target/m2e-wtp/web-resources/META-INF/maven/com.bookpot/bookpot/pom.properties index f168687..80bd9a6 100644 --- a/target/m2e-wtp/web-resources/META-INF/maven/com.bookpot/bookpot/pom.properties +++ b/target/m2e-wtp/web-resources/META-INF/maven/com.bookpot/bookpot/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Sat May 08 10:36:45 KST 2021 +#Mon May 10 22:07:52 KST 2021 m2e.projectLocation=D\:\\potfolio\\bookpot\\bookpot m2e.projectName=bookpot groupId=com.bookpot