Skip to content

Commit 76ba414

Browse files
committed
🔀 [fix] : conflict resolved
2 parents aab5a62 + 46ec546 commit 76ba414

File tree

16 files changed

+266
-72
lines changed

16 files changed

+266
-72
lines changed

src/api/admin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const deleteCategoryAdmin = async (id: number) => {
2626
}
2727

2828
export const addMemberAdmin = async (memberData: UserRegistrationProps) => {
29-
console.log(memberData, '요청 데이터')
3029
const response = await axiosInstance.post('/api/managements/members', memberData)
3130
return response.data
3231
}

src/api/common.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { axiosInstance } from '../utils/axios'
1+
import { axiosInstance, formDataAxiosInstance } from '../utils/axios'
2+
3+
export const patchEditInfo = async (formdata: FormData) => {
4+
const response = await formDataAxiosInstance.patch('/api/members/info', formdata)
5+
return response.data
6+
}
27

38
export const getNotification = async (pageNum: number, sizeNum: number) => {
49
const response = await axiosInstance.get(`/api/notifications?page=${pageNum}&size=${sizeNum}`)

src/api/user.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import type { Status } from '@/types/common'
2-
import type { userInfo } from '@/types/user'
32
import type { RequestApprovePostTypes } from '@/types/manager'
3+
import type { userInfo } from '@/types/user'
44
import { axiosInstance, formDataAxiosInstance } from '@/utils/axios'
55

6-
export const patchEditInfo = async (formdata: userInfo, image: File) => {
7-
const response = await formDataAxiosInstance.post('/api/tasks', formdata, image)
8-
return response.data
9-
}
10-
116
export const postTaskRequest = async (formdata: FormData) => {
127
const response = await formDataAxiosInstance.post('/api/tasks', formdata)
138
return response.data
@@ -59,21 +54,26 @@ export const getHistory = async (taskID: number) => {
5954
}
6055

6156
export const postComment = async (taskID: number, content: string) => {
62-
const response = await axiosInstance.post(`/api/comment/${taskID}`, { content })
57+
const response = await axiosInstance.post(`/api/comments/${taskID}`, { content })
6358
return response.data
6459
}
6560

6661
export const postCommentAttachment = async (taskID: number, formdata: FormData) => {
67-
const response = await formDataAxiosInstance.post(`/api/comment/attachment/${taskID}`, formdata)
62+
const response = await formDataAxiosInstance.post(`/api/comments/attachment/${taskID}`, formdata)
6863
return response.data
6964
}
7065

7166
export const patchComment = async (commentId: number, content: string) => {
72-
const response = await axiosInstance.patch(`/api/comment/${commentId}`, { content })
67+
const response = await axiosInstance.patch(`/api/comments/${commentId}`, { content })
7368
return response.data
7469
}
7570

7671
export const deleteComment = async (commentId: number) => {
77-
const response = await axiosInstance.delete(`/api/comment/${commentId}`)
72+
const response = await axiosInstance.delete(`/api/comments/${commentId}`)
73+
return response.data
74+
}
75+
76+
export const patchTaskRequest = async (taskId: string, formdata: FormData) => {
77+
const response = await formDataAxiosInstance.patch(`/api/tasks/${taskId}`, formdata)
7878
return response.data
7979
}

src/assets/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
body {
1313
font-family: 'SUIT-Variable', sans-serif;
14-
color: #18181B;
14+
color: #18181b;
1515
}
1616

1717
.shadow-custom {

src/components/EditInformation.vue

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<div class="profile">
1111
<p class="text-body text-xs font-bold">프로필 사진</p>
1212
<img
13-
v-if="previewUrl || info.imageUrl"
14-
:src="previewUrl || info.imageUrl"
13+
v-if="previewUrl || info.profileImageUrl"
14+
:src="previewUrl || info.profileImageUrl"
1515
alt="프로필 이미지"
1616
class="w-24 h-24 rounded-full object-cover border mt-3" />
1717

@@ -33,7 +33,7 @@
3333
<input
3434
class="input-box h-11 mt-2 text-black"
3535
placeholder="이름을 입력해주세요"
36-
v-model="info.memberName" />
36+
v-model="info.name" />
3737
</div>
3838
<div class="flex flex-col">
3939
<p class="text-body text-xs font-bold">아이디</p>
@@ -55,17 +55,17 @@
5555
<p class="text-body text-xs font-bold">알림 수신 여부</p>
5656
<div class="flex flex-col mt-2 gap-2">
5757
<FormCheckbox
58-
v-model="memberForm.isAgitChecked"
58+
v-model="info.notificationSettingInfo.agit"
5959
:checkButtonName="'아지트'"
60-
:isChecked="memberForm.isAgitChecked" />
60+
:isChecked="info.notificationSettingInfo.agit" />
6161
<FormCheckbox
62-
v-model="memberForm.isKakaoWorkChecked"
62+
v-model="info.notificationSettingInfo.kakaoWork"
6363
:checkButtonName="'카카오워크'"
64-
:isChecked="memberForm.isKakaoWorkChecked" />
64+
:isChecked="info.notificationSettingInfo.kakaoWork" />
6565
<FormCheckbox
66-
v-model="memberForm.isEmailChecked"
66+
v-model="info.notificationSettingInfo.email"
6767
:checkButtonName="'이메일'"
68-
:isChecked="memberForm.isEmailChecked" />
68+
:isChecked="info.notificationSettingInfo.email" />
6969
</div>
7070
</div>
7171
<div>
@@ -94,8 +94,7 @@ import FormCheckbox from './common/FormCheckbox.vue'
9494
const router = useRouter()
9595
import { useMemberStore } from '@/stores/member'
9696
import { storeToRefs } from 'pinia'
97-
import { patchEditInfo } from '@/api/user'
98-
import
97+
import { patchEditInfo } from '@/api/common'
9998
10099
const memberStore = useMemberStore()
101100
const { info } = storeToRefs(memberStore)
@@ -105,20 +104,6 @@ const previewUrl = ref<string | null>(null)
105104
106105
const isModalVisible = ref(false)
107106
108-
const memberForm = ref({
109-
isAgitChecked: false,
110-
isKakaoWorkChecked: false,
111-
isEmailChecked: false
112-
})
113-
114-
const formData = new FormData()
115-
116-
const requestData: any = {
117-
name: info.value.memberName,
118-
agitNotification: memberForm.value.isAgitChecked,
119-
emailNotification: memberForm.value.isEmailChecked,
120-
kakaoWorkNotification: memberForm.value.isKakaoWorkChecked
121-
}
122107
const handleCancel = () => {
123108
router.back()
124109
}
@@ -136,9 +121,30 @@ const handleFileUpload = (event: Event) => {
136121
}
137122
}
138123
139-
const handleSubmit = () => {
140-
isModalVisible.value = true
141-
console.log(requestData)
142-
patchEditInfo(requestData, selectedFile.value)
124+
const handleSubmit = async () => {
125+
const formData = new FormData()
126+
const memberInfo = {
127+
name: info.value.name,
128+
agitNotification: info.value.notificationSettingInfo.agit,
129+
emailNotification: info.value.notificationSettingInfo.email,
130+
kakaoWorkNotification: info.value.notificationSettingInfo.kakaoWork
131+
}
132+
133+
const jsonMemberInfo = JSON.stringify(memberInfo)
134+
const newBlob = new Blob([jsonMemberInfo], { type: 'application/json' })
135+
136+
formData.append('memberInfo', newBlob)
137+
138+
if (selectedFile.value) {
139+
formData.append('profileImage', selectedFile.value)
140+
}
141+
142+
try {
143+
await patchEditInfo(formData)
144+
isModalVisible.value = true
145+
await memberStore.updateMemberInfoWithToken()
146+
} catch (error) {
147+
console.error('요청 실패:', error)
148+
}
143149
}
144150
</script>
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<template>
2+
<div class="w-full flex flex-col gap-y-6">
3+
<CategoryDropDown
4+
v-model="category1"
5+
:options="mainCategoryArr"
6+
:label-name="'1차 카테고리'"
7+
:placeholderText="'1차 카테고리를 선택해주세요'"
8+
:isDisabled="false" />
9+
<CategoryDropDown
10+
v-model="category2"
11+
:options="afterSubCategoryArr"
12+
:label-name="'2차 카테고리'"
13+
:placeholderText="'2차 카테고리를 선택해주세요'"
14+
:isDisabled="!category1" />
15+
<RequestTaskInput
16+
v-model="title"
17+
:placeholderText="'제목을 입력해주세요'"
18+
:label-name="'제목'"
19+
:is-invalidate="isInvalidate" />
20+
<RequestTaskTextArea
21+
v-model="description"
22+
:placeholderText="'부가 정보를 입력해주세요'" />
23+
<RequestTaskFileInput v-model="file" />
24+
<FormButtonContainer
25+
:handleCancel="handleCancel"
26+
:handleSubmit="handleSubmit"
27+
cancelText="취소"
28+
submitText="요청" />
29+
<ModalView
30+
:isOpen="isModalVisible"
31+
:type="'successType'"
32+
@close="handleCancel">
33+
<template #header>작업이 요청되었습니다</template>
34+
</ModalView>
35+
</div>
36+
</template>
37+
38+
<script lang="ts" setup>
39+
import { getMainCategory, getSubCategory } from '@/api/common'
40+
import { getTaskDetailUser, patchTaskRequest, postTaskRequest } from '@/api/user'
41+
import type { Category, SubCategory } from '@/types/common'
42+
import type { AttachmentResponse } from '@/types/user'
43+
import { onMounted, ref, watch } from 'vue'
44+
import { useRouter } from 'vue-router'
45+
import FormButtonContainer from '../common/FormButtonContainer.vue'
46+
import ModalView from '../ModalView.vue'
47+
import CategoryDropDown from './CategoryDropDown.vue'
48+
import RequestTaskFileInput from './RequestTaskFileInput.vue'
49+
import RequestTaskInput from './RequestTaskInput.vue'
50+
import RequestTaskTextArea from './RequestTaskTextArea.vue'
51+
52+
const category1 = ref<Category | null>(null)
53+
const category2 = ref<Category | null>(null)
54+
55+
const title = ref('')
56+
const description = ref('')
57+
const file = ref(null as File[] | null)
58+
const isInvalidate = ref('')
59+
const isModalVisible = ref(false)
60+
61+
const mainCategoryArr = ref<Category[]>([])
62+
const subCategoryArr = ref<SubCategory[]>([])
63+
const afterSubCategoryArr = ref<SubCategory[]>([])
64+
const initFileArr = ref<AttachmentResponse[]>([])
65+
const isFirst = ref(true)
66+
67+
const { id, reqType } = defineProps<{ id: string; reqType: string }>()
68+
console.log(reqType, id, '가져온 값')
69+
70+
const router = useRouter()
71+
72+
const handleCancel = () => {
73+
router.back()
74+
}
75+
76+
onMounted(async () => {
77+
mainCategoryArr.value = await getMainCategory()
78+
subCategoryArr.value = await getSubCategory()
79+
afterSubCategoryArr.value = await getSubCategory()
80+
const data = await getTaskDetailUser(Number(id))
81+
console.log(data, '데이터')
82+
const selected = mainCategoryArr.value.find(ct => ct.name === data.mainCategoryName) || null
83+
category1.value = selected
84+
category2.value = subCategoryArr.value.find(ct => ct.name === data.categoryName) || null
85+
afterSubCategoryArr.value = subCategoryArr.value.filter(
86+
subCategory => subCategory.mainCategoryId === selected?.id
87+
)
88+
title.value = data.title
89+
description.value = data.description
90+
file.value = data.attachmentResponses.map((attachment: AttachmentResponse) => {
91+
return new File([attachment.fileUrl], attachment.fileName, { type: 'application/pdf' })
92+
})
93+
initFileArr.value = data.attachmentResponses
94+
})
95+
96+
watch(category1, async newValue => {
97+
if (isFirst.value) {
98+
isFirst.value = false
99+
} else {
100+
category2.value = null
101+
}
102+
afterSubCategoryArr.value = subCategoryArr.value.filter(
103+
subCategory => subCategory.mainCategoryId === newValue?.id
104+
)
105+
})
106+
107+
const handleSubmit = async () => {
108+
if (!category2.value) {
109+
isInvalidate.value = 'category'
110+
return
111+
} else if (!title.value) {
112+
isInvalidate.value = 'input'
113+
return
114+
}
115+
const formData = new FormData()
116+
117+
const attachmentsToDelete = initFileArr.value
118+
.filter(initFile => !file.value?.some(f => f.name === initFile.fileName))
119+
.map(initFile => initFile.fileId)
120+
121+
const taskInfo = {
122+
categoryId: category2.value.id,
123+
title: title.value,
124+
description: description.value
125+
}
126+
127+
const taskInfoEdit = {
128+
...taskInfo,
129+
attachmentsToDelete: attachmentsToDelete
130+
}
131+
132+
console.log(taskInfoEdit, '뭘 삭제할건지')
133+
134+
const jsonTaskInfo = JSON.stringify(taskInfoEdit)
135+
const newBlob = new Blob([jsonTaskInfo], { type: 'application/json' })
136+
formData.append('taskInfo', newBlob)
137+
138+
if (file.value && file.value.length > 0 && reqType === 'edit') {
139+
const newFiles = file.value.filter(
140+
f => !initFileArr.value.some(initFile => initFile.fileName === f.name)
141+
)
142+
newFiles.forEach(f => {
143+
console.log('첨부 파일:', f)
144+
formData.append('attachment', f)
145+
})
146+
} else {
147+
file.value?.forEach(f => {
148+
console.log('첨부 파일:', f)
149+
formData.append('attachment', f)
150+
})
151+
}
152+
153+
try {
154+
if (reqType === 're') {
155+
await postTaskRequest(formData)
156+
} else {
157+
await patchTaskRequest(id, formData)
158+
}
159+
isModalVisible.value = true
160+
} catch (error) {
161+
console.error('요청 실패:', error)
162+
}
163+
}
164+
</script>

src/components/task-detail/TaskDetailHistoryChat.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ const clickMenuDot = async () => {
7777
7878
const deleteCommentText = async () => {
7979
isClicked.value = !isClicked.value
80-
await deleteComment(history.historyId)
80+
if (history.details.commentDetails?.commentId !== undefined) {
81+
await deleteComment(history.details.commentDetails.commentId)
82+
}
8183
queryClient.invalidateQueries({ queryKey: ['historyData', taskId] })
8284
}
8385
</script>

src/components/task-detail/TaskDetailLeft.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
</div>
1515
<div>
1616
<p class="task-detail">부가 설명</p>
17-
<p class="px-6 py-4 bg-primary2 rounded-lg font-normal min-h-[120px]">{{ data.description }}</p>
17+
<p class="px-6 py-4 bg-primary2 rounded-lg font-normal min-h-[120px]">
18+
{{ data.description }}
19+
</p>
1820
</div>
1921
<div>
2022
<p class="task-detail">첨부 파일</p>

src/components/task-detail/TaskDetailTopBar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
<div class="flex gap-4 text-sm font-bold pb-6">
44
<div
55
v-if="isApproved && isRequestor"
6+
@click="router.push(`/task-request?requestType=re&id=${id}`)"
67
class="flex gap-1 items-center cursor-pointer">
78
<CommonIcons :name="reRequestIcon" />
89
<p class="text-body">재요청</p>
910
</div>
1011
<div
1112
v-if="!isApproved && isRequestor"
13+
@click="router.push(`/task-request?requestType=edit&id=${id}`)"
1214
class="flex gap-1 items-center cursor-pointer">
1315
<CommonIcons :name="modificationIcon" />
1416
<p class="text-primary1">요청 수정</p>
@@ -77,6 +79,4 @@ const ApproveTask = () => {
7779
toggleModal('approve')
7880
router.push(`/request-approve/${id}`)
7981
}
80-
81-
console.log(isProcessor, '이즈 프로세서 값')
8282
</script>

0 commit comments

Comments
 (0)