update alert

This commit is contained in:
2023-11-25 11:42:09 +08:00
parent f3b3e02120
commit 10d7f591fd
10 changed files with 218 additions and 75 deletions

View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import DanmakuClient from '@/data/DanmakuClient'
import { NAlert, NSpin, useMessage } from 'naive-ui'
import { VNode, onMounted, onUnmounted, ref } from 'vue'
const props = defineProps<{
component: VNode
}>()
const accountInfo = useAccount()
const message = useMessage()
let client = new DanmakuClient(null)
const isClientLoading = ref(true)
onMounted(async () => {
const result = await client.Start()
if (!result.success) {
message.error('无法启动弹幕客户端: ' + result.message)
}
isClientLoading.value = false
})
onUnmounted(() => {
client.Stop()
})
</script>
<template>
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
<NSpin v-else-if="isClientLoading" show />
<KeepAlive v-else>
<component :is="component" :client="client" :room-info="client.roomAuthInfo?.value" :code="accountInfo?.biliAuthCode"/>
</KeepAlive>
</template>

View File

@@ -66,7 +66,7 @@ const lotteryHistory = useStorage<LotteryHistory[]>('LotteryHistory', [])
const message = useMessage()
const notification = useNotification()
const token = ref()
const token = ref('')
const turnstile = ref()
const defaultOption = {
resultCount: 1,