提交 844d951a authored 作者: lhh's avatar lhh

update

上级 2bbb9c98
......@@ -22,11 +22,10 @@ const typeText = $computed(() => {
const canTrain = $computed(() => {
return dayjs().isBefore(dayjs(parseInt(props.data.end_at) * 1000))
})
function handleTrain(url: string) {
window.open(url)
function handleTrain(id: string, type: string) {
// 训练计数
// updateTrainCount({ competition_id: props.data.id })
// router.push({ path: `/student/contest/lab/${props.data.id}` })
updateTrainCount({ competition_id: id })
router.push({ path: `/student/contest/lab/${id}`, query: { type: type } })
}
// 是否可以报名
const canJoin = $computed(() => {
......@@ -62,12 +61,12 @@ function formatDate(value: string) {
<div style="display: flex; flex-wrap: wrap">
<template v-for="item in data.train_platform_configs">
<el-button
v-if="item.is_show === '1'"
v-if="item.is_show === '1' && canTrain"
style="margin-bottom: 10px"
:key="item"
round
type="primary"
@click="handleTrain(item.url)"
@click="handleTrain(item.competition_id, item.platform_key)"
>{{ item.name }}</el-button
>
</template>
......
......@@ -12,6 +12,8 @@ const Video = defineAsyncComponent(() => import('../components/Video.vue'))
const Discuss = defineAsyncComponent(() => import('../components/Discuss.vue'))
const Result = defineAsyncComponent(() => import('../components/Result.vue'))
const route = useRoute()
interface Props {
id: string
}
......@@ -106,6 +108,12 @@ let resizeKey = $ref(0)
function handleResize() {
resizeKey = Date.now()
}
const competitionUrl = computed(() => {
const item = competition?.train_platform_configs.find((item: any) => item.platform_key === route.query?.type)
console.log(item, 'ite,', competition?.train_platform_configs)
return item?.url
})
</script>
<template>
......@@ -139,12 +147,8 @@ function handleResize() {
</el-row>
</AppCard>
<div class="lab-box">
<iframe
:src="competition?.train_platform_uri"
:key="iframeKey"
frameborder="0"
class="iframe"
ref="iframeRef"></iframe>
{{ competitionUrl }}
<iframe :src="competitionUrl" :key="iframeKey" frameborder="0" class="iframe" ref="iframeRef"></iframe>
</div>
</template>
</DragPanel>
......
......@@ -7,8 +7,10 @@ let eventOption: any = $ref([])
onMounted(() => {
getMyContestList().then((res: any) => {
eventOption = res.data.list
eventValue = eventOption[0].id
eventValue = eventOption[0]?.id
if (eventValue) {
scoreReport()
}
})
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论