|
@@ -38,13 +38,15 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
- <el-button type="primary" class="full-w" :disabled="!allowSubmit" @click="onEnter(0)">确定</el-button>
|
|
|
+ <el-button type="primary" class="full-w" :disabled="buttonDisabled" @click="onEnter(0)">{{
|
|
|
+ buttonText
|
|
|
+ }}</el-button>
|
|
|
</template>
|
|
|
</scoring-panel-container>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="ScoringPanel">
|
|
|
-import { watch, withDefaults, ref, defineComponent, useSlots, computed, nextTick, onMounted } from 'vue'
|
|
|
+import { watch, withDefaults, ref, defineComponent, useSlots, computed, nextTick, onMounted, onUnmounted } from 'vue'
|
|
|
|
|
|
import { ElButton } from 'element-plus'
|
|
|
import BaseDialog from '@/components/element/BaseDialog.vue'
|
|
@@ -54,6 +56,9 @@ import useVW from '@/hooks/useVW'
|
|
|
import useFetch from '@/hooks/useFetch'
|
|
|
import { sessionStorage } from '@/plugins/storage'
|
|
|
import bus from '@/utils/bus'
|
|
|
+import useMarkStore from '@/store/mark'
|
|
|
+
|
|
|
+const markStore = useMarkStore()
|
|
|
const props = withDefaults(
|
|
|
defineProps<{
|
|
|
/** 弹窗模式? */
|
|
@@ -160,12 +165,10 @@ const questionList = computed(() => {
|
|
|
const { mainNumber, mainTitle, questionList = [] } = questionStruct.value
|
|
|
|
|
|
// 更新分数端评卷时间
|
|
|
- const markLevelSpeedLimitList = questionStruct.value.markLevelSpeedLimitList
|
|
|
- ? JSON.parse(questionStruct.value.markLevelSpeedLimitList)
|
|
|
- : []
|
|
|
+ const markDelay = questionStruct.value.markDelay ? JSON.parse(questionStruct.value.markDelay) : []
|
|
|
const getMarkLevelSpeedLimit = (score: number): number => {
|
|
|
- if (markLevelSpeedLimitList.length) {
|
|
|
- const speedLimit = item.markLevelSpeedLimitList.find((limit) => {
|
|
|
+ if (markDelay.length) {
|
|
|
+ const speedLimit = markDelay.find((limit) => {
|
|
|
return limit.endScore >= score && limit.startScore <= score
|
|
|
})
|
|
|
return speedLimit?.minMarkTime || 0
|
|
@@ -188,6 +191,32 @@ const allowSubmit = computed(() => {
|
|
|
return filterArr.length === questionList.value?.length
|
|
|
})
|
|
|
|
|
|
+// 倒计时相关计算属性
|
|
|
+const isCountingDown = computed(() => markStore.isCountingDown)
|
|
|
+const buttonText = computed(() => markStore.buttonText)
|
|
|
+const buttonDisabled = computed(() => {
|
|
|
+ return isCountingDown.value || !allowSubmit.value
|
|
|
+})
|
|
|
+
|
|
|
+// 启动倒计时
|
|
|
+const startCountdown = () => {
|
|
|
+ const markSpeedLimit = questionList.value[activeIndex.value]?.markSpeedLimit
|
|
|
+ markStore.startCountdown(markSpeedLimit)
|
|
|
+}
|
|
|
+
|
|
|
+const currentQuestion = computed(() => {
|
|
|
+ return questionList.value[activeIndex.value]
|
|
|
+})
|
|
|
+
|
|
|
+// 监听questionList变化,启动倒计时
|
|
|
+watch(
|
|
|
+ () => currentQuestion.value,
|
|
|
+ () => {
|
|
|
+ startCountdown()
|
|
|
+ },
|
|
|
+ { immediate: true, deep: true }
|
|
|
+)
|
|
|
+
|
|
|
const getClass = (val: string, callback?: string) => {
|
|
|
return dialogMode.value ? val : callback || ''
|
|
|
}
|
|
@@ -256,6 +285,11 @@ bus.on('openScoreDialogByMouseRight', () => {
|
|
|
onToggleClick()
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+// 组件卸载时清除倒计时
|
|
|
+onUnmounted(() => {
|
|
|
+ markStore.clearCountdown()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|