feat(ui): 캐릭터 리스트 테이블 UI 개선
- 테이블 헤더 변경 (이름→캐릭터명, 설명→캐릭터 설명 등) - 이미지 크기 100x100으로 설정 - 캐릭터 설명, 말투, 대화 스타일을 보기 버튼으로 표시 - 다이얼로그를 통해 상세 내용 표시 기능 추가
This commit is contained in:
parent
49cd5a795b
commit
3783714c75
|
@ -50,16 +50,31 @@
|
||||||
이미지
|
이미지
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
이름
|
캐릭터명
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
설명
|
성별
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
상태
|
나이
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
생성일
|
캐릭터 설명
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
MBTI
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
말투
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
대화 스타일
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
등록일
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
수정일
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
관리
|
관리
|
||||||
|
@ -74,29 +89,45 @@
|
||||||
<td>{{ item.id }}</td>
|
<td>{{ item.id }}</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<v-img
|
<v-img
|
||||||
max-width="70"
|
max-width="100"
|
||||||
max-height="70"
|
max-height="100"
|
||||||
:src="item.imageUrl"
|
:src="item.imageUrl"
|
||||||
class="rounded-circle"
|
class="rounded-circle"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.name }}</td>
|
<td>{{ item.name }}</td>
|
||||||
<td style="max-width: 200px !important; word-break:break-all; height: auto;">
|
<td>{{ item.gender || '-' }}</td>
|
||||||
<vue-show-more-text
|
<td>{{ calculateAge(item.birthDate) }}</td>
|
||||||
:text="item.description"
|
<td>
|
||||||
:lines="3"
|
<v-btn
|
||||||
/>
|
small
|
||||||
|
color="info"
|
||||||
|
@click="showDetailDialog(item, 'description')"
|
||||||
|
>
|
||||||
|
보기
|
||||||
|
</v-btn>
|
||||||
|
</td>
|
||||||
|
<td>{{ item.mbti || '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="info"
|
||||||
|
@click="showDetailDialog(item, 'speechPattern')"
|
||||||
|
>
|
||||||
|
보기
|
||||||
|
</v-btn>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<v-chip
|
<v-btn
|
||||||
:color="item.isActive ? 'green' : 'red'"
|
|
||||||
text-color="white"
|
|
||||||
small
|
small
|
||||||
|
color="info"
|
||||||
|
@click="showDetailDialog(item, 'systemPrompt')"
|
||||||
>
|
>
|
||||||
{{ item.isActive ? '활성' : '비활성' }}
|
보기
|
||||||
</v-chip>
|
</v-btn>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.createdAt }}</td>
|
<td>{{ item.createdAt }}</td>
|
||||||
|
<td>{{ item.updatedAt || '-' }}</td>
|
||||||
<td>
|
<td>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<v-col>
|
||||||
|
@ -170,22 +201,49 @@
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
|
||||||
|
<!-- 상세 내용 다이얼로그 -->
|
||||||
|
<v-dialog
|
||||||
|
v-model="show_detail_dialog"
|
||||||
|
max-width="600px"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>
|
||||||
|
{{ detail_title }}
|
||||||
|
</v-card-title>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<v-card-text class="pt-4">
|
||||||
|
<div style="white-space: pre-wrap;">{{ detail_content }}</div>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
text
|
||||||
|
@click="closeDetailDialog"
|
||||||
|
>
|
||||||
|
닫기
|
||||||
|
</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VueShowMoreText from 'vue-show-more-text'
|
|
||||||
import { getCharacterList, searchCharacters, deleteCharacter as apiDeleteCharacter } from '@/api/character'
|
import { getCharacterList, searchCharacters, deleteCharacter as apiDeleteCharacter } from '@/api/character'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CharacterList",
|
name: "CharacterList",
|
||||||
|
|
||||||
components: { VueShowMoreText },
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
is_loading: false,
|
is_loading: false,
|
||||||
show_delete_confirm_dialog: false,
|
show_delete_confirm_dialog: false,
|
||||||
|
show_detail_dialog: false,
|
||||||
|
detail_type: '',
|
||||||
|
detail_content: '',
|
||||||
|
detail_title: '',
|
||||||
page: 1,
|
page: 1,
|
||||||
total_page: 0,
|
total_page: 0,
|
||||||
search_word: '',
|
search_word: '',
|
||||||
|
@ -207,6 +265,57 @@ export default {
|
||||||
this.$dialog.notify.success(message)
|
this.$dialog.notify.success(message)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
calculateAge(birthDate) {
|
||||||
|
if (!birthDate) return '-';
|
||||||
|
|
||||||
|
// birthDate가 YYYY-MM-DD 형식이라고 가정
|
||||||
|
const today = new Date();
|
||||||
|
const birth = new Date(birthDate);
|
||||||
|
|
||||||
|
let age = today.getFullYear() - birth.getFullYear();
|
||||||
|
const monthDiff = today.getMonth() - birth.getMonth();
|
||||||
|
|
||||||
|
// 생일이 아직 지나지 않았으면 나이에서 1을 뺌
|
||||||
|
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
|
||||||
|
age--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return age;
|
||||||
|
},
|
||||||
|
|
||||||
|
showDetailDialog(item, type) {
|
||||||
|
this.selected_character = item;
|
||||||
|
this.detail_type = type;
|
||||||
|
|
||||||
|
// 타입에 따라 제목과 내용 설정
|
||||||
|
switch(type) {
|
||||||
|
case 'description':
|
||||||
|
this.detail_title = '캐릭터 설명';
|
||||||
|
this.detail_content = item.description || '내용이 없습니다.';
|
||||||
|
break;
|
||||||
|
case 'speechPattern':
|
||||||
|
this.detail_title = '말투';
|
||||||
|
this.detail_content = item.speechPattern || '내용이 없습니다.';
|
||||||
|
break;
|
||||||
|
case 'systemPrompt':
|
||||||
|
this.detail_title = '대화 스타일';
|
||||||
|
this.detail_content = item.systemPrompt || '내용이 없습니다.';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.detail_title = '';
|
||||||
|
this.detail_content = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.show_detail_dialog = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
closeDetailDialog() {
|
||||||
|
this.show_detail_dialog = false;
|
||||||
|
this.detail_type = '';
|
||||||
|
this.detail_content = '';
|
||||||
|
this.detail_title = '';
|
||||||
|
},
|
||||||
|
|
||||||
showAddDialog() {
|
showAddDialog() {
|
||||||
// 페이지로 이동
|
// 페이지로 이동
|
||||||
this.$router.push('/character/form');
|
this.$router.push('/character/form');
|
||||||
|
|
Loading…
Reference in New Issue