master
parent
049545613e
commit
190f56d78f
@ -0,0 +1,35 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
import {
|
||||||
|
ADMIN_IMPERSONATION_FLAG_KEY,
|
||||||
|
PARTICIPANT_COMPETITION_SLUG_KEY,
|
||||||
|
TOKEN_KEY,
|
||||||
|
} from '../config/api'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
const error = ref('')
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const slug = String(route.params.slug ?? '').trim()
|
||||||
|
const token = String(route.query.token ?? '').trim()
|
||||||
|
if (!slug || !token) {
|
||||||
|
error.value = '代登参数无效'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem(TOKEN_KEY, token)
|
||||||
|
localStorage.setItem(PARTICIPANT_COMPETITION_SLUG_KEY, slug)
|
||||||
|
sessionStorage.setItem(ADMIN_IMPERSONATION_FLAG_KEY, '1')
|
||||||
|
|
||||||
|
void router.replace({ name: 'participant-apply', params: { slug } })
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="container py-5 text-center">
|
||||||
|
<p v-if="error" class="text-danger">{{ error }}</p>
|
||||||
|
<p v-else class="text-secondary">正在进入选手端…</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Loading…
Reference in new issue