feat: 注册页面和管理员登录时新用户审核提醒
This commit is contained in:
17
app.vue
17
app.vue
@@ -2,13 +2,14 @@
|
||||
import ModalAuthentication from '~/components/ModalAuthentication.vue'
|
||||
|
||||
const toast = useToast()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const modal = useModal()
|
||||
const loginState = useLoginState()
|
||||
|
||||
useHead({
|
||||
titleTemplate(title) {
|
||||
return title ? `${ title } - 眩生花 AI 助手` : '眩生花 AI 助手'
|
||||
return title ? `${title} - AIGC 微课视频研创平台` : 'AIGC 微课视频研创平台'
|
||||
},
|
||||
})
|
||||
|
||||
@@ -17,7 +18,7 @@ useSeoMeta({
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
loginState.checkSession().then(res => {
|
||||
loginState.checkSession().then(async (res) => {
|
||||
if (!res && loginState.token) {
|
||||
toast.add({
|
||||
title: '登录失效',
|
||||
@@ -27,6 +28,8 @@ onMounted(() => {
|
||||
})
|
||||
modal.open(ModalAuthentication)
|
||||
} else if (!res && !loginState.token) {
|
||||
// Prevents redirect from register page
|
||||
if (route.path === '/user/register') return
|
||||
router.replace('/user/authenticate')
|
||||
}
|
||||
})
|
||||
@@ -35,14 +38,14 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<NuxtLoadingIndicator/>
|
||||
<NuxtLoadingIndicator />
|
||||
|
||||
<NuxtLayout>
|
||||
<NuxtPage/>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
|
||||
<UModals/>
|
||||
<USlideovers/>
|
||||
<UNotifications/>
|
||||
<UModals />
|
||||
<USlideovers />
|
||||
<UNotifications />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user