5252 <input
5353 :class =" [
5454 'block w-full px-4 py-4 border rounded focus:outline-none h-11 mt-2 text-black',
55- isInvalid ? 'border-red-1' : 'border-border-1'
55+ isInvalid || isFull ? 'border-red-1' : 'border-border-1'
5656 ]"
5757 placeholder =" 이름을 입력해주세요"
5858 v-model =" name"
6464 class =" text-red-1 text-xs font-bold mt-1"
6565 >이름에는 특수문자가 포함될 수 없습니다.</span
6666 >
67+ <span
68+ v-show =" isFull"
69+ class =" text-red-1 text-xs font-bold mt-1"
70+ >이름은 1글자 이상, 10글자이하만 가능합니다.</span
71+ >
6772 </div >
6873 <div class =" flex flex-col" >
6974 <p class =" text-body text-xs font-bold" >아이디</p >
8691 <div >
8792 <p class =" text-body text-xs font-bold" >알림 수신 여부</p >
8893 <div class =" flex flex-col mt-2 gap-2" >
89- <FormCheckbox
90- v-model =" agitCheck"
91- :checkButtonName =" '아지트'"
92- :isChecked =" agitCheck" />
9394 <FormCheckbox
9495 v-model =" kakaoWorkCheck"
9596 :checkButtonName =" '카카오워크'"
@@ -134,7 +135,6 @@ const memberStore = useMemberStore()
134135const { info } = storeToRefs (memberStore )
135136
136137const name = ref (info .value .name )
137- const agitCheck = ref (info .value .notificationSettingInfo .agit )
138138const emailCheck = ref (info .value .notificationSettingInfo .email )
139139const kakaoWorkCheck = ref (info .value .notificationSettingInfo .kakaoWork )
140140const imageDelete = ref (info .value .profileImageUrl == null ? true : false )
@@ -143,6 +143,7 @@ const selectedFile = ref<File | null>(null)
143143const previewUrl = ref <string | null >(null )
144144
145145const isInvalid = ref (false )
146+ const isFull = ref (false )
146147const nameInput = ref <HTMLInputElement | null >(null )
147148
148149const isModalVisible = ref (false )
@@ -151,7 +152,6 @@ const isWarnningModalVisible = ref(false)
151152watchEffect (() => {
152153 if (info .value ) {
153154 name .value = info .value .name
154- agitCheck .value = info .value .notificationSettingInfo .agit
155155 emailCheck .value = info .value .notificationSettingInfo .email
156156 kakaoWorkCheck .value = info .value .notificationSettingInfo .kakaoWork
157157 }
@@ -160,8 +160,13 @@ watchEffect(() => {
160160const validateName = () => {
161161 const regex = / [!@#$%^&*(),. ?":{}|<>] / g
162162 isInvalid .value = regex .test (name .value )
163+ if (name .value .length > 10 || name .value .length < 1 ) {
164+ isFull .value = true
165+ } else {
166+ isFull .value = false
167+ }
163168
164- if (isInvalid .value ) {
169+ if (isInvalid .value || isFull . value ) {
165170 nextTick (() => {
166171 nameInput .value ?.focus ()
167172 })
@@ -175,7 +180,6 @@ const handlePwChange = () => {
175180 if (
176181 selectedFile .value ||
177182 info .value .name != name .value ||
178- info .value .notificationSettingInfo .agit != agitCheck .value ||
179183 info .value .notificationSettingInfo .kakaoWork != kakaoWorkCheck .value ||
180184 info .value .notificationSettingInfo .email != emailCheck .value
181185 ) {
@@ -209,12 +213,11 @@ const handleFileDelete = () => {
209213}
210214
211215const handleSubmit = async () => {
212- if (isInvalid .value == false ) {
216+ if (isInvalid .value == false && isFull . value == false ) {
213217 const formData = new FormData ()
214218 const memberInfo = {
215219 name: name .value ,
216220 isProfileImageDeleted: imageDelete .value ,
217- agitNotification: agitCheck .value ,
218221 emailNotification: emailCheck .value ,
219222 kakaoWorkNotification: kakaoWorkCheck .value
220223 }
0 commit comments