提交 43828ca1 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改大赛评分的精度

上级 bfdc5af0
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { usePrecision } from '@vueuse/math'
import { submitScore } from '../api' import { submitScore } from '../api'
...@@ -24,15 +25,16 @@ watchEffect(() => { ...@@ -24,15 +25,16 @@ watchEffect(() => {
// 最终得分 // 最终得分
// 评分 / 分值 * 占比 // 评分 / 分值 * 占比
const score = $computed<number>(() => { const score = $computed(() => {
// 未打分的列表 // 未打分的列表
const unScoreList = tableList.filter((item: any) => item.score === null || item.score === '') const unScoreList = tableList.filter((item: any) => item.score === null || item.score === '')
if (unScoreList.length) { if (unScoreList.length) {
return '--' return '--'
} }
return tableList.reduce((result: number, item: any) => { const output = tableList.reduce((result: number, item: any) => {
return (result += (item.score / item.old_score) * item.ratio || 0) return (result += (item.score / item.old_score) * item.ratio || 0)
}, 0) }, 0)
return usePrecision(output, 1).value
}) })
// 提交 // 提交
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import type { ContestVideoItem } from '../types' import type { ContestVideoItem } from '../types'
import { CirclePlus } from '@element-plus/icons-vue' import { CirclePlus } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useToFixed } from '@vueuse/math' import { usePrecision } from '@vueuse/math'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import ViewVideoPreviewDialog from './ViewVideoPreviewDialog.vue' import ViewVideoPreviewDialog from './ViewVideoPreviewDialog.vue'
import { getContestVideoList, deleteContestVideo } from '../api' import { getContestVideoList, deleteContestVideo } from '../api'
...@@ -30,7 +30,7 @@ const listOptions = { ...@@ -30,7 +30,7 @@ const listOptions = {
prop: 'duration', prop: 'duration',
computed({ row }: { row: ContestVideoItem }) { computed({ row }: { row: ContestVideoItem }) {
const duration = parseInt(row.duration) const duration = parseInt(row.duration)
return duration ? useToFixed(duration / 60, 2).value : 0 return duration ? usePrecision(duration / 60, 2).value : 0
} }
}, },
{ label: '创建人', prop: 'create_user.real_name' }, { label: '创建人', prop: 'create_user.real_name' },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论