Bläddra i källkod

feat: 给分板逻辑调整

chenhao 2 år sedan
förälder
incheckning
800a182f74

+ 7 - 0
src/components/shared/ScoringPanel.vue

@@ -17,6 +17,7 @@
           :modal="dialogMode"
           :toggle-modal="props.toggleModal && index === 0"
           :question="question"
+          @blur="() => onBlur(index)"
           @enter="() => onEnter(index)"
           @focused="() => onFocused(index)"
           @toggle-click="onToggleClick"
@@ -156,6 +157,12 @@ const onFocused = (index: number) => {
   activeIndex.value = index
 }
 
+const onBlur = (index: number) => {
+  if (activeIndex.value === index) {
+    activeIndex.value = null
+  }
+}
+
 const onToggleClick = () => {
   dialogMode.value = props.toggleModal ? !dialogMode.value : dialogMode.value
   if (!props.toggleModal) {

+ 5 - 4
src/components/shared/ScoringPanelItem.vue

@@ -91,7 +91,7 @@ const props = withDefaults(
   { modal: false, toggleModal: true, score: void 0, scoreValidFail: false }
 )
 
-const emits = defineEmits(['focused', 'toggle-click', 'enter', 'update:score'])
+const emit = defineEmits(['focused', 'blur', 'toggle-click', 'enter', 'update:score'])
 
 const dialogMode = ref<boolean>(props.modal)
 
@@ -155,13 +155,14 @@ const onSetScore = (v: number | string) => {
 
 const onInputFocus = () => {
   focused.value = true
-  emits('focused')
+  emit('focused')
 }
 
 const onBlur = (e: Event) => {
   focused.value = false
   const target = e.target as HTMLInputElement
   target.value && scoreStrictValidFail(target.value)
+  emit('blur')
 }
 
 const inputFocus = () => {
@@ -220,7 +221,7 @@ const onValidScore = (e: KeyboardEvent) => {
   if ('Enter' === e.key) {
     if (oldScore && !scoreStrictValidFail(oldScore)) {
       nextTick(() => {
-        emits('enter')
+        emit('enter')
       })
     }
     e.preventDefault()
@@ -255,7 +256,7 @@ const scoreChange = (e: Event) => {
 }
 
 const onToggleClick = () => {
-  emits('toggle-click')
+  emit('toggle-click')
 }
 </script>
 

+ 2 - 0
src/modules/admin-subject/edit-main-question/index.vue

@@ -35,6 +35,8 @@
             v-model="levelRangValues[index]"
             class="m-r-mini"
             size="small"
+            :min="0"
+            :max="100"
             :controls="false"
           ></el-input-number>
           %