提交 8c5e3e38 authored 作者: lhh's avatar lhh

update

上级 958ecf9b
...@@ -156,7 +156,7 @@ export function getAllExamList(params: { project: string; q?: string; name?: str ...@@ -156,7 +156,7 @@ export function getAllExamList(params: { project: string; q?: string; name?: str
return httpRequest.get('/api/resource/v1/backend/exam/search-all-exam', { params }) return httpRequest.get('/api/resource/v1/backend/exam/search-all-exam', { params })
} }
// 获取实验的理论考试列表 // 获取实验的理论考试列表
export function getExamList(params: { experiment_id: string }) { export function getExamList(params: { experiment_id: string, type: string }) {
return httpRequest.get('/api/resource/v1/backend/experiment/exam-list', { params }) return httpRequest.get('/api/resource/v1/backend/experiment/exam-list', { params })
} }
// 更新实验的理论考试 // 更新实验的理论考试
......
...@@ -8,6 +8,7 @@ const FormDialog = defineAsyncComponent(() => import('./ViewExamFormDialog.vue') ...@@ -8,6 +8,7 @@ const FormDialog = defineAsyncComponent(() => import('./ViewExamFormDialog.vue')
interface Props { interface Props {
id: string id: string
type: string
} }
const props = defineProps<Props>() const props = defineProps<Props>()
...@@ -17,7 +18,7 @@ const listOptions = { ...@@ -17,7 +18,7 @@ const listOptions = {
hasPagination: false, hasPagination: false,
remote: { remote: {
httpRequest: getExamList, httpRequest: getExamList,
params: { experiment_id: props.id }, params: { experiment_id: props.id, type: props.type },
callback(res: any) { callback(res: any) {
return res?.list ? { list: res.list } : { list: [] } return res?.list ? { list: res.list } : { list: [] }
} }
...@@ -28,7 +29,7 @@ const listOptions = { ...@@ -28,7 +29,7 @@ const listOptions = {
{ label: '创建人', prop: 'created_operator_name' }, { label: '创建人', prop: 'created_operator_name' },
{ label: '创建时间', prop: 'created_time' }, { label: '创建时间', prop: 'created_time' },
{ label: '更新时间', prop: 'updated_time' }, { label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x', width: 120 } { label: '操作', slots: 'table-x', width: 220 }
] ]
} }
...@@ -45,12 +46,12 @@ function handleUpdate(row: any) { ...@@ -45,12 +46,12 @@ function handleUpdate(row: any) {
dialogVisible = true dialogVisible = true
} }
// 查阅 // 查阅
// function handleView(row: any) { function handleView(row: any) {
// const [paper] = row.exam_info.paper_list const [paper] = row.exam_info.paper_list
// if (!paper) return if (!paper) return
// const qaURL = `${import.meta.env.VITE_QA_CENTER_URL}/paper/detail/${paper.paper_id}` const qaURL = `${import.meta.env.VITE_QA_CENTER_URL}/paper/detail/${paper.paper_id}`
// window.open(qaURL) window.open(qaURL)
// } }
// 删除 // 删除
function handleRemove(row: any) { function handleRemove(row: any) {
ElMessageBox.confirm('确定要删除吗?', '提示').then(() => { ElMessageBox.confirm('确定要删除吗?', '提示').then(() => {
...@@ -68,12 +69,34 @@ function onUpdateSuccess() { ...@@ -68,12 +69,34 @@ function onUpdateSuccess() {
<template> <template>
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-button type="primary" :icon="CirclePlus" @click="handleAdd" v-permission="'competition-book-create'">新增</el-button> <el-button type="primary" :icon="CirclePlus" @click="handleAdd" v-permission="'competition-book-create'"
>新增</el-button
>
</template> </template>
<template #table-x="{ row }"> <template #table-x="{ row }">
<el-button link round type="primary" @click="handleUpdate(row)" v-permission="'competition-book-update'">编辑</el-button> <el-button
<el-button link round type="danger" @click="handleRemove(row)" v-permission="'competition-book-delete'">删除</el-button> v-if="props.type === '2'"
link
round
type="primary"
@click="handleView(row)"
v-permission="'competition-book-update'"
>查阅</el-button
>
<el-button link round type="primary" @click="handleUpdate(row)" v-permission="'competition-book-update'"
>编辑</el-button
>
<el-button link round type="danger" @click="handleRemove(row)" v-permission="'competition-book-delete'"
>删除</el-button
>
</template> </template>
</AppList> </AppList>
<FormDialog v-model="dialogVisible" :id="id" :data="rowData" @update="onUpdateSuccess" v-if="dialogVisible"></FormDialog> <FormDialog
v-model="dialogVisible"
:id="id"
:type="props.type"
:data="rowData"
@update="onUpdateSuccess"
v-if="dialogVisible"
></FormDialog>
</template> </template>
...@@ -7,6 +7,7 @@ import { updateExam, getAllExamList } from '../api' ...@@ -7,6 +7,7 @@ import { updateExam, getAllExamList } from '../api'
interface Props { interface Props {
id: string id: string
data?: any data?: any
type: string
} }
const props = defineProps<Props>() const props = defineProps<Props>()
...@@ -48,7 +49,7 @@ onMounted(() => { ...@@ -48,7 +49,7 @@ onMounted(() => {
// 提交 // 提交
function handleSubmit() { function handleSubmit() {
formRef.value?.validate().then(() => { formRef.value?.validate().then(() => {
const params = Object.assign({}, pick(form, ['experiment_id', 'exam_id'])) const params = Object.assign({ type: props.type }, pick(form, ['experiment_id', 'exam_id']))
isUpdate ? handleUpdate(params) : handleUpdate(params) isUpdate ? handleUpdate(params) : handleUpdate(params)
}) })
} }
......
...@@ -31,6 +31,7 @@ export interface ExperimentItem { ...@@ -31,6 +31,7 @@ export interface ExperimentItem {
content: string content: string
procedure: string procedure: string
stu_commit_count: number stu_commit_count: number
exam_status?: string
} }
export interface ExperimentCreateItem { export interface ExperimentCreateItem {
......
...@@ -114,24 +114,53 @@ const dmlURL = computed(() => { ...@@ -114,24 +114,53 @@ const dmlURL = computed(() => {
<el-divider /> <el-divider />
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-button type="primary" :icon="CirclePlus" @click="selectClassVisible = true" v-permission="'v1-backend-experiment-class-add'">关联班级</el-button> <el-button
type="primary"
:icon="CirclePlus"
@click="selectClassVisible = true"
v-permission="'v1-backend-experiment-class-add'"
>关联班级</el-button
>
</template> </template>
<template #table-x="{ row }"> <template #table-x="{ row }">
<el-button type="primary" round @click="handleViewStudent(row)" v-permission="'v1-backend-experiment-class-students'">查看学生</el-button> <el-button
<el-button type="primary" round @click="handleStudentGroup(row)" v-permission="'v1-backend-experiment-class-teams'">学生分组</el-button> type="primary"
<el-button type="primary" round @click="handleRemoveClass(row)" v-permission="'v1-backend-experiment-class-add'">移除</el-button> round
@click="handleViewStudent(row)"
v-permission="'v1-backend-experiment-class-students'"
>查看学生</el-button
>
<el-button
type="primary"
round
@click="handleStudentGroup(row)"
v-permission="'v1-backend-experiment-class-teams'"
>学生分组</el-button
>
<el-button type="primary" round @click="handleRemoveClass(row)" v-permission="'v1-backend-experiment-class-add'"
>移除</el-button
>
</template> </template>
</AppList> </AppList>
</AppCard> </AppCard>
<AppCard title="理论考试"> <AppCard :title="detail?.exam_status === '0' ? '训练考试' : '理论考试'">
<ViewExam :id="id"></ViewExam> <ViewExam v-if="detail" :id="id" :type="detail?.exam_status === '0' ? '2' : '1'"></ViewExam>
</AppCard> </AppCard>
<!-- 关联班级 --> <!-- 关联班级 -->
<SelectClassDialog v-model="selectClassVisible" @update="handleRefetch" v-if="selectClassVisible"></SelectClassDialog> <SelectClassDialog v-model="selectClassVisible" @update="handleRefetch" v-if="selectClassVisible"></SelectClassDialog>
<!-- 学生分组 --> <!-- 学生分组 -->
<StudentGroupDialog v-model="studentGroupVisible" :data="rowData" v-if="studentGroupVisible && rowData"></StudentGroupDialog> <StudentGroupDialog
v-model="studentGroupVisible"
:data="rowData"
v-if="studentGroupVisible && rowData"
></StudentGroupDialog>
<!-- 查看学生 --> <!-- 查看学生 -->
<StudentListDialog v-model="studentListVisible" :data="rowData" :experimentId="id" v-if="studentListVisible && rowData"></StudentListDialog> <StudentListDialog
v-model="studentListVisible"
:data="rowData"
:experimentId="id"
v-if="studentListVisible && rowData"
></StudentListDialog>
<ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules> <ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules>
<ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules> <ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useCookies } from '@vueuse/integrations/useCookies' import { useCookies } from '@vueuse/integrations/useCookies'
import { getExperimentExamList } from '../api' import { getExperimentExamList } from '../api'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
interface Props { interface Props {
experiment_id: string experiment_id: string
...@@ -20,7 +22,7 @@ const currentExam = computed(() => { ...@@ -20,7 +22,7 @@ const currentExam = computed(() => {
// 考试平台 URL // 考试平台 URL
const examURL = computed(() => { const examURL = computed(() => {
if (!currentExam.value) return '' if (!currentExam.value) return ''
return `${import.meta.env.VITE_EXAM_SHOW_URL}/exam/${currentExam.value?.exam_id}` return appConfig.system !== 'x' ? `${import.meta.env.VITE_EXAM_SHOW_URL}/exam/${currentExam.value?.exam_id}` : `${import.meta.env.VITE_EXAM_SHOW_URL}/exam/${currentExam.value?.exam_id}?has_time=0&has_submit=0&has_save=1&show_answer=1`
// return `https://dev.ezijing.com:5173/exam/7003551966412406784?has_time=0&has_submit=0&has_save=1&show_answer=1` // return `https://dev.ezijing.com:5173/exam/7003551966412406784?has_time=0&has_submit=0&has_save=1&show_answer=1`
}) })
...@@ -38,13 +40,15 @@ onMounted(() => { ...@@ -38,13 +40,15 @@ onMounted(() => {
<template> <template>
<template v-if="currentExam"> <template v-if="currentExam">
<el-form label-suffix=":" label-position="top"> <el-form label-suffix=":" label-position="top" v-if="appConfig.system !== 'x'">
<el-form-item label="考试名称">{{ currentExam.exam_info.name }}</el-form-item> <el-form-item label="考试名称">{{ currentExam.exam_info.name }}</el-form-item>
<el-form-item label="考试时间">{{ currentExam.exam_info.start_time }}{{ currentExam.exam_info.end_time }}</el-form-item> <el-form-item label="考试时间">{{ currentExam.exam_info.start_time }}{{ currentExam.exam_info.end_time }}</el-form-item>
</el-form> </el-form>
<!-- <teleport to=".lab-box"> <div style="width: 100%;height: 100%;" v-else>
<iframe allowfullscreen class="iframe" :src="examURL" frameborder="0"></iframe> <iframe style="width: 100%;height: 100%;" allowfullscreen class="iframe" :src="examURL" frameborder="0"></iframe>
</teleport> --> </div>
<!-- <teleport to=".lab-box"> -->
<!-- </teleport> -->
</template> </template>
<el-empty description="暂无数据" v-else /> <el-empty description="暂无数据" v-else />
</template> </template>
...@@ -228,7 +228,7 @@ function handleReportPreviewReady() { ...@@ -228,7 +228,7 @@ function handleReportPreviewReady() {
</script> </script>
<template> <template>
<DragPanel @resize="handleResize" :isLeftShow="experimentInfo?.exam_status"> <DragPanel @resize="handleResize" v-if="appConfig.system !== 'x'">
<template #left> <template #left>
<div class="lab-left"> <div class="lab-left">
<el-form :model="form" label-suffix=":" hide-required-asterisk> <el-form :model="form" label-suffix=":" hide-required-asterisk>
...@@ -272,7 +272,112 @@ function handleReportPreviewReady() { ...@@ -272,7 +272,112 @@ function handleReportPreviewReady() {
</div> </div>
</template> </template>
<template #right> <template #right>
<div class="exam-status" v-if="experimentInfo?.exam_status === 1"> <AppCard>
<el-row justify="space-between">
<div>
<el-button type="primary" :icon="HomeFilled" :disabled="submitted" @click="handleBackHome"
>返回首页</el-button
>
<el-button type="primary" :disabled="disabled" @click="handleSubmit">提交实验</el-button>
</div>
<div>
<el-button type="primary" :disabled="disabled" :loading="screenshotLoading" @click="handleCapture"
>截图</el-button
>
<el-button type="primary" :disabled="disabled" @click="prepareDialogVisible = true">实验准备</el-button>
<el-button type="primary" :disabled="disabled" @click="resultDialogVisible = true">实验结果</el-button>
<el-button
type="primary"
:disabled="disabled"
v-if="experimentInfo?.report_upload_way === 2 && !experimentInfo?.is_commit_report"
>
<router-link :to="`/student/lab/report/${form.experiment_id}`" target="_blank">在线实验报告</router-link>
</el-button>
<el-button
type="primary"
:disabled="disabled"
@click="reportDialogVisible = true"
v-if="experimentInfo?.report_upload_way === 1 && !submitted"
>上传实验报告</el-button
>
<el-button type="primary" @click="handleReportView" v-if="experimentInfo?.is_commit_report"
>查看实验报告</el-button
>
<el-button
type="primary"
@click="handleReportExport"
v-if="detail?.status === 2 && experimentInfo?.is_commit_report"
>导出实验报告</el-button
>
</div>
</el-row>
</AppCard>
<div class="lab-box">
<el-empty description="您已经提交该实验,不能再进行操作,切换其他实验再做操作吧。" v-if="submitted" />
<iframe
allowfullscreen
:src="LAB_URL"
:key="iframeKey"
frameborder="0"
class="iframe"
ref="iframeRef"
v-else
></iframe>
</div>
</template>
</DragPanel>
<DragPanel v-else @resize="handleResize" :isLeftShow="experimentInfo?.exam_status">
<template #left>
<div class="lab-left">
<el-form :model="form" label-suffix=":" hide-required-asterisk>
<el-form-item label="请选择课程">
<el-select :model-value="form.course_id" @change="handleCourseChange" style="width: 100%">
<el-option v-for="item in courses" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="请选择实验" prop="experiment_id">
<el-select :model-value="form.experiment_id" @change="handleExperimentChange" style="width: 100%">
<el-option v-for="item in experimentList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-tabs type="border-card" v-model="tabActive">
<el-tab-pane :label="experimentInfo?.exam_status === 0 ? '实验训练' : '实验试题'" name="qa" lazy>
<!-- 判断问题 -->
<Exam :experiment_id="form.experiment_id" v-model="examURL" v-if="experimentInfo?.exam_status === 0"></Exam>
<Question :experiment_id="form.experiment_id" v-else></Question>
</el-tab-pane>
<el-tab-pane
label="理论考试"
name="exam"
lazy
v-if="experimentInfo?.exam_status === 1 && tabActive === 'exam'"
>
<Exam :experiment_id="form.experiment_id" v-model="examURL"></Exam>
</el-tab-pane>
<el-tab-pane label="实验信息" lazy>
<Info :data="experimentInfo"></Info>
</el-tab-pane>
<el-tab-pane label="案例原文" lazy>
<Case :course_id="form.course_id" :experiment_id="form.experiment_id" :key="resizeKey"></Case>
</el-tab-pane>
<el-tab-pane label="实训指导" lazy>
<Book :course_id="form.course_id" :experiment_id="form.experiment_id" :key="resizeKey"></Book>
</el-tab-pane>
<el-tab-pane label="操作视频" lazy>
<Video :course_id="form.course_id" :experiment_id="form.experiment_id"></Video>
</el-tab-pane>
<el-tab-pane label="讨论交流" lazy>
<Discuss :experiment_id="form.experiment_id"></Discuss>
</el-tab-pane>
<el-tab-pane label="过程与结果" lazy>
<Result :data="experimentInfo" @update="fetchExperimentRecord"></Result>
</el-tab-pane>
</el-tabs>
</div>
</template>
<template #right>
<div class="exam-status" v-if="appConfig.system === 'x' && experimentInfo?.exam_status === 1">
<el-button type="primary" @click="tabActive = 'qa'">实操系统</el-button> <el-button type="primary" @click="tabActive = 'qa'">实操系统</el-button>
<el-button type="primary" @click="tabActive = 'exam'">理论试题</el-button> <el-button type="primary" @click="tabActive = 'exam'">理论试题</el-button>
</div> </div>
...@@ -328,7 +433,7 @@ function handleReportPreviewReady() { ...@@ -328,7 +433,7 @@ function handleReportPreviewReady() {
v-else v-else
></iframe> ></iframe>
<div <div
style="padding:10px;background-color: #fff; max-width: 300px; min-width: 300px" style="padding: 10px; background-color: #fff; max-width: 300px; min-width: 300px"
v-if="experimentInfo?.exam_status === 1 && tabActive === 'qa'" v-if="experimentInfo?.exam_status === 1 && tabActive === 'qa'"
> >
<Question :experiment_id="form.experiment_id" :exam_status="experimentInfo?.exam_status"></Question> <Question :experiment_id="form.experiment_id" :exam_status="experimentInfo?.exam_status"></Question>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论