优化 JWT 令牌的存储和使用逻辑;调整布局样式和组件属性

This commit is contained in:
2025-04-06 23:09:48 +08:00
parent d5c9e663da
commit eb306b66b0
14 changed files with 144 additions and 140 deletions

View File

@@ -219,7 +219,7 @@
data: [{ value: eventsPerSecond.value, name: '事件/秒' }]
}]
};
gaugeOption.value = option; // 保留原始option用于初始化
gaugeOption.value ??= option; // 保留原始option用于初始化
if (gaugeChart.value) {
gaugeChart.value.setOption(option, false);
}
@@ -239,7 +239,7 @@
markLine: { data: [{ type: 'average', name: '平均值' }] }
}]
};
//historyOption.value = option; // 保留原始option用于初始化
historyOption.value ??= option; // 保留原始option用于初始化
if (historyChart.value) {
historyChart.value.setOption(option, false);
}
@@ -259,7 +259,7 @@
labelLine: { show: false }, data: typeData
}]
};
typeDistributionOption.value = option; // 保留原始option用于初始化
typeDistributionOption.value ??= option; // 保留原始option用于初始化
if (typeDistributionChart.value) {
typeDistributionChart.value.setOption(option, false);
}

View File

@@ -1,12 +1,11 @@
<script setup lang="ts">
import { useAccount } from '@/api/account';
import { useWebFetcher } from '@/store/useWebFetcher';
import { openUrl } from '@tauri-apps/plugin-opener';
import { cookie, useAccount } from '@/api/account';
import { useWebFetcher } from '@/store/useWebFetcher';
import { openUrl } from '@tauri-apps/plugin-opener';
import { useElementSize } from '@vueuse/core';
import { roomInfo, streamingInfo } from './data/info';
import { roomInfo, streamingInfo } from './data/info';
const accountInfo = useAccount();
const cookie = useLocalStorage('JWT_Token', '')
const webfetcher = useWebFetcher();
@@ -91,9 +90,7 @@ import { roomInfo, streamingInfo } from './data/info';
<template #header>
<NSpace align="center">
直播状态
<NTag
:type="!accountInfo.streamerInfo?.isStreaming ? 'error' : 'success'"
>
<NTag :type="!accountInfo.streamerInfo?.isStreaming ? 'error' : 'success'">
{{ !accountInfo.streamerInfo?.isStreaming ? '未直播' : '直播中' }}
</NTag>
</NSpace>
@@ -108,15 +105,13 @@ import { roomInfo, streamingInfo } from './data/info';
v-if="roomInfo?.user_cover"
style="position: relative"
>
<div
style="position: relative; width: 100%; max-width: 500px;"
>
<div style="position: relative; width: 100%; max-width: 500px;">
<NImage
ref="coverRef"
:src="roomInfo?.user_cover"
style="width: 100%; opacity: 0.5; border-radius: 8px;"
referrerpolicy="no-referrer"
:img-props="{ referrerpolicy: 'no-referrer', style: { width: '100%'} }"
:img-props="{ referrerpolicy: 'no-referrer', style: { width: '100%' } }"
/>
</div>
<div

View File

@@ -244,6 +244,9 @@ import { CloudArchive24Filled, Settings24Filled } from '@vicons/fluent';
<NLayoutContent
class="main-layout-content"
:native-scrollbar="false"
:scrollbar-props="{
trigger: 'none'
}"
>
<div style="padding: 12px; padding-right: 15px;">
<RouterView v-slot="{ Component }">
@@ -278,7 +281,7 @@ import { CloudArchive24Filled, Settings24Filled } from '@vicons/fluent';
justify-content: center;
/* 计算高度,减去 WindowBar 的高度 (假设为 30px) */
height: calc(100vh - 30px);
background-color: #f8f8fa;
background-color: var(--n-color);
/* 可选:添加背景色 */
}

View File

@@ -29,6 +29,7 @@ export async function initAll() {
return;
}
let permissionGranted = await isPermissionGranted();
checkUpdate();
// If not we need to request it
if (!permissionGranted) {
@@ -117,6 +118,7 @@ export function OnClientUnmounted() {
async function checkUpdate() {
const update = await check();
console.log(update);
if (update) {
console.log(
`found update ${update.version} from ${update.date} with notes ${update.body}`