수정사항

This commit is contained in:
dyhj625 2025-04-07 10:34:49 +09:00
parent 44cec4cccd
commit eb39a2a0b7
6 changed files with 196 additions and 156 deletions

View File

@ -812,3 +812,9 @@ input:checked + .slider:before {
.mr-1{
margin-right: 0.25rem !important;
}
.nickname-ellipsis {
white-space: nowrap;
max-width: 100px;
vertical-align: middle;
}

View File

@ -41,6 +41,8 @@
v-model="nickname"
placeholder="닉네임"
@input="clearAlert('nickname')"
@keypress="noSpace"
:maxlength="6"
/>
<!-- 닉네임 경고 메시지 -->
<div v-if="nicknameAlert" class="position-absolute text-danger small top-100 start-0">
@ -109,6 +111,10 @@
},
});
const noSpace = (e) => {
if (e.key === ' ') e.preventDefault();
};
const $common = inject('common');
const comment = ref('');
const password = ref('');

View File

@ -44,11 +44,17 @@
<table class="table">
<thead>
<tr>
<!-- 익명게시판은 'nickname', 나머지는 'writer' -->
<th class="text-center" style="width: 20%;">
<!-- 익명게시판은 '닉네임', 나머지는 '작성자' -->
<th class="text-start">
<div class="ms-4">
{{ selectedBoard === 'anonymous' ? '닉네임' : '작성자' }}
</div>
</th>
<th class="text-start" style="width: 65%;">
<div class="ms-4">
제목
</div>
</th>
<th class="text-center" style="width: 65%;">제목</th>
</tr>
</thead>
<tbody>
@ -58,11 +64,13 @@
style="cursor: pointer;"
@click="goDetail(post.id, selectedBoard)"
>
<td class="text-center small">
<td class="text-start nickname-ellipsis small">
<div class="ms-4">
{{ selectedBoard === 'anonymous' ? post.nickname : post.author }}
</div>
</td>
<td class="text-start fs-6">
<div class="ms-2">
<div class="ms-4">
{{ truncateTitle(post.title) }}
<span v-if="post.commentCount" class="text-danger ml-1 small">
[{{ post.commentCount }}]

View File

@ -80,7 +80,7 @@
<span v-if="isNewPost(notice.rawDate)" class="box-new badge text-white ms-2 fs-tiny"> N </span>
</div>
</td>
<td class="text-center">{{ notice.author }}</td>
<td class="text-start">{{ notice.author }}</td>
<td class="text-center">{{ notice.date }}</td>
<td class="text-center">{{ notice.views }}</td>
</tr>
@ -105,7 +105,7 @@
<span v-if="isNewPost(post.rawDate)" class="box-new badge text-white ms-2 fs-tiny">N</span>
</div>
</td>
<td class="text-center">{{ post.nickname ? post.nickname : post.author }}</td>
<td class="text-start nickname-ellipsis">{{ post.nickname ? post.nickname : post.author }}</td>
<td class="text-center">{{ post.date }}</td>
<td class="text-center">{{ post.views }}</td>
</tr>
@ -384,4 +384,5 @@
position: relative;
top: -1px;
}
</style>

View File

@ -50,6 +50,8 @@
v-model="nickname"
@update:alert="nicknameAlert = $event"
@input="validateNickname"
@keypress="noSpace"
:maxlength="6"
/>
<FormInput
title="비밀번호"
@ -146,6 +148,10 @@
const editorUploadedImgList = ref([]);
const editorDeleteImgList = ref([]);
const noSpace = (e) => {
if (e.key === ' ') e.preventDefault();
};
const fetchCategories = async () => {
const response = await axios.get('board/categories');
categoryList.value = response.data.data;
@ -206,7 +212,8 @@
const validateNickname = () => {
if (categoryValue.value === 300102) {
nicknameAlert.value = nickname.value.trim().length === 0;
nickname.value = nickname.value.replace(/\s/g, ''); //
nicknameAlert.value = nickname.value.length === 0 ;
} else {
nicknameAlert.value = false;
}

View File

@ -55,8 +55,11 @@
<ArrInput title="주소" name="address" v-model="form.address" :disabled="true" />
<UserFormInput title="전화번호" name="phone" :value="form.phone"
@update:data="form.phone = $event" @blur="checkPhoneDuplicate"
@update:data="form.phone = $event" @blur="checkPhoneDuplicateAndFormat"
:maxlength="11" @keypress="onlyNumber" />
<span v-if="phoneFormatError" class="text-danger invalid-feedback mt-1 d-block">
전화번호 형식이 올바르지 않습니다.
</span>
<span v-if="phoneDuplicated" class="text-danger invalid-feedback mt-1 d-block">
이미 사용 중인 전화번호입니다.
</span>
@ -142,6 +145,7 @@ const colorList = ref([]);
const password = ref({ current: '', new: '', confirm: '' });
const passwordError = ref(false);
const phoneFormatError = ref(false);
const showResetPw = ref(false);
const canResetPassword = computed(() => {
@ -174,10 +178,9 @@ return (
});
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
const defaultProfile = "img/avatars/default-Profile.jpg";
const getProfileImageUrl = (fileName) =>
fileName?.trim() ? `${baseUrl}upload/img/profile/${fileName}?t=${Date.now()}` : defaultProfile;
const defaultProfile = "/img/icons/icon.png";
const getProfileImageUrl = (profilePath) =>
profilePath && profilePath.trim() ? `${baseUrl}upload/img/profile/${profilePath}` : defaultProfile;
const profilePreviewStyle = computed(() => ({
width: '100px',
height: '100px',
@ -207,10 +210,19 @@ const onlyNumber = (e) => {
if (!/[0-9]/.test(e.key)) e.preventDefault();
};
const checkPhoneDuplicate = async () => {
const currentPhone = form.value.phone;
phoneDuplicated.value = currentPhone !== originalData.value.phone &&
!(await $api.get('/user/checkPhone', { params: { memberTel: currentPhone } })).data.data;
const checkPhoneDuplicateAndFormat = async () => {
const phone = form.value.phone.trim();
//
const phoneRegex = /^010\d{8}$/;
phoneFormatError.value = !phoneRegex.test(phone);
if (!phoneFormatError.value) {
phoneDuplicated.value = phone !== originalData.value.phone &&
!(await $api.get('/user/checkPhone', {
params: { memberTel: currentPhone },
})).data.data;
}
};
const handleColorUpdate = async (colorVal) => {