Skip to content

Commit

Permalink
Merge pull request projectText#54 from dev-aram/master
Browse files Browse the repository at this point in the history
마이페이지 커밋
  • Loading branch information
dev-yoondam authored Jul 23, 2023
2 parents 7254ee6 + 2ab0691 commit 21c8462
Show file tree
Hide file tree
Showing 20 changed files with 453 additions and 232 deletions.
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/cos.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/jstl.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/mybatis-3.5.10.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/mysql-connector-j-8.0.31.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/org.json.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/User/Desktop/week_web/project/text/WebContent/WEB-INF/lib/standard.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
10 changes: 10 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@
<url-pattern>*.mypage</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>Follow</servlet-name>
<servlet-class>com.app.controller.FollowFrontContriller</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Follow</servlet-name>
<url-pattern>*.follow</url-pattern>
</servlet-mapping>

</web-app>
19 changes: 11 additions & 8 deletions WebContent/mypage/following.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, bo
input, textarea {
background: none;
}
.MyFollowAppContainer-container{
margin: 0 8px;
}
.MyFollowAppContainer-contents{
margin: auto;
max-width: 768px;
Expand All @@ -68,7 +65,7 @@ input, textarea {
.MyFollowAppContainer-header{
line-height: 44px;
font-size: 32px;
font-weight: 700;
font-weight: 600;
padding: 48px 12px 29px;
}
.MyFollowAppContainer-tabsWrapper{
Expand All @@ -80,7 +77,6 @@ input, textarea {
width: 100%;
min-height: 48px;
overflow: hidden;
margin: 0 8px;
}
.Tabs-ul{
overflow: auto;
Expand All @@ -90,12 +86,16 @@ input, textarea {
position: relative;
background-color: #fff;
height: 100%;
margin-bottom: 32px;
}
li, ul{
margin: 0;
}
.MyFollowAppContainer-tabsWrapper ul li {
margin: 0 8px;
margin: 0px;
}
.MyFollowAppContainer-tabsWrapper ul li + li{
margin-left: 20px
}

.Tabs-ul li {
Expand All @@ -105,10 +105,11 @@ li, ul{
justify-content: center;
margin: 0 8px;
min-width: 30px;
max-width: 200px;
max-width: 60px;`
vertical-align: middle;
white-space: normal;
}
.Tabs-ul li.active{border-bottom: 2px solid #00c4c4}

.Tabs-ul span {
line-height: 28px;
Expand All @@ -117,7 +118,7 @@ li, ul{
display: inline-flex;
position: relative;
align-items: center;
padding: 9px 4px;
padding: 9px 0px;
height: 100%;
color: #495057;
}
Expand Down Expand Up @@ -176,11 +177,13 @@ li, ul{
}
.FollowingCard-rightPanel{
display: flex;
justify-content: end;
}

.FollowingCard-avatarWrapper{
display: flex;
align-items: center;
max-width: 70px;
}
.FollowingCard-info{
display: flex;
Expand Down
231 changes: 136 additions & 95 deletions WebContent/mypage/following.jsp

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion WebContent/mypage/mypage2.css
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ a.Button-button { display: inline-block; text-decoration: none;}

@media screen and (min-width: 960px){
.mypage-project .tab-list ul li { width: auto; margin-right: 24px;}}
.mypage-project .tab-list ul li.active{border-bottom: 2px solid #00c4c4}
.mypage-project .tab-list ul li { float: left; width: 13%;}
.mypage-project .tab-list ul li button {
display: block;
Expand Down Expand Up @@ -412,7 +413,7 @@ a.Button-button { display: inline-block; text-decoration: none;}
float: right;
display: block;
padding-right: 20px;
width: 48%;
width: auto;
text-align: right;
font-size: 11px;
color: #00c4c4;
Expand All @@ -424,6 +425,9 @@ a.Button-button { display: inline-block; text-decoration: none;}
display: block;
}

.trade_st{color: #00c4c4; margin-bottom: 4px; font-size: 12px; border: 1px solid #00c4c4; padding: 2px; max-width: 50px; text-align: center; border-radius:5px;}
.trade_st.end{color: #cdd3d8; border-color: #cdd3d8}

.heart-wrapper{
position: absolute;
left: 12px;
Expand Down
91 changes: 79 additions & 12 deletions WebContent/mypage/mypage2.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
${feedCount} <span class="BlindText_textHidden">개</span>
</dd>
</div>
<div class="follower-following">
<div class="follower-following" onclick="flower()">
<dt>팔로워</dt>
<dd>
${followerCount} <span class="BlindText_textHidden">명</span> <a
href="/web/social/follower"><span
class="BlindText_textHidden"></span> </a>
</dd>
</div>
<div class="follower-following">
<div class="follower-following" onclick="flowing()">
<dt>팔로잉</dt>
<dd>
${followingCount} <span class="BlindText_textHidden">명</span> <a
Expand Down Expand Up @@ -106,18 +106,18 @@
<li class="active">
<button type="button" id="feed" role="tab" aria-selected="ture" tabindex="-1">내 피드</button>
</li>
<li class="nomal">
<li>
<button type="button" id="trade" role="tab" aria-selected="flase" aria-controls="tabWishes" tabindex="0">나의 교환내역</button>
</li>
<li class="normal">
<li>
<button type="button" id="with" role="tab" aria-selected="false" tabindex="1">우리 함께해요</button>
</li>
</ul>
</div>
<div class="project-list">
<!-- top area -->
<div class="top-area">
<p class="status-text">${feedCount}개의 글을 작성했습니다.</p>
<p class="status-text"><span>${feedCount}</span> 개의 글을 작성했습니다.</p>
</div>
<!-- List ************ -->
<div class="List" id="projectCardList">
Expand Down Expand Up @@ -148,11 +148,12 @@ $("#nick").text(mypage.membernick);
/* 프로필사진 */
$(".Avatar-hasImage").css("background-image",`url(${contextPath}/upload/` + mypage.memberimg + `)`);
/* 내 피드 리스트 */
start();
const $listWrap = $("#projectCardList ul")
const $total = $(".status-text span");
const $listWrap = $("#projectCardList ul")
const $tabList = $(".tab_list button");
start();
function start() {
$.ajax({
url:"myFeed.mypage",
Expand All @@ -163,7 +164,7 @@ function start() {
feeds.forEach(feed =>{
text += feedList(feed);
});
$listWrap.append(text);
$listWrap.html(text);
}
});
}
Expand Down Expand Up @@ -191,10 +192,63 @@ const feedList = (feed) =>{
</li>`)
}
/* 내 함께해요 리스트 */
$("#with").on("click",function(){
/* 탭 효과 */
$(".tab-list li").on("click",function(){
$(".tab-list li").not(this).removeClass('active');
$(this).addClass('active')
})
/* 내 교환해요 리스트 */
$("#trade").on("click",function(){
$total.text("${tradeCount}");
console.log($tabList);
$.ajax({
url:"myTrade.mypage",
type: "get",
dataType:"json",
success: function(trades) {
let text ="";
trades.forEach(trade =>{
text += tradeList(trade);
});
$listWrap.html(text);
for(let i=0;i<trades.length;i++){
if(trades[i].boardstatus == "ti"){
$(".trade_st").eq(i).text("교환중");
}else if(trades[i].boardstatus == "tc"){
$(".trade_st").eq(i).addClass("end");
$(".trade_st").eq(i).text("교환완료");
}
}
}
});
const tradeList = (trade) =>{
return (`<li class='list-list'>
<a href=''>
<div class='project-card'>
<div class='card-img-section'>
<em class='project-img'style='background-image: url("${pageContext.request.contextPath}/upload/` + trade.fileoriginalname + `")'></em>
</div>
<div class='card-info-section'>
<div class='trade_st'></div>
<h4>` + trade.boardtitle + `</h4>
<h5>` + trade.boardcontents + `</h5>
<div class='card-category'><span class='category1'>` + trade.boarddate + `</span></div>
</div>
</div>
</a>
</li>`)
}
})
/* 내 함께해요 리스트 */
$("#with").on("click",function(){
$total.text("${togetherCount}");
$.ajax({
url:"myTogether.mypage",
Expand All @@ -208,6 +262,7 @@ const feedList = (feed) =>{
$listWrap.html(text);
}
});
const togetherList = (together) =>{
return (`<li class='list-list'>
Expand All @@ -228,5 +283,17 @@ const feedList = (feed) =>{
})
/* 내 피드 클릭 시 */
$("#feed").on("click",function(){
$total.text("${feedCount}");
start();
});
function flower() {
location.href = "${pageContext.request.contextPath}followerList.follow"
}
function flowing() {
location.href = "${pageContext.request.contextPath}followingList.follow"
}
</script>
</html>
1 change: 0 additions & 1 deletion build/classes/com/app/mybatis/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

<mappers>
<mapper resource="com/app/mybatis/mapper/memberMapper.xml"></mapper>

<mapper resource="com/app/mybatis/mapper/feedMapper.xml"></mapper>
<mapper resource="com/app/mybatis/mapper/followMapper.xml"></mapper>
<mapper resource="com/app/mybatis/mapper/togetherMapper.xml"></mapper>
Expand Down
45 changes: 45 additions & 0 deletions src/com/app/controller/FollowFrontContriller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.app.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.app.Result;

public class FollowFrontContriller extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String target = req.getRequestURI().replace(req.getContextPath() + "/", "").split("\\.")[0];
Result result = null;
System.out.println(target);
if(target.equals("followerList")) {
result = new Result();
result.setPath("/mypage/following.jsp");
}else if(target.equals("followingList")) {
result = new Result();
result.setPath("/mypage/following.jsp");
}
else if (target.equals("follower")) {
result = new FollowerListOkController().execute(req, resp);
}else if(target.equals("following")) {
result = new FollowingListOkController().execute(req, resp);
}

if (result != null) {
if (result.isRedirect()) {
resp.sendRedirect(result.getPath());
} else {
req.getRequestDispatcher(result.getPath()).forward(req, resp);
}
}

}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}

}
Loading

0 comments on commit 21c8462

Please sign in to comment.