|
@@ -27,12 +27,12 @@
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center justify-between">
|
|
<el-button
|
|
<el-button
|
|
ref="confirmButtonRef"
|
|
ref="confirmButtonRef"
|
|
- :disabled="!modelScore.length"
|
|
|
|
|
|
+ :disabled="buttonDisabled"
|
|
class="confirm-button"
|
|
class="confirm-button"
|
|
type="primary"
|
|
type="primary"
|
|
@click="onConfirmSubmit"
|
|
@click="onConfirmSubmit"
|
|
>
|
|
>
|
|
- 是(Y)
|
|
|
|
|
|
+ {{ buttonText }}
|
|
</el-button>
|
|
</el-button>
|
|
<el-button ref="cancelButtonRef" class="confirm-button" plain @click="onCancelSubmit">否(N)</el-button>
|
|
<el-button ref="cancelButtonRef" class="confirm-button" plain @click="onCancelSubmit">否(N)</el-button>
|
|
</div>
|
|
</div>
|
|
@@ -46,7 +46,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="ScoringPanelWithConfirm">
|
|
<script setup lang="ts" name="ScoringPanelWithConfirm">
|
|
-import { computed, ref, useAttrs, watch, nextTick, onMounted, onBeforeUnmount, unref } from 'vue'
|
|
|
|
|
|
+import { computed, ref, useAttrs, watch, nextTick, onMounted, onBeforeUnmount, unref, onUnmounted } from 'vue'
|
|
import { add } from '@/utils/common'
|
|
import { add } from '@/utils/common'
|
|
import { ElButton } from 'element-plus'
|
|
import { ElButton } from 'element-plus'
|
|
import ScoringPanel from '@/components/shared/ScoringPanel.vue'
|
|
import ScoringPanel from '@/components/shared/ScoringPanel.vue'
|
|
@@ -58,8 +58,16 @@ import { cloneDeep } from 'lodash-es'
|
|
import bus from '@/utils/bus'
|
|
import bus from '@/utils/bus'
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
import type { ExtractApiResponse } from '@/api/api'
|
|
import type { ExtractApiResponse } from '@/api/api'
|
|
|
|
+import useMarkStore from '@/store/mark'
|
|
|
|
+
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
+interface MarkDelayItem {
|
|
|
|
+ startScore: number
|
|
|
|
+ endScore: number
|
|
|
|
+ minMarkTime: number
|
|
|
|
+}
|
|
|
|
+
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
/** 显示隐藏 */
|
|
/** 显示隐藏 */
|
|
visible?: boolean
|
|
visible?: boolean
|
|
@@ -74,6 +82,8 @@ const props = defineProps<{
|
|
loading?: any
|
|
loading?: any
|
|
imageList?: string[]
|
|
imageList?: string[]
|
|
showAllPaperBtn?: boolean
|
|
showAllPaperBtn?: boolean
|
|
|
|
+ // 是否显示分数段倒计时
|
|
|
|
+ showLimitTime?: boolean
|
|
}>()
|
|
}>()
|
|
|
|
|
|
const attrs = useAttrs()
|
|
const attrs = useAttrs()
|
|
@@ -84,6 +94,8 @@ const emit = defineEmits<{
|
|
(e: 'update:score', scores: number[]): void
|
|
(e: 'update:score', scores: number[]): void
|
|
}>()
|
|
}>()
|
|
|
|
|
|
|
|
+const markStore = useMarkStore()
|
|
|
|
+
|
|
/** 给分面板显示隐藏 */
|
|
/** 给分面板显示隐藏 */
|
|
const modalVisible = useVModel(props, 'visible')
|
|
const modalVisible = useVModel(props, 'visible')
|
|
|
|
|
|
@@ -137,13 +149,38 @@ const totalScore = computed(() => {
|
|
|
|
|
|
const questionInfo = ref<ExtractApiResponse<'getQuestionStruct'>>()
|
|
const questionInfo = ref<ExtractApiResponse<'getQuestionStruct'>>()
|
|
|
|
|
|
|
|
+// 倒计时相关计算属性
|
|
|
|
+const buttonText = computed(() => (markStore.countdownTime > 0 ? `${markStore.countdownTime}s` : '是(Y)'))
|
|
|
|
+const buttonDisabled = computed(() => {
|
|
|
|
+ return markStore.countdownTime > 0 || !modelScore.value.length
|
|
|
|
+})
|
|
|
|
+
|
|
/** 提交 */
|
|
/** 提交 */
|
|
const onSubmit = (data: ExtractApiResponse<'getQuestionStruct'>) => {
|
|
const onSubmit = (data: ExtractApiResponse<'getQuestionStruct'>) => {
|
|
questionInfo.value = data
|
|
questionInfo.value = data
|
|
|
|
+
|
|
modalVisible.value = false
|
|
modalVisible.value = false
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
submitModalVisible.value = true
|
|
submitModalVisible.value = true
|
|
|
|
+ if (!props.showLimitTime) return
|
|
|
|
+
|
|
|
|
+ // 更新分数端评卷时间
|
|
|
|
+ const markDelay = questionInfo.value.markDelay
|
|
|
|
+ ? (JSON.parse(questionInfo.value.markDelay) as MarkDelayItem[])
|
|
|
|
+ : []
|
|
|
|
+ const getMarkLevelSpeedLimit = (score: number): number => {
|
|
|
|
+ if (markDelay.length) {
|
|
|
|
+ const speedLimit = markDelay.find((limit) => {
|
|
|
|
+ return limit.endScore >= score && limit.startScore <= score
|
|
|
|
+ })
|
|
|
|
+ return speedLimit?.minMarkTime || 0
|
|
|
|
+ } else {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ markStore.startCountdown(getMarkLevelSpeedLimit(totalScore.value))
|
|
}, 10)
|
|
}, 10)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -152,6 +189,7 @@ const onSubmit = (data: ExtractApiResponse<'getQuestionStruct'>) => {
|
|
const onCancelSubmit = () => {
|
|
const onCancelSubmit = () => {
|
|
modalVisible.value = true
|
|
modalVisible.value = true
|
|
submitModalVisible.value = false
|
|
submitModalVisible.value = false
|
|
|
|
+ markStore.clearCountdown()
|
|
}
|
|
}
|
|
|
|
|
|
/** 确认提交 */
|
|
/** 确认提交 */
|
|
@@ -169,6 +207,11 @@ const previewModalVisible = ref<boolean>(false)
|
|
const onViewPapers = () => {
|
|
const onViewPapers = () => {
|
|
previewModalVisible.value = true
|
|
previewModalVisible.value = true
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+onUnmounted(() => {
|
|
|
|
+ if (!props.showLimitTime) return
|
|
|
|
+ markStore.clearCountdown()
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|