Files
vtsuru.live/src/client/components/CookieInvalidAlert.vue
Megghy 6bccb4a0f4 feat: 优化弹幕窗口样式系统并添加 Cookie 状态监控
- 将 naive-ui 版本约束从固定版本改为 ^ 范围约束
- 重构弹幕窗口背景渲染:分离窗口背景和弹幕背景,支持独立配置
- 新增颜色解析工具函数 parseColorToRgba,支持 hex/rgba 格式及透明度提取
- 优化 CSS 变量系统:添加 --dw-bg-color-rgb、--dw-bg-alpha、--dw-window-bg-color 变量
- 改进弹幕窗口布局:使用独立背景层支持 backdrop-filter 和圆角边框
- 在
2025-11-26 14:42:56 +08:00

83 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { NAlert, NButton } from 'naive-ui'
import { useBiliCookie } from '../store/useBiliCookie'
const biliCookie = useBiliCookie()
const router = useRouter()
const props = withDefaults(defineProps<{
variant?: 'home' | 'fetcher'
}>(), {
variant: 'home',
})
const goToFetcher = () => {
router.push({ name: 'client-fetcher' })
}
const goToSettings = () => {
router.push({ name: 'client-settings' })
}
</script>
<template>
<NAlert
v-if="biliCookie.hasBiliCookie && !biliCookie.isCookieValid"
class="cookie-invalid-alert"
type="error"
:title="props.variant === 'home' ? '需重新登录 B 站账号' : 'EventFetcher 需要有效的 B 站 Cookie'"
:show-icon="true"
:bordered="false"
>
<div class="cookie-invalid-alert__content">
<p>
{{ props.variant === 'home'
? '检测到 B 站 Cookie 已失效,客户端功能将受限。'
: '请尽快同步或重新登录 Cookie以保证事件采集稳定运行。'
}}
</p>
<p>
如果已经部署 CookieCloud请尝试重新同步否则请重新扫码登录
</p>
<div class="cookie-invalid-alert__actions">
<NButton
size="small"
type="primary"
@click="goToFetcher"
>
前往 EventFetcher
</NButton>
<NButton
size="small"
tertiary
@click="goToSettings"
>
Cookie 设置
</NButton>
</div>
</div>
</NAlert>
</template>
<style scoped>
.cookie-invalid-alert {
width: 100%;
box-sizing: border-box;
}
.cookie-invalid-alert__content {
font-size: 13px;
line-height: 1.6;
color: rgb(51 54 57 / 90%);
}
.cookie-invalid-alert__actions {
margin-top: 8px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
</style>