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

chore: 大赛新增实操试卷

上级 83dd5a68
......@@ -152,15 +152,15 @@ export function deleteQuestion(data: { id: string }) {
export function getAllExamList(params: { competition_id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition-exam/list', { params })
}
// 添加大赛模块试卷
// 添加大赛试卷
export function createExam(data: { competition_id: string; exam_id: string; sort: string }) {
return httpRequest.post('/api/resource/v1/backend/competition-exam/create', data)
}
// 更新大赛模块试卷
// 更新大赛试卷
export function updateExam(data: { id: string; exam_id: string; sort: string }) {
return httpRequest.post('/api/resource/v1/backend/competition-exam/update', data)
}
// 删除大赛模块试卷
// 删除大赛试卷
export function deleteExam(data: { id: string }) {
return httpRequest.post('/api/resource/v1/backend/competition-exam/delete', data)
}
......@@ -25,7 +25,21 @@ const listOptions = {
columns: [
{ label: '序号', type: 'index', width: 60 },
{ label: '试卷名称', prop: 'exam_info.name' },
{ label: '模块', prop: 'sort' },
{
label: '试卷类型',
prop: 'type',
computed({ row }: { row: any }) {
const map: Record<string, string> = { '1': '正式比赛试卷', '2': '训练试卷' }
return map[row.type] || row.type
}
},
{
label: '模块',
prop: 'sort',
computed({ row }: { row: any }) {
return row.type === '1' ? row.sort : ''
}
},
{ label: '创建人', prop: 'created_operator_name' },
{ label: '创建时间', prop: 'created_time' },
{ label: '更新时间', prop: 'updated_time' },
......
......@@ -21,6 +21,7 @@ const formRef = $ref<FormInstance>()
const form = reactive<any>({
competition_id: detail.id,
exam_id: '',
type: '1',
sort: 1,
platform_key: 'career_data_analysis'
})
......@@ -36,7 +37,7 @@ const isUpdate = $computed(() => {
return !!props.data?.id
})
const title = $computed(() => {
return isUpdate ? '编辑大赛模块试卷' : '新增大赛模块试卷'
return isUpdate ? '编辑大赛试卷' : '新增大赛试卷'
})
let examList = $ref<Record<string, any>[]>([])
......@@ -52,7 +53,7 @@ onMounted(() => {
// 提交
function handleSubmit() {
formRef?.validate().then(() => {
const params = Object.assign({}, pick(form, ['competition_id', 'exam_id', 'sort']))
const params = Object.assign({}, pick(form, ['competition_id', 'exam_id', 'sort', 'type']))
isUpdate ? handleUpdate(params) : handleCreate(params)
})
}
......@@ -78,12 +79,18 @@ function handleUpdate(params: any) {
<template>
<el-dialog :title="title" :close-on-click-modal="false" width="600px" @update:modelValue="$emit('update:modelValue')">
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
<el-form-item label="试卷类型" prop="type">
<el-radio-group v-model="form.type">
<el-radio label="1">正式比赛试卷</el-radio>
<el-radio label="2">训练试卷</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="试卷名称" prop="exam_id">
<el-select v-model="form.exam_id" filterable style="width: 100%">
<el-option v-for="item in examList" :key="item.exam_id" :label="item.name" :value="item.exam_id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="模块" prop="sort">
<el-form-item label="模块" prop="sort" v-if="form.type === '1'">
<el-select v-model="form.sort">
<el-option v-for="item in 6" :value="item" :key="item"></el-option>
</el-select>
......
......@@ -155,7 +155,7 @@ function handleExperts() {
<AppCard title="大赛试题">
<ViewQuestion :id="id"></ViewQuestion>
</AppCard>
<AppCard title="大赛模块试卷">
<AppCard title="大赛试卷">
<ViewExam :id="id"></ViewExam>
</AppCard>
<!-- 评分规则 -->
......
......@@ -51,12 +51,7 @@ export function getExperimentVideoPlayInfo(params: { source_id: string }) {
}
// 获取实验讨论交流
export function getExperimentDiscussList(params: {
competition_id: string
tag: number
page?: number
'per-page'?: number
}) {
export function getExperimentDiscussList(params: { competition_id: string; tag: number; page?: number; 'per-page'?: number }) {
return httpRequest.get('/api/lab/v1/student/competition/discussion-list', { params })
}
// 发表新话题
......@@ -93,14 +88,7 @@ export function getExperimentReport(params: { competition_id: string; platform_k
}
// 上传实验报告
export function uploadExperimentReport(data: {
competition_id: string
platform_key: string
name: string
url: string
size: number
desc: string
}) {
export function uploadExperimentReport(data: { competition_id: string; platform_key: string; name: string; url: string; size: number; desc: string }) {
return httpRequest.post('/api/lab/v1/student/competition/save-train-report', data)
}
......@@ -108,3 +96,8 @@ export function uploadExperimentReport(data: {
export function deleteExperimentReport(data: { id: string }) {
return httpRequest.post('/api/lab/v1/student/competition/delete-train-report', data)
}
// 获取实操试卷
export function getExperimentExam(params: { competition_id: string; platform_key: string; project: string }) {
return httpRequest.get('/api/lab/v1/student/competition/train-exams', { params })
}
<script setup lang="ts">
import { useCookies } from '@vueuse/integrations/useCookies'
import { getExperimentExam } from '../api'
interface Props {
competition_id: string
experiment_id?: any
}
const props = defineProps<Props>()
const route = useRoute()
const cookies = useCookies()
const list = ref<any[]>([])
// 当前选中的考试
const currentExam = computed(() => {
return list.value[0]
})
// 考试平台 URL
const examURL = computed(() => {
return `https://exam-show.ezijing.com/exam/${currentExam.value?.exam_id}?has_time=0&has_submit=0&has_save=1`
// return `https://dev.ezijing.com:5173/exam/7003551966412406784?has_time=0&has_submit=0&has_save=1`
})
async function fetchInfo() {
const res = await getExperimentExam({ competition_id: props.competition_id, platform_key: route.query?.type as string, project: 'x1' })
const resCookies = res.data.cookies
cookies.set(resCookies.key, resCookies.auth_key, { domain: '.ezijing.com', path: '/' })
list.value = res.data.items || []
}
onMounted(() => {
fetchInfo()
})
</script>
<template>
<iframe class="iframe" :src="examURL" frameborder="0" v-if="currentExam"></iframe>
<el-empty description="暂无数据" v-else />
</template>
......@@ -12,6 +12,7 @@ const Book = defineAsyncComponent(() => import('../components/Book.vue'))
const Video = defineAsyncComponent(() => import('../components/Video.vue'))
const Discuss = defineAsyncComponent(() => import('../components/Discuss.vue'))
const Result = defineAsyncComponent(() => import('../components/Result.vue'))
const Exam = defineAsyncComponent(() => import('../components/Exam.vue'))
const ReportDialog = defineAsyncComponent(() => import('../components/ReportDialog.vue'))
const route = useRoute()
......@@ -57,11 +58,9 @@ const cookies = useCookies(['TGC'])
let iframeKey = $ref(Date.now())
// 返回首页
function handleBackHome() {
ElMessageBox.confirm('此操作将会强制返回到实验室首页,您当前的操作内容有可能丢失,确定返回首页吗?', '提示').then(
() => {
iframeKey = Date.now()
}
)
ElMessageBox.confirm('此操作将会强制返回到实验室首页,您当前的操作内容有可能丢失,确定返回首页吗?', '提示').then(() => {
iframeKey = Date.now()
})
}
const iframeRef = $ref<HTMLIFrameElement>()
......@@ -127,10 +126,7 @@ const getExperimentId = computed(() => {
const item = competition?.train_platform_configs.find((item: any) => item.platform_key === route.query.type)
let value = '0'
if (item?.url) {
value =
item?.url.indexOf('experiment_id') !== -1
? item?.url.substring(item?.url.indexOf('experiment_id=') + 14, item?.url.length + 1)
: '0'
value = item?.url.indexOf('experiment_id') !== -1 ? item?.url.substring(item?.url.indexOf('experiment_id=') + 14, item?.url.length + 1) : '0'
}
return value
})
......@@ -157,6 +153,9 @@ const reportDialogVisible = $ref(false)
<el-tab-pane label="过程与结果" lazy>
<Result :competition_id="id" @update="fetchInfo"></Result>
</el-tab-pane>
<el-tab-pane label="实操试卷" lazy>
<Exam :competition_id="id"></Exam>
</el-tab-pane>
</el-tabs>
</div>
</template>
......@@ -174,10 +173,7 @@ const reportDialogVisible = $ref(false)
<div class="close-btn" @click="handleShowHead">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 86" aria-hidden="true" width="16" height="66">
<g fill="none" fill-rule="evenodd">
<path
class="path-wapper"
d="M0 0l14.12 8.825A4 4 0 0116 12.217v61.566a4 4 0 01-1.88 3.392L0 86V0z"
fill="#f8f9fa"></path>
<path class="path-wapper" d="M0 0l14.12 8.825A4 4 0 0116 12.217v61.566a4 4 0 01-1.88 3.392L0 86V0z" fill="#f8f9fa"></path>
<path
class="path-arrow"
style="transform: rotate(180deg); transform-origin: center"
......@@ -191,10 +187,7 @@ const reportDialogVisible = $ref(false)
</div>
</template>
</DragPanel>
<ReportDialog
v-model="reportDialogVisible"
:data="competition"
v-if="reportDialogVisible && competition"></ReportDialog>
<ReportDialog v-model="reportDialogVisible" :data="competition" v-if="reportDialogVisible && competition"></ReportDialog>
</template>
<!-- 上传报告 -->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论