feat(web): 添加在线升级验证示例页并发布 v1.3.1
CI / verify (push) Canceled after 0s

This commit is contained in:
2026-09-27 18:58:26 +08:00
parent 163df0c5b0
commit 6074cfceca
9 changed files with 176 additions and 6 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "fonu-web",
"version": "1.3.0",
"version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fonu-web",
"version": "1.3.0",
"version": "1.3.1",
"dependencies": {
"@codemirror/commands": "^6.11.1",
"@codemirror/lang-javascript": "^6.2.5",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "fonu-web",
"private": true,
"version": "1.3.0",
"version": "1.3.1",
"packageManager": "npm@10.9.4",
"type": "module",
"scripts": {
+2
View File
@@ -123,6 +123,7 @@ import {
CogOutline,
DocumentTextOutline,
Ellipse,
FlashOutline,
GitNetworkOutline,
GridOutline,
LockClosedOutline,
@@ -203,6 +204,7 @@ const menuDefs = [
{ label: '公网反代', key: 'public-proxy', icon: ShieldCheckmarkOutline },
{ label: '日志中心', key: 'logs', icon: DocumentTextOutline },
{ label: '系统设置', key: 'settings', icon: CogOutline },
{ label: '示例页面', key: 'example', icon: FlashOutline },
]
const menuOptions = computed<MenuOption[]>(() =>
+7
View File
@@ -12,6 +12,7 @@ import FrpView from '../views/FrpView.vue'
import AgentView from '../views/AgentView.vue'
import ProxyRemoteView from '../views/ProxyRemoteView.vue'
import StatusPageView from '../views/StatusPageView.vue'
import ExampleView from '../views/ExampleView.vue'
const router = createRouter({
history: createWebHistory(),
@@ -80,6 +81,12 @@ const router = createRouter({
component: SettingsView,
meta: { title: '系统设置', description: '配置系统参数与运行策略' },
},
{
path: 'example',
name: 'example',
component: ExampleView,
meta: { title: '示例页面', description: '用于验证在线升级是否成功生效' },
},
],
},
],
+131
View File
@@ -0,0 +1,131 @@
<template>
<PageHeader title="示例页面" description="用于验证 Web 一键升级是否成功生效">
<template #actions>
<n-button :loading="refreshing" @click="refreshVersion">
<template #icon><n-icon :component="RefreshOutline" /></template>
刷新版本信息
</n-button>
</template>
</PageHeader>
<n-alert type="success" :bordered="false" class="example-alert" title="在线升级验证页面已生效">
当前页面由 v{{ version }} 提供。如果你是在升级后首次看到此页面,说明前端构建、镜像重建和服务重启均已成功。
</n-alert>
<div class="stats-row">
<StatCard label="当前版本" :value="`v${version}`" sub="来自 /api/version" tone="brand">
<template #icon><n-icon :component="CloudOutline" /></template>
</StatCard>
<StatCard label="升级验证" value="通过" sub="示例路由与菜单已加载" tone="green">
<template #icon><n-icon :component="CheckmarkCircleOutline" /></template>
</StatCard>
<StatCard label="验证时间" :value="checkedAt || '刚刚'" sub="页面最近一次读取版本的时间" tone="blue" value-small>
<template #icon><n-icon :component="FlashOutline" /></template>
</StatCard>
</div>
<FonuCard title="验证步骤" subtitle="用这个页面确认线上实例已经更新到目标版本">
<ol class="example-steps">
<li>在旧版本页面点击侧栏的「一键升级」。</li>
<li>等待容器重建完成,页面自动刷新或恢复访问。</li>
<li>打开侧栏「示例页面」,确认本页可访问。</li>
<li>确认页面上的版本号为 <span class="mono">v{{ version }}</span>。</li>
</ol>
</FonuCard>
<FonuCard title="验证结果" subtitle="用于确认当前前端资源与后端版本一致">
<div class="example-result">
<div><label>前端路由</label><span class="mono">/example</span></div>
<div><label>侧栏菜单</label><span>已加载「示例页面」</span></div>
<div><label>后端版本</label><span class="mono">{{ version }}</span></div>
<div><label>验证状态</label><StatusBadge kind="success" text="通过" /></div>
</div>
</FonuCard>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { NAlert, NButton, NIcon, useMessage } from 'naive-ui'
import {
CheckmarkCircleOutline,
CloudOutline,
FlashOutline,
RefreshOutline,
} from '@vicons/ionicons5'
import { api } from '../api/client'
import FonuCard from '../components/FonuCard.vue'
import PageHeader from '../components/PageHeader.vue'
import StatCard from '../components/StatCard.vue'
import StatusBadge from '../components/StatusBadge.vue'
import { formatDate } from '../utils/format'
const message = useMessage()
const version = ref(__APP_VERSION__)
const checkedAt = ref('')
const refreshing = ref(false)
async function refreshVersion() {
refreshing.value = true
try {
const result = await api.getVersion()
version.value = result.version || version.value
checkedAt.value = formatDate(new Date().toISOString())
} catch (error) {
message.error(error instanceof Error ? error.message : '读取版本失败')
} finally {
refreshing.value = false
}
}
onMounted(() => {
void refreshVersion()
})
</script>
<style scoped>
.example-alert {
margin-bottom: var(--fonu-space-5);
}
.stats-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: var(--fonu-space-4);
margin-bottom: var(--fonu-space-5);
}
.example-steps {
display: grid;
gap: 10px;
margin: 0;
padding-left: 22px;
color: var(--fonu-text-secondary);
line-height: 1.7;
}
.example-result {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--fonu-space-3);
}
.example-result > div {
display: grid;
gap: 4px;
padding: 12px 14px;
border: 1px solid var(--fonu-border);
border-radius: var(--fonu-radius-sm);
background: var(--fonu-bg);
}
.example-result label {
font-size: 12px;
color: var(--fonu-text-muted);
}
@media (max-width: 640px) {
.example-result {
grid-template-columns: 1fr;
}
}
</style>