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

chore: 专家评分增加查看报告

上级 769b7bb3
...@@ -46,3 +46,8 @@ export function importScore(data: { competition_id: string; file: File }) { ...@@ -46,3 +46,8 @@ export function importScore(data: { competition_id: string; file: File }) {
headers: { 'Content-Type': 'multipart/form-data' } headers: { 'Content-Type': 'multipart/form-data' }
}) })
} }
// 获取大赛学员提交报告列表
export function getReportList(params: { competition_id: string; student_id: string }) {
return httpRequest.get('/api/lab/v1/expert/report/list', { params })
}
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { ArrowDown } from '@element-plus/icons-vue'
import { usePrecision } from '@vueuse/math' import { usePrecision } from '@vueuse/math'
import type { ReportItem } from '../types'
import { submitScore } from '../api' import { submitScore } from '../api'
defineProps<{ reportList: ReportItem[] }>()
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update'): void (e: 'update'): void
(e: 'update:modelValue', visible: boolean): void (e: 'update:modelValue', visible: boolean): void
...@@ -57,6 +60,20 @@ function handleSubmit() { ...@@ -57,6 +60,20 @@ function handleSubmit() {
<el-form-item label="赛项名称">{{ detail.competition_id_name }}</el-form-item> <el-form-item label="赛项名称">{{ detail.competition_id_name }}</el-form-item>
<el-form-item label="选手姓名">{{ detail.student_name }}</el-form-item> <el-form-item label="选手姓名">{{ detail.student_name }}</el-form-item>
<el-form-item label="选手ID">{{ detail.login_id }}</el-form-item> <el-form-item label="选手ID">{{ detail.login_id }}</el-form-item>
<el-form-item label="报告">
<el-dropdown>
<el-button text>
查看报告<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu v-if="reportList.length">
<el-dropdown-item v-for="item in reportList" :key="item.id">
<a :href="item.url" target="_blank">{{ item.platform.name }}</a>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-form-item>
</el-form> </el-form>
<el-table :data="tableList" :header-cell-style="{ background: '#ededed' }"> <el-table :data="tableList" :header-cell-style="{ background: '#ededed' }">
<el-table-column label="评分规则" prop="name" align="center"></el-table-column> <el-table-column label="评分规则" prop="name" align="center"></el-table-column>
......
...@@ -25,3 +25,17 @@ export interface FileItem { ...@@ -25,3 +25,17 @@ export interface FileItem {
url: string url: string
upload_time: string upload_time: string
} }
export interface ReportItem {
id: string
name: string
type: string
url: string
size: number
platform: {
platform_key: string
name: string
url: string
}
created_at: string
}
<script setup lang="ts"> <script setup lang="ts">
import type { ReportItem } from '../types'
import { ArrowDown } from '@element-plus/icons-vue'
import Preview from '@/components/Preview.vue' import Preview from '@/components/Preview.vue'
import DragPanel from '@/components/DragPanel.vue' import DragPanel from '@/components/DragPanel.vue'
import { getCheckView } from '../api' import { getCheckView, getReportList } from '../api'
const ScoreDialog = defineAsyncComponent(() => import('../components/ScoreDialog.vue')) const ScoreDialog = defineAsyncComponent(() => import('../components/ScoreDialog.vue'))
...@@ -18,13 +20,33 @@ provide('detail', $$(detail)) ...@@ -18,13 +20,33 @@ provide('detail', $$(detail))
const file = $computed(() => { const file = $computed(() => {
return detail ? JSON.parse(detail?.competition_rubric.url) : { url: '' } return detail ? JSON.parse(detail?.competition_rubric.url) : { url: '' }
}) })
function fetchInfo() {
getCheckView({ id: props.id }).then(res => { const platformUrl = ref('')
detail = res.data
}) const platformList = computed(() => {
} if (!detail) return []
return detail.competition_platform_configs.filter((item: any) => item.is_show === '1')
})
watchEffect(() => { watchEffect(() => {
fetchInfo() const [first = {}] = platformList.value
platformUrl.value = first.url
})
async function fetchInfo() {
const res = await getCheckView({ id: props.id })
detail = res.data
}
const reportList = ref<ReportItem[]>([])
async function fetchReport() {
const res = await getReportList({ competition_id: detail.competition_id, student_id: detail.student_id })
reportList.value = res.data.items
}
onMounted(async () => {
await fetchInfo()
await fetchReport()
}) })
// 评分 // 评分
...@@ -34,10 +56,6 @@ let resizeKey = $ref(0) ...@@ -34,10 +56,6 @@ let resizeKey = $ref(0)
function handleResize() { function handleResize() {
resizeKey = Date.now() resizeKey = Date.now()
} }
const goPage = function (url: string) {
window.open(url)
}
</script> </script>
<template> <template>
...@@ -66,11 +84,21 @@ const goPage = function (url: string) { ...@@ -66,11 +84,21 @@ const goPage = function (url: string) {
</p> </p>
</div> </div>
<div> <div>
<template v-for="item in detail.competition_platform_configs"> <el-select v-model="platformUrl">
<el-button type="primary" :key="item.id" v-if="item.is_show === '1'" @click="goPage(item.url)">{{ <el-option v-for="item in platformList" :key="item.id" :label="item.name" :value="item.url"></el-option>
item.name </el-select>
}}</el-button> <el-dropdown style="margin: 0 10px">
</template> <el-button plain>
查看报告<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu v-if="reportList.length">
<el-dropdown-item v-for="item in reportList" :key="item.id">
<a :href="item.url" target="_blank">{{ item.platform.name }}</a>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button type="primary" @click="dialogVisible = true" v-permission="'v1-expert-check-set-score'" <el-button type="primary" @click="dialogVisible = true" v-permission="'v1-expert-check-set-score'"
>评分</el-button >评分</el-button
> >
...@@ -78,11 +106,11 @@ const goPage = function (url: string) { ...@@ -78,11 +106,11 @@ const goPage = function (url: string) {
</el-row> </el-row>
</AppCard> </AppCard>
<div class="lab-box"> <div class="lab-box">
<iframe :src="detail.competition_uri" frameborder="0" class="iframe" ref="iframeRef"></iframe> <iframe :src="platformUrl" frameborder="0" class="iframe" ref="iframeRef"></iframe>
</div> </div>
</template> </template>
</DragPanel> </DragPanel>
<ScoreDialog v-model="dialogVisible"></ScoreDialog> <ScoreDialog v-model="dialogVisible" :reportList="reportList"></ScoreDialog>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论