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

chore: 学生端我的实验新增理论考试

上级 5e9dcb6d
...@@ -30,12 +30,7 @@ export function getExperimentVideoPlayInfo(params: { source_id: string }) { ...@@ -30,12 +30,7 @@ export function getExperimentVideoPlayInfo(params: { source_id: string }) {
} }
// 获取实验讨论交流 // 获取实验讨论交流
export function getExperimentDiscussList(params: { export function getExperimentDiscussList(params: { experiment_id: string; tag: number; page?: number; 'per-page'?: number }) {
experiment_id: string
tag: number
page?: number
'per-page'?: number
}) {
return httpRequest.get('/api/lab/v1/student/experiment-topic/list', { params }) return httpRequest.get('/api/lab/v1/student/experiment-topic/list', { params })
} }
// 发表新话题 // 发表新话题
...@@ -90,21 +85,11 @@ export function getExperimentReportTemplate(params: { experiment_id: string }) { ...@@ -90,21 +85,11 @@ export function getExperimentReportTemplate(params: { experiment_id: string }) {
return httpRequest.get('/api/lab/v1/student/experiment/report-template', { params }) return httpRequest.get('/api/lab/v1/student/experiment/report-template', { params })
} }
// 更新实验在线报告 // 更新实验在线报告
export function updateExperimentReport(data: { export function updateExperimentReport(data: { experiment_id: string; experiment_address: string; experiment_date: string; detail: string }) {
experiment_id: string
experiment_address: string
experiment_date: string
detail: string
}) {
return httpRequest.post('/api/lab/v1/student/experiment/upload-online-report', data) return httpRequest.post('/api/lab/v1/student/experiment/upload-online-report', data)
} }
// 缓存实验在线报告 // 缓存实验在线报告
export function cacheExperimentReport(data: { export function cacheExperimentReport(data: { experiment_id: string; experiment_address: string; experiment_date: string; detail: string }) {
experiment_id: string
experiment_address: string
experiment_date: string
detail: string
}) {
return httpRequest.post('/api/lab/v1/student/experiment/cache-online-report', data) return httpRequest.post('/api/lab/v1/student/experiment/cache-online-report', data)
} }
// 获取实验在线报告缓存 // 获取实验在线报告缓存
...@@ -130,3 +115,8 @@ export function getExperimentQuestionList(params: { experiment_id: string }) { ...@@ -130,3 +115,8 @@ export function getExperimentQuestionList(params: { experiment_id: string }) {
export function getExperimentQuestion(params: { experiment_id: string; id: string }) { export function getExperimentQuestion(params: { experiment_id: string; id: string }) {
return httpRequest.get('/api/lab/v1/student/experiment-question/detail', { params }) return httpRequest.get('/api/lab/v1/student/experiment-question/detail', { params })
} }
// 获取实验理论考试列表
export function getExperimentExamList(params: { experiment_id: string }) {
return httpRequest.get('/api/lab/v1/student/experiment-exam/exams', { params })
}
<script setup lang="ts">
import { useCookies } from '@vueuse/integrations/useCookies'
import { getExperimentExamList } from '../api'
interface Props {
experiment_id: string
}
const props = defineProps<Props>()
const model = defineModel()
const cookies = useCookies()
const list = ref<any[]>([])
// 当前选中的考试
const currentExam = computed(() => {
return list.value[0]
})
// 考试平台 URL
const examURL = computed(() => {
return `${import.meta.env.VITE_EXAM_SHOW_URL}/exam/${currentExam.value?.exam_id}`
// return `https://dev.ezijing.com:5173/exam/7003551966412406784?has_time=0&has_submit=0&has_save=1&show_answer=1`
})
async function fetchInfo() {
const res = await getExperimentExamList({ experiment_id: props.experiment_id })
const resCookies = res.data.cookies
cookies.set(resCookies.key, resCookies.auth_key, { domain: '.ezijing.com', path: '/' })
list.value = res.data.items || []
model.value = examURL.value
}
onMounted(() => {
fetchInfo()
})
</script>
<template>
<template v-if="currentExam">
<el-form label-suffix=":" label-position="top">
<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>
<!-- <teleport to=".lab-box">
<iframe class="iframe" :src="examURL" frameborder="0"></iframe>
</teleport> -->
</template>
<el-empty description="暂无数据" v-else />
</template>
...@@ -25,6 +25,7 @@ const ReportFilePreview = defineAsyncComponent(() => import('../components/Repor ...@@ -25,6 +25,7 @@ const ReportFilePreview = defineAsyncComponent(() => import('../components/Repor
const PrepareDialog = defineAsyncComponent(() => import('../components/PrepareDialog.vue')) const PrepareDialog = defineAsyncComponent(() => import('../components/PrepareDialog.vue'))
const ResultDialog = defineAsyncComponent(() => import('../components/ResultDialog.vue')) const ResultDialog = defineAsyncComponent(() => import('../components/ResultDialog.vue'))
const ReportPreview = defineAsyncComponent(() => import('../components/ReportPreview.vue')) const ReportPreview = defineAsyncComponent(() => import('../components/ReportPreview.vue'))
const Exam = defineAsyncComponent(() => import('../components/Exam.vue'))
const route = useRoute() const route = useRoute()
...@@ -93,9 +94,13 @@ watchEffect(() => { ...@@ -93,9 +94,13 @@ watchEffect(() => {
fetchExperimentRecord() fetchExperimentRecord()
}) })
const tabActive = ref('qa')
const examURL = ref('')
// 右侧 // 右侧
const cookies = useCookies(['TGC']) const cookies = useCookies(['TGC'])
const LAB_URL = computed(() => { const LAB_URL = computed(() => {
if (tabActive.value === 'exam' && examURL.value) return examURL.value
return experimentInfo?.type === 4 return experimentInfo?.type === 4
? `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}/trip/my?experiment_id=${form.experiment_id}` ? `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}/trip/my?experiment_id=${form.experiment_id}`
: `${appConfig.dmlURL || import.meta.env.VITE_LAB_URL}&token=${cookies.get('TGC')}` : `${appConfig.dmlURL || import.meta.env.VITE_LAB_URL}&token=${cookies.get('TGC')}`
...@@ -233,10 +238,13 @@ function handleReportPreviewReady() { ...@@ -233,10 +238,13 @@ function handleReportPreviewReady() {
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-tabs type="border-card"> <el-tabs type="border-card" v-model="tabActive">
<el-tab-pane label="实验试题" lazy> <el-tab-pane label="实验试题" name="qa" lazy>
<Question :experiment_id="form.experiment_id"></Question> <Question :experiment_id="form.experiment_id"></Question>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="理论考试" name="exam" lazy>
<Exam :experiment_id="form.experiment_id" v-model="examURL"></Exam>
</el-tab-pane>
<el-tab-pane label="实验信息" lazy> <el-tab-pane label="实验信息" lazy>
<Info :data="experimentInfo"></Info> <Info :data="experimentInfo"></Info>
</el-tab-pane> </el-tab-pane>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论