mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
fix register notifaction
This commit is contained in:
@@ -100,7 +100,7 @@ function onregisterButtonClick(e: MouseEvent) {
|
||||
|
||||
formRef.value?.validate().then(async () => {
|
||||
isLoading.value = true
|
||||
await QueryPostAPI(
|
||||
await QueryPostAPI<string>(
|
||||
ACCOUNT_API_URL + 'register',
|
||||
{
|
||||
name: registerModel.value.username,
|
||||
@@ -111,6 +111,11 @@ function onregisterButtonClick(e: MouseEvent) {
|
||||
)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`注册成功`)
|
||||
cookie.value = data.data
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AccountInfo } from '@/api/api-models'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { ACCOUNT_API_URL, TURNSTILE_KEY } from '@/data/constants'
|
||||
import router from '@/router'
|
||||
import { NAlert, NButton, NCard, NSpace, NSpin, useMessage } from 'naive-ui'
|
||||
import { NAlert, NButton, NCard, NLayoutContent, NSpace, NSpin, useMessage } from 'naive-ui'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import VueTurnstile from 'vue-turnstile'
|
||||
@@ -15,39 +15,44 @@ const message = useMessage()
|
||||
const token = ref('')
|
||||
const route = useRoute()
|
||||
|
||||
const isLoading = ref(false)
|
||||
|
||||
async function VerifyAccount() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<AccountInfo>(
|
||||
ACCOUNT_API_URL + 'verify',
|
||||
{
|
||||
target: route.query.target,
|
||||
},
|
||||
[['Turnstile', token.value]]
|
||||
).then((data) => {
|
||||
)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
ACCOUNT.value = data.data
|
||||
message.success('成功激活账户: ' + ACCOUNT.value.name)
|
||||
router.push('/manage')
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
message.error('激活失败: ' + data.message)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NLayoutContent style="height: 100vh">
|
||||
<div style="display: flex; align-items: center; justify-content: center; height: 100%">
|
||||
<NCard v-if="accountInfo?.isEmailVerified != true" embedded style="max-width: 500px">
|
||||
<NCard embedded style="max-width: 500px">
|
||||
<template #header> 激活账户 </template>
|
||||
<NSpin :show="!token">
|
||||
<NSpace justify="center" align="center" vertical>
|
||||
<NButton @click="VerifyAccount" type="primary" size="large"> 进行账户激活 </NButton>
|
||||
<NButton @click="VerifyAccount" type="primary" size="large" :loading="isLoading || !token"> 进行账户激活 </NButton>
|
||||
<VueTurnstile :site-key="TURNSTILE_KEY" v-model="token" theme="auto" style="text-align: center" />
|
||||
</NSpace>
|
||||
</NSpin>
|
||||
</NCard>
|
||||
<NAlert v-else type="error">
|
||||
此账户已完成验证
|
||||
</NAlert>
|
||||
</div>
|
||||
</NLayoutContent>
|
||||
</template>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useAccount } from '@/api/account'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { HISTORY_API_URL } from '@/data/constants'
|
||||
import { NCard, NSpace, useMessage } from 'naive-ui'
|
||||
import { NAlert, NCard, NSpace, useMessage } from 'naive-ui'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { use } from 'echarts/core'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
@@ -400,14 +400,17 @@ function getOptions() {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (accountInfo.value?.isBiliVerified == true) {
|
||||
await getFansHistory()
|
||||
await getGuardsHistory()
|
||||
await getUpstatHistory()
|
||||
getOptions()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
|
||||
<NCard size="small">
|
||||
<NSpace vertical>
|
||||
<VChart :option="fansOption" style="height: 200px" />
|
||||
|
||||
Reference in New Issue
Block a user