mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
重构多个组件以优化代码格式和可读性,删除不必要的文件,更新类型定义,添加数据分析路由
This commit is contained in:
@@ -1,31 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { GetSelfAccount, useAccount } from '@/api/account'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { BILI_API_URL, BILI_AUTH_API_URL, CURRENT_HOST } from '@/data/constants'
|
||||
import { BILI_AUTH_API_URL, CURRENT_HOST } from '@/data/constants'
|
||||
import { useAuthStore } from '@/store/useAuthStore'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { randomUUID } from 'crypto'
|
||||
import {
|
||||
NFlex,
|
||||
NAlert,
|
||||
NButton,
|
||||
NCard,
|
||||
NCountdown,
|
||||
NFlex,
|
||||
NInput,
|
||||
NInputGroup,
|
||||
NInputNumber,
|
||||
NPopconfirm,
|
||||
NSpace,
|
||||
NSpin,
|
||||
NText,
|
||||
useMessage,
|
||||
NTimeline,
|
||||
NTimelineItem,
|
||||
NSteps,
|
||||
NStep,
|
||||
NPopconfirm,
|
||||
NSteps,
|
||||
NText,
|
||||
useMessage
|
||||
} from 'naive-ui'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { useAuthStore } from '@/store/useAuthStore'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
|
||||
type AuthStartModel = {
|
||||
code: string
|
||||
@@ -121,23 +116,55 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NFlex justify="center" align="center" style="height: 100vh">
|
||||
<NCard embedded style="margin: 20px; max-width: 1100px">
|
||||
<template #header> Bilibili 身份验证 </template>
|
||||
<NFlex
|
||||
justify="center"
|
||||
align="center"
|
||||
style="height: 100vh"
|
||||
>
|
||||
<NCard
|
||||
embedded
|
||||
style="margin: 20px; max-width: 1100px"
|
||||
>
|
||||
<template #header>
|
||||
Bilibili 身份验证
|
||||
</template>
|
||||
<NFlex :wrap="false">
|
||||
<NSteps :current="currentStep + 1" vertical style="max-width: 300px">
|
||||
<NStep title="准备认证" description="就是开始认证前的一个步骤" />
|
||||
<NStep title="进行认证" description="你需要在指定直播间输入一串验证码来证明自己的身份" />
|
||||
<NStep title="认证完成" description="现在就已经通过了认证!" />
|
||||
<NSteps
|
||||
:current="currentStep + 1"
|
||||
vertical
|
||||
style="max-width: 300px"
|
||||
>
|
||||
<NStep
|
||||
title="准备认证"
|
||||
description="就是开始认证前的一个步骤"
|
||||
/>
|
||||
<NStep
|
||||
title="进行认证"
|
||||
description="你需要在指定直播间输入一串验证码来证明自己的身份"
|
||||
/>
|
||||
<NStep
|
||||
title="认证完成"
|
||||
description="现在就已经通过了认证!"
|
||||
/>
|
||||
</NSteps>
|
||||
<template v-if="currentStep == 1">
|
||||
<NSpace vertical justify="center" align="center" style="width: 100%">
|
||||
<NSpace
|
||||
vertical
|
||||
justify="center"
|
||||
align="center"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template v-if="!timeOut">
|
||||
<NSpin />
|
||||
<span> 剩余 <NCountdown :duration="timeLeft" /> </span>
|
||||
<NInputGroup>
|
||||
<NInput :value="startModel?.code" :allow-input="() => false" />
|
||||
<NButton @click="copyCode"> 复制认证码 </NButton>
|
||||
<NInput
|
||||
:value="startModel?.code"
|
||||
:allow-input="() => false"
|
||||
/>
|
||||
<NButton @click="copyCode">
|
||||
复制认证码
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
<NButton
|
||||
type="primary"
|
||||
@@ -148,16 +175,19 @@ onMounted(async () => {
|
||||
前往直播间
|
||||
</NButton>
|
||||
</template>
|
||||
<NAlert v-else type="error">
|
||||
<NAlert
|
||||
v-else
|
||||
type="error"
|
||||
>
|
||||
认证超时
|
||||
<NButton
|
||||
type="error"
|
||||
@click="
|
||||
() => {
|
||||
currentStep = 0
|
||||
timeOut = false
|
||||
}
|
||||
"
|
||||
type="error"
|
||||
>
|
||||
重新开始
|
||||
</NButton>
|
||||
@@ -165,22 +195,53 @@ onMounted(async () => {
|
||||
</NSpace>
|
||||
</template>
|
||||
<template v-else-if="currentStep == 0">
|
||||
<NSpace vertical justify="center" align="center" style="width: 100%">
|
||||
<NSpace
|
||||
vertical
|
||||
justify="center"
|
||||
align="center"
|
||||
style="width: 100%"
|
||||
>
|
||||
<NAlert type="info">
|
||||
<NText>
|
||||
点击
|
||||
<NText type="primary" strong> 开始认证 </NText>
|
||||
<NText
|
||||
type="primary"
|
||||
strong
|
||||
>
|
||||
开始认证
|
||||
</NText>
|
||||
后请在 5 分钟之内使用
|
||||
<NText strong type="primary"> 需要认证的账户 </NText>
|
||||
<NText
|
||||
strong
|
||||
type="primary"
|
||||
>
|
||||
需要认证的账户
|
||||
</NText>
|
||||
在指定的直播间直播间内发送给出的验证码
|
||||
</NText>
|
||||
</NAlert>
|
||||
<NText depth="3" style="font-size: 15px"> 准备好了吗? </NText>
|
||||
<NButton size="large" type="primary" @click="onStartVerify"> 开始认证 </NButton>
|
||||
<NText
|
||||
depth="3"
|
||||
style="font-size: 15px"
|
||||
>
|
||||
准备好了吗?
|
||||
</NText>
|
||||
<NButton
|
||||
size="large"
|
||||
type="primary"
|
||||
@click="onStartVerify"
|
||||
>
|
||||
开始认证
|
||||
</NButton>
|
||||
</NSpace>
|
||||
</template>
|
||||
<template v-else-if="currentStep == 2">
|
||||
<NFlex justify="center" align="center" vertical style="width: 100%">
|
||||
<NFlex
|
||||
justify="center"
|
||||
align="center"
|
||||
vertical
|
||||
style="width: 100%"
|
||||
>
|
||||
<NAlert type="success">
|
||||
你已完成验证! 请妥善保存你的登陆链接, 请勿让其他人获取. 丢失后可以再次通过认证流程获得
|
||||
</NAlert>
|
||||
@@ -191,11 +252,23 @@ onMounted(async () => {
|
||||
type="textarea"
|
||||
:allow-input="() => false"
|
||||
/>
|
||||
<NButton @click="copyCode" type="info" style="height: 100%"> 复制登陆链接 </NButton>
|
||||
<NButton
|
||||
type="info"
|
||||
style="height: 100%"
|
||||
@click="copyCode"
|
||||
>
|
||||
复制登陆链接
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
<NFlex>
|
||||
<NButton @click="$router.push({ name: 'bili-user' })" type="primary"> 前往个人中心 </NButton>
|
||||
<NButton
|
||||
type="primary"
|
||||
@click="$router.push({ name: 'bili-user' })"
|
||||
>
|
||||
前往个人中心
|
||||
</NButton>
|
||||
<NPopconfirm
|
||||
positive-text="继续"
|
||||
@positive-click="
|
||||
() => {
|
||||
currentStep = 0
|
||||
@@ -204,10 +277,11 @@ onMounted(async () => {
|
||||
guidKey = uuidv4()
|
||||
}
|
||||
"
|
||||
positive-text="继续"
|
||||
>
|
||||
<template #trigger>
|
||||
<NButton type="warning"> 认证其他账号 </NButton>
|
||||
<NButton type="warning">
|
||||
认证其他账号
|
||||
</NButton>
|
||||
</template>
|
||||
这将会登出当前已认证的账号, 请先在认证其他账号前保存你的登陆链接
|
||||
</NPopconfirm>
|
||||
|
||||
Reference in New Issue
Block a user