캐릭터 챗봇 #74

Merged
klaus merged 33 commits from test into main 2025-09-10 06:26:03 +00:00
1 changed files with 2 additions and 57 deletions
Showing only changes of commit 38161af543 - Show all commits

View File

@ -19,23 +19,6 @@
캐릭터 추가
</v-btn>
</v-col>
<v-spacer />
<v-col cols="6">
<v-text-field
v-model="search_word"
label="캐릭터 이름 검색"
@keyup.enter="search"
>
<v-btn
slot="append"
color="#9970ff"
dark
@click="search"
>
검색
</v-btn>
</v-text-field>
</v-col>
</v-row>
<v-row>
<v-col>
@ -251,7 +234,7 @@
</template>
<script>
import { getCharacterList, searchCharacters, updateCharacter } from '@/api/character'
import { getCharacterList, updateCharacter } from '@/api/character'
export default {
name: "CharacterList",
@ -266,7 +249,6 @@ export default {
detail_title: '',
page: 1,
total_page: 0,
search_word: '',
characters: [],
selected_character: {}
}
@ -367,12 +349,7 @@ export default {
},
async next() {
if (this.search_word.length < 2) {
this.search_word = ''
await this.getCharacters()
} else {
await this.searchCharacters()
}
},
async getCharacters() {
@ -401,38 +378,6 @@ export default {
}
},
async search() {
this.page = 1
await this.searchCharacters()
},
async searchCharacters() {
if (this.search_word.length === 0) {
await this.getCharacters()
} else if (this.search_word.length < 2) {
this.notifyError('검색어를 2글자 이상 입력하세요.')
} else {
this.is_loading = true
try {
const response = await searchCharacters(this.search_word, this.page);
if (response && response.status === 200 && response.data && response.data.success === true) {
const data = response.data.data;
this.characters = data.content || [];
const total_page = Math.ceil((data.totalCount || 0) / 20);
this.total_page = total_page <= 0 ? 1 : total_page;
} else {
this.notifyError('응답 데이터가 없습니다.');
}
} catch (e) {
console.error('캐릭터 검색 오류:', e);
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.');
} finally {
this.is_loading = false;
}
}
}
}
}
</script>