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

update

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