Skip to content

Commit

Permalink
Merge pull request #60 from lotteon2/O2F-1034-SNS-frontend-QA-/fix/sn…
Browse files Browse the repository at this point in the history
…s-qa

O2F-1035 [FIX] sns frontend qa 수정
  • Loading branch information
ssjy4974 authored Dec 27, 2023
2 parents bc264f3 + 7e71b55 commit 2e96906
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/assets/css/ootd/ootd-detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,6 @@
display: flex;
flex-direction: row;
width: 68%;
justify-content: flex-end;
justify-content: center;
gap: 1vw;
}
66 changes: 45 additions & 21 deletions src/components/ootd/OOTDPostCommentComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { createComment, createReplyComment, deleteComment, getComments } from '@
import { useRoute } from 'vue-router'
import PaginationComponent from '@/components/ootd/PaginationComponent.vue'
import { useMemberStore } from '@/stores/member/MemberStore'
import router from '@/router'
const VITE_STATIC_IMG_URL = ref<string>(import.meta.env.VITE_STATIC_IMG_URL)
Expand Down Expand Up @@ -39,6 +40,14 @@ onBeforeMount(async () => {
await fetchDefaultData()
})
const isCommentRegistered = ref<boolean>(false)
watch(isCommentRegistered, async (afterIsCommentRegistered, beforeIsCommentRegistered) => {
if(afterIsCommentRegistered) {
await fetchDefaultData()
isCommentRegistered.value = false
}
})
const onChangePage = async (page: number) => {
if (page >= 0 && page < totalPages.value!) {
requestPage.value = page
Expand All @@ -55,17 +64,20 @@ watch(requestPage, async (afterPage, beforePage) => {
})
const createCommentRequest = ref<CreateCommentRequest>({
description: ""
description: ''
})
const onSubmitComment = async () => {
if (createCommentRequest.value.description === ""
if (createCommentRequest.value.description === ''
|| createCommentRequest.value.description.length < 5 || createCommentRequest.value.description.length > 140) {
alert("댓글은 최소 5자 최대 140자까지 등록할 수 있습니다.")
alert('댓글은 최소 5자 최대 140자까지 등록할 수 있습니다.')
} else {
await createComment(postId.value, createCommentRequest.value)
alert("댓글을 성공적으로 등록하였습니다.")
window.location.reload()
if(!isCommentRegistered.value) {
await createComment(postId.value, createCommentRequest.value)
alert('댓글을 성공적으로 등록하였습니다.')
createCommentRequest.value.description = ''
isCommentRegistered.value = true
}
}
}
Expand All @@ -76,30 +88,39 @@ const onOpenReplyCommentInput = async (commentId: number) => {
}
const createReplyCommentRequest = ref<CreateReplyCommentRequest>({
description: ""
description: ''
})
const onSubmitReplyComment = async (commentId: number) => {
if (createReplyCommentRequest.value.description === ""
if (createReplyCommentRequest.value.description === ''
|| createReplyCommentRequest.value.description.length < 5 || createReplyCommentRequest.value.description.length > 140) {
alert("답글은 최소 5자 최대 140자까지 등록할 수 있습니다.")
alert('답글은 최소 5자 최대 140자까지 등록할 수 있습니다.')
} else {
await createReplyComment(postId.value, commentId, createReplyCommentRequest.value)
alert("답글을 성공적으로 등록하였습니다.")
window.location.reload()
if(!isCommentRegistered.value) {
await createReplyComment(postId.value, commentId, createReplyCommentRequest.value)
alert('답글을 성공적으로 등록하였습니다.')
createReplyCommentRequest.value.description = ''
isCommentRegistered.value = true
}
}
}
const onDeleteComment = async (commentId: number) => {
await deleteComment(postId.value, commentId)
alert("댓글을 성공적으로 삭제하였습니다.")
window.location.reload()
const isConfirm = confirm("댓글을 삭제하시겠습니까?")
if(isConfirm) {
await deleteComment(postId.value, commentId)
alert('댓글을 성공적으로 삭제하였습니다.')
await fetchDefaultData()
}
}
const onDeleteReplyComment = async (commentId: number) => {
await deleteComment(postId.value, commentId)
alert("답글을 성공적으로 삭제하였습니다.")
window.location.reload()
const isConfirm = confirm("답글을 삭제하시겠습니까?")
if(isConfirm) {
await deleteComment(postId.value, commentId)
alert('답글을 성공적으로 삭제하였습니다.')
await fetchDefaultData()
}
}
</script>
Expand Down Expand Up @@ -173,7 +194,8 @@ const onDeleteReplyComment = async (commentId: number) => {
</div>
</div>
<div class='ootd-detail-comment-box-header-right-wrapper'>
<div v-if='comment.member.id === memberId && !comment.isDeleted' class='ootd-detail-comment-box-delete-text'
<div v-if='comment.member.id === memberId && !comment.isDeleted'
class='ootd-detail-comment-box-delete-text'
@click='onDeleteComment(comment.id)'>
삭제
</div>
Expand All @@ -188,10 +210,12 @@ const onDeleteReplyComment = async (commentId: number) => {
<div class='ootd-detail-reply-input-hint-wrapper'>
<div class='ootd-detail-reply-input-hint-text'
:class='{"hover": createReplyCommentRequest.description !== ""}'
@click='onSubmitReplyComment(comment.id)'>입력</div>
@click='onSubmitReplyComment(comment.id)'>입력
</div>
</div>
</div>
<div v-for='replyComment in comment.replyComments' :key='replyComment.id' class='ootd-detail-comment-box-wrapper'>
<div v-for='replyComment in comment.replyComments' :key='replyComment.id'
class='ootd-detail-comment-box-wrapper'>
<RouterLink :to='`/ootds/profile/${replyComment.member.id}`'>
<img class='ootd-detail-comment-profile-image'
:src='`${VITE_STATIC_IMG_URL}${replyComment.member.profileImgUrl}`'>
Expand Down
1 change: 1 addition & 0 deletions src/components/ootd/OOTDProductSearchModalComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const lastId = ref<number>(0)
const clearProductData = async () => {
products.value = new Array<ProductSearchResponse>()
lastId.value = 0
query.value = ''
}
const searchProducts = async (): Promise<ProductSearchPageResponse<ProductSearchResponse>> => {
Expand Down
23 changes: 16 additions & 7 deletions src/views/OOTDDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ const onUpdateBtnClick = async () => {
}
const onDeleteBtnClick = async () => {
await deletePost(postId.value)
alert('게시글이 삭제되었습니다.')
await router.push({ path: '/ootds' })
const isConfirmed = confirm("게시글을 삭제하시겠습니까?")
if(isConfirmed) {
await deletePost(postId.value)
alert('게시글이 삭제되었습니다.')
await router.push({ path: '/ootds' })
}
}
</script>

Expand Down Expand Up @@ -332,7 +335,7 @@ const onDeleteBtnClick = async () => {
<div class='ootd-detail-content-image-container'>
<div class='ootd-detail-content-image-wrapper'>
<img class='ootd-detail-content-image' :src='`${VITE_STATIC_IMG_URL}${post.imgUrl}`'>
<div v-for='postImageProductDetail in post.postImageProductDetails' :key='postImageProductDetail.id'
<div v-for='(postImageProductDetail, index) in post.postImageProductDetails' :key='postImageProductDetail.id'
class='product-detail-tag-wrapper'
:style='{ left: `${postImageProductDetail.leftGapPercent}%`, top: `${postImageProductDetail.topGapPercent}%` }'>
<svg class='product-detail-tag' xmlns='http://www.w3.org/2000/svg'
Expand All @@ -341,7 +344,8 @@ const onDeleteBtnClick = async () => {
d='M15 0C6.71573 0 0 6.71573 0 15C0 23.2843 6.71573 30 15 30C23.2843 30 30 23.2843 30 15C30 6.71573 23.2843 0 15 0ZM16.029 6.50025C20.0424 6.50025 23.2947 9.7544 23.2947 13.7677C23.2947 17.781 20.0424 21.0333 16.029 21.0333C14.8145 21.0333 13.6699 20.7362 12.6636 20.2094C12.6646 20.214 12.6662 20.2194 12.6672 20.224L9.38965 23.4998L6.70533 20.8136L9.86573 17.6514C9.87095 17.649 9.87698 17.6482 9.8822 17.6459C9.17253 16.5236 8.7616 15.1937 8.7616 13.7677C8.7616 9.75438 12.0157 6.50025 16.029 6.50025ZM16.029 9.7284C13.7987 9.7284 11.9898 11.5374 11.9898 13.7677C11.9898 15.998 13.7987 17.8052 16.029 17.8052C18.2594 17.8052 20.0665 15.998 20.0665 13.7677C20.0665 11.5374 18.2594 9.7284 16.029 9.7284Z'
fill='#C22727' />
</svg>
<div class='product-detail-tag-dropdown-wrapper'>
<div class='product-detail-tag-dropdown-wrapper'
:style='{ zIndex: 5 - index }'>
<svg class='product-detail-tag-dropdown-pointer' xmlns='http://www.w3.org/2000/svg' width='33'
height='36' viewBox='0 0 33 36' fill='none'>
<path d='M16.4974 0L32.0884 35.25H0.911499L16.4974 0Z' fill='white' />
Expand Down Expand Up @@ -378,12 +382,17 @@ const onDeleteBtnClick = async () => {
<div class='ootd-detail-content-product-list-wrapper'>
<div class='ootd-detail-content-product-list-image-wrapper'>
<div v-for='postImageProductDetail in post.postImageProductDetails'>
<RouterLink v-if='postImageProductDetail.imgUrl !== undefined'
class='ootd-detail-content-product-image-wrapper'
<RouterLink class='ootd-detail-content-product-image-wrapper'
v-if='postImageProductDetail.imgUrl !== undefined'
:to='{ path: `/products/${postImageProductDetail.productId}`, query: { code: post.member.code }}'>
<img class='ootd-detail-content-product-image'
:src='`${VITE_STATIC_IMG_URL}${postImageProductDetail.imgUrl}`'>
</RouterLink>
<div class='ootd-detail-content-product-image-wrapper'
v-else>
<img class='ootd-detail-content-product-image'
:src='`${VITE_STATIC_IMG_URL}${postImageProductDetail.imgUrl}`'>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/OrderView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
import { order } from '@/apis/order/order'
import type { OrderItemDto, OrderItemWithCouponInfoIdDto } from '@/types/coupon'
import type { ProductInfo } from '@/apis/product/ProductDto'
import type { DeliveryInfo, OrderSheet, OrderItem, OrderInfo } from '@/apis/order/orderDto'
import type { DeliveryInfo, OrderSheet, OrderItem } from '@/apis/order/orderDto'
import { storeToRefs } from 'pinia'
import { useProductStore } from '@/stores/product/ProductStore'
import { useMemberStore } from '@/stores/member/MemberStore'
Expand Down

0 comments on commit 2e96906

Please sign in to comment.