From 67d5bede3235ec1c48cbd86727cf7f92123ed45a Mon Sep 17 00:00:00 2001 From: khj0414 Date: Thu, 6 Feb 2025 10:29:08 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EC=9A=A9=EC=97=AC=EC=A7=91=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/wordDict/DictWrite.vue | 62 ++++++++++++++++++++++----- src/views/wordDict/wordDict.vue | 23 +++++++--- 2 files changed, 69 insertions(+), 16 deletions(-) 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 + From 69afdab9469f0c71bb6360d2bc78a6b4d2a1dd82 Mon Sep 17 00:00:00 2001 From: khj0414 Date: Thu, 6 Feb 2025 13:26:07 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EC=9A=A9=EC=96=B4=EC=A7=91=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/wordDict/DictWrite.vue | 20 +++++++++++++------- src/views/wordDict/wordDict.vue | 8 +++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index 8cd2a6d..3fd2826 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -1,11 +1,14 @@ @@ -36,19 +43,21 @@ import { defineProps, computed, ref, defineEmits } from 'vue'; import QEditor from '@/components/editor/QEditor.vue'; import FormInput from '@/components/input/FormInput.vue'; import FormSelect from '@/components/input/FormSelect.vue'; +import PlusBtn from '../button/PlusBtn.vue'; const emit = defineEmits(['close','addCategory','addWord']); //용어제목 -const wordTitle =ref(''); -const addCategory =ref(''); +const wordTitle = ref(''); +const addCategory = ref(''); const content = ref(''); const imageUrls = ref([]); //용어 Vaildation용 const wordTitleAlert = ref(false); -const addcateAlert =ref(false); +const wordContentAlert = ref(false); const addCategoryAlert = ref(false); + //선택 카테고리 const selectCategory = ref(''); @@ -77,27 +86,41 @@ const toggleInput = () => { // 카테고리 저장 const saveInput = () => { - if( addCategory.value == ''){ + if(addCategory.value == ''){ addCategoryAlert.value = true; return; } - console.log('입력값 저장됨!',addCategory.value); + // console.log('입력값 저장됨!',addCategory.value); emit('addCategory', addCategory.value); showInput.value = false; }; const onChange = (newValue) => { - selectCategory.value =newValue.target.value; + selectCategory.value = newValue.target.value; }; //용어 등록 const saveWord = () => { - //validation 체크후 emit전송 수정해야함 + //validation + + // 용어 체크 + if(wordTitle.value == ''){ + wordTitleAlert.value = true; + return; + } + + // 내용 체크 + if(content.value == ''){ + wordContentAlert.value = true; + return; + } + 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 a6c209b..36a8641 100644 --- a/src/views/wordDict/wordDict.vue +++ b/src/views/wordDict/wordDict.vue @@ -30,7 +30,7 @@
- +
@@ -61,7 +61,7 @@