1010 <div class =" profile" >
1111 <p class =" text-body text-xs font-bold" >프로필 사진</p >
1212 <img
13- v-if =" imageUrl"
14- :src =" imageUrl"
13+ v-if =" previewUrl || info. imageUrl"
14+ :src =" previewUrl || info. imageUrl"
1515 alt =" 프로필 이미지"
1616 class =" w-24 h-24 rounded-full object-cover border mt-3" />
17- <div
18- v-else
19- class =" w-24 h-24 rounded-full bg-background-1 flex items-center justify-center mt-3" ></div >
20- <!-- 파일 업로드 필요 -->
21- <p class =" mt-3 text-xs text-primary1 font-bold cursor-pointer" >변경</p >
17+
18+ <label
19+ for =" fileInput"
20+ class =" mt-3 text-xs text-primary1 font-bold cursor-pointer"
21+ >변경</label
22+ >
23+ <input
24+ id =" fileInput"
25+ type =" file"
26+ @change =" handleFileUpload"
27+ accept =" image/*"
28+ class =" hidden" />
2229 </div >
2330
2431 <div class =" flex flex-col" >
2532 <p class =" text-body text-xs font-bold" >이름</p >
2633 <input
2734 class =" input-box h-11 mt-2 text-black"
2835 placeholder =" 이름을 입력해주세요"
29- v-model =" memberName" />
36+ v-model =" info. memberName" />
3037 </div >
3138 <div class =" flex flex-col" >
3239 <p class =" text-body text-xs font-bold" >아이디</p >
33- <p class =" mt-2 text-black" >{{ memberId }}</p >
40+ <p class =" mt-2 text-black" >{{ info.nickname }}</p >
3441 </div >
3542 <div class =" flex flex-col" >
3643 <p class =" text-body text-xs font-bold" >이메일</p >
37- <p class =" mt-2 text-black" >{{ memberEmail }}</p >
44+ <p class =" mt-2 text-black" >{{ info.email }}</p >
3845 </div >
3946 <div class =" flex flex-col" >
4047 <p class =" text-body text-xs font-bold" >부서</p >
41- <p class =" mt-2 text-black" >{{ memberDepartment }}</p >
48+ <p class =" mt-2 text-black" >{{ info.departmentName }}</p >
4249 </div >
4350 <div class =" flex flex-col" >
4451 <p class =" text-body text-xs font-bold" >직무</p >
45- <p class =" mt-2 text-black" >{{ memberJob }}</p >
52+ <p class =" mt-2 text-black" >{{ info.departmentRole }}</p >
4653 </div >
4754 <div >
4855 <p class =" text-body text-xs font-bold" >알림 수신 여부</p >
@@ -85,13 +92,17 @@ import ModalView from './ModalView.vue'
8592import FormButtonContainer from ' ./common/FormButtonContainer.vue'
8693import FormCheckbox from ' ./common/FormCheckbox.vue'
8794const router = useRouter ()
95+ import { useMemberStore } from ' @/stores/member'
96+ import { storeToRefs } from ' pinia'
97+ import { patchEditInfo } from ' @/api/user'
98+ import
99+
100+ const memberStore = useMemberStore ()
101+ const { info } = storeToRefs (memberStore )
102+
103+ const selectedFile = ref <File | null >(null )
104+ const previewUrl = ref <string | null >(null )
88105
89- const memberName = ref (' 백지연' )
90- const memberId = ref (' Chole.yeon' )
91- const memberEmail = ref (' taskflow123@gachon.ac.kr' )
92- const memberDepartment = ref (' 인프라팀' )
93- const memberJob = ref (' 인프라 아키텍처' )
94- const imageUrl = ref (' ' )
95106const isModalVisible = ref (false )
96107
97108const memberForm = ref ({
@@ -100,15 +111,34 @@ const memberForm = ref({
100111 isEmailChecked : false
101112})
102113
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+ }
103122const handleCancel = () => {
104123 router .back ()
105124}
106125
107- const handleSubmit = () => {
108- isModalVisible .value = true
109- }
110-
111126const handlePwChange = () => {
112127 router .push ('/pw-check' )
113128}
129+
130+ const handleFileUpload = (event : Event ) => {
131+ const target = event .target as HTMLInputElement
132+ if (target .files && target .files [0]) {
133+ selectedFile .value = target .files [0]
134+
135+ previewUrl .value = URL .createObjectURL (selectedFile .value )
136+ }
137+ }
138+
139+ const handleSubmit = () => {
140+ isModalVisible .value = true
141+ console .log (requestData )
142+ patchEditInfo (requestData , selectedFile .value )
143+ }
114144</script >
0 commit comments