diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index 9d040f1..8cd2a6d 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -1,18 +1,28 @@ @@ -24,7 +34,20 @@ import QEditor from '@/components/editor/QEditor.vue'; import FormInput from '@/components/input/FormInput.vue'; import FormSelect from '@/components/input/FormSelect.vue'; -const emit = defineEmits(['close']); +const emit = defineEmits(['close','addCategory','addWord']); + +//용어제목 +const wordTitle =ref(''); +const addCategory =ref(''); +const content = ref(''); +const imageUrls = ref([]); + +//용어 Vaildation용 +const wordTitleAlert = ref(false); +const addcateAlert =ref(false); +const addCategoryAlert = ref(false); +//선택 카테고리 +const selectCategory = ref(''); const props = defineProps({ dataList: { @@ -46,12 +69,29 @@ const showInput = ref(false); // 카테고리 입력 토글 const toggleInput = () => { - howInput.value = !showInput.value; + showInput.value = !showInput.value; }; // 카테고리 저장 const saveInput = () => { - console.log('입력값 저장됨!'); + if( addCategory.value == ''){ + addCategoryAlert.value = true; + return; + } + console.log('입력값 저장됨!',addCategory.value); + emit('addCategory', addCategory.value); showInput.value = false; }; - \ No newline at end of file + +//용어 등록 +const saveWord = () => { + //validation 체크후 emit전송 수정해야함 + + const wordData = { + title: wordTitle.value, + category: selectCategory.value, + content: content.value, + }; + emit('addWord', wordData); +}; + diff --git a/src/views/wordDict/wordDict.vue b/src/views/wordDict/wordDict.vue index 7efb616..390a4c0 100644 --- a/src/views/wordDict/wordDict.vue +++ b/src/views/wordDict/wordDict.vue @@ -30,7 +30,7 @@
- +
@@ -69,7 +69,9 @@ import DictCard from '@/components/wordDict/DictCard.vue'; import DictWrite from '@/components/wordDict/DictWrite.vue'; import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue'; + import { useToastStore } from '@s/toastStore'; + const toastStore = useToastStore(); // 공통 const loading = ref(false); @@ -87,7 +89,7 @@ //선택된 알파벳 const selectedAlphabet = ref(''); - + // 검색 const searchText = ref(''); @@ -99,12 +101,12 @@ getwordList(); getwordCategory(); }); - + //용어 목록 const getwordList = (searchKeyword='', indexKeyword='', category='') => { axios.get('worddict/getWordList',{ //목록조회시 파라미터 전달 - params: { + params: { searchKeyword : searchKeyword, indexKeyword :indexKeyword, category : category @@ -157,6 +159,17 @@ isWriteVisible.value = !isWriteVisible.value; }; + //카테고리 등록 + const addCategory = (data) =>{ + axios.post('worddict/insertCategory',{ + CMNCODNAM: data + }).then(res=>{ + if(res.data.data == '1'){ + toastStore.onToast('카테고리가 등록되었습니다.', 's'); + } + }) + } + //용어 등록 @@ -172,4 +185,4 @@ margin-bottom: 0.5rem !important; } } - \ No newline at end of file +