diff --git a/src/components/input/FormInput.vue b/src/components/input/FormInput.vue
index 731824c..904d89f 100644
--- a/src/components/input/FormInput.vue
+++ b/src/components/input/FormInput.vue
@@ -12,6 +12,7 @@
v-model="inputValue"
:maxLength="maxlength"
:placeholder="title"
+ :disabled="disabled"
/>
{{ title }}을 확인해주세요.
@@ -60,6 +61,10 @@ const props = defineProps({
default: true,
required: false,
},
+ disabled: {
+ type: Boolean,
+ default: false,
+ }
});
// Emits 정의
diff --git a/src/components/input/FormSelect.vue b/src/components/input/FormSelect.vue
index 04b88f6..1115ea7 100644
--- a/src/components/input/FormSelect.vue
+++ b/src/components/input/FormSelect.vue
@@ -5,7 +5,7 @@
*
-
@@ -37,6 +38,7 @@
:is-alert="wordTitleAlert"
:modelValue="titleValue"
@update:modelValue="wordTitle = $event"
+ :disabled="isDisabled"
/>
@@ -56,6 +58,13 @@ 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';
+import { useUserInfoStore } from '@s/useUserInfoStore';
+
+// 유저 구분
+const userStore = useUserInfoStore();
+
+// 유저 상태에 따른 disabled
+const isDisabled = computed(() => userStore.user.role !== 'ROLE_ADMIN');
const emit = defineEmits(['close','addCategory','addWord']);
@@ -73,6 +82,11 @@ const addCategoryAlert = ref(false);
//선택 카테고리
const selectCategory = ref('');
+// 제목 상태
+const computedTitle = computed(() =>
+ wordTitle.value === '' ? props.titleValue : wordTitle.value
+);
+
// 카테고리 상태
const selectedCategory = computed(() =>
selectCategory.value === '' ? props.formValue : selectCategory.value
@@ -104,15 +118,18 @@ const toggleInput = () => {
showInput.value = !showInput.value;
};
+
// 카테고리 저장
const saveInput = () => {
if(addCategory.value == ''){
addCategoryAlert.value = true;
return;
+ }else {
+ addCategoryAlert.value = false;
}
// console.log('입력값 저장됨!',addCategory.value);
emit('addCategory', addCategory.value);
- showInput.value = false;
+ // showInput.value = false;
};
const onChange = (newValue) => {
@@ -122,9 +139,9 @@ const onChange = (newValue) => {
//용어 등록
const saveWord = () => {
//validation
-
+
// 용어 체크
- if(wordTitle.value == ''){
+ if(computedTitle.value == '' || computedTitle.length == 0){
wordTitleAlert.value = true;
return;
}
@@ -137,7 +154,7 @@ const saveWord = () => {
const wordData = {
id: props.NumValue || null,
- title: wordTitle.value,
+ title: computedTitle.value,
category: selectedCategory.value,
content: content.value,
};
diff --git a/src/views/wordDict/wordDict.vue b/src/views/wordDict/wordDict.vue
index 68a060b..d027485 100644
--- a/src/views/wordDict/wordDict.vue
+++ b/src/views/wordDict/wordDict.vue
@@ -1,6 +1,6 @@
-
+
-
-
-
-
로딩 중...
+
+
+
+
로딩 중...
-
-
{{ error }}
+
+
{{ error }}
-
-
+
+
-
-
용어집의 용어가 없습니다.
+
+
용어집의 용어가 없습니다.
-
+
+
+