WebUI 更新至 1.1.0 版本

1. 移除重启和关闭 Suan API 的按钮,因为按照目前的设计,这在技术上难以实现。
2. 增加 FastAPI docs 的配置选项。
This commit is contained in:
2026-04-28 20:03:22 +08:00
parent 3a38dcab00
commit 123cbf1dbb
5 changed files with 59 additions and 16 deletions
+2
View File
@@ -38,6 +38,7 @@ declare module 'vue' {
NSwitch: typeof import('naive-ui')['NSwitch'] NSwitch: typeof import('naive-ui')['NSwitch']
NTag: typeof import('naive-ui')['NTag'] NTag: typeof import('naive-ui')['NTag']
NText: typeof import('naive-ui')['NText'] NText: typeof import('naive-ui')['NText']
NTooltip: typeof import('naive-ui')['NTooltip']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
} }
@@ -71,6 +72,7 @@ declare global {
const NSwitch: typeof import('naive-ui')['NSwitch'] const NSwitch: typeof import('naive-ui')['NSwitch']
const NTag: typeof import('naive-ui')['NTag'] const NTag: typeof import('naive-ui')['NTag']
const NText: typeof import('naive-ui')['NText'] const NText: typeof import('naive-ui')['NText']
const NTooltip: typeof import('naive-ui')['NTooltip']
const RouterLink: typeof import('vue-router')['RouterLink'] const RouterLink: typeof import('vue-router')['RouterLink']
const RouterView: typeof import('vue-router')['RouterView'] const RouterView: typeof import('vue-router')['RouterView']
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "webui", "name": "webui",
"version": "1.0.0", "version": "1.1.0",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
+9 -1
View File
@@ -54,6 +54,7 @@ onMounted(async () => {
<sidebar-nav /> <sidebar-nav />
</div> </div>
<div id="center-content"> <div id="center-content">
<div id="extra-control" />
<div id="content-container"> <div id="content-container">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive> <keep-alive>
@@ -107,13 +108,20 @@ onMounted(async () => {
#center-content { #center-content {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
display: flex;
flex-direction: column;
#extra-control {
flex: 0;
}
#content-container { #content-container {
border: 1px solid #519f72; border: 1px solid #519f72;
border-radius: 10px; border-radius: 10px;
padding: 10px; padding: 10px;
height: 100%;
overflow: auto; overflow: auto;
height: 100%;
flex: 1;
} }
} }
} }
+46 -14
View File
@@ -38,13 +38,6 @@ function varTag(code: string, description: string) {
<template> <template>
<div id="config-container"> <div id="config-container">
<n-h2 prefix="bar">酸酸设置</n-h2> <n-h2 prefix="bar">酸酸设置</n-h2>
<n-alert title="设置注意" type="info">
<n-p class="no-margin">
<n-text strong type="warning">系统设置</n-text>
- 需要完全重新启动 Suan API 才能应用
</n-p>
<n-p class="no-margin">其他的设置可以即时生效</n-p>
</n-alert>
<n-collapse v-if="CONFIG.dataStatus" style="margin-top: 1rem"> <n-collapse v-if="CONFIG.dataStatus" style="margin-top: 1rem">
<n-collapse-item name="system" title="系统设置"> <n-collapse-item name="system" title="系统设置">
@@ -73,6 +66,25 @@ function varTag(code: string, description: string) {
show-input show-input
title="外部域名 / 主机名" title="外部域名 / 主机名"
/> />
<setting-card
v-model:boolean-value="CONFIG.data.system.docs"
show-switch
title="Fast API 文档功能"
>
<n-p>
FastAPI 提供
<n-code inline>/docs</n-code>
<n-code inline>/redoc</n-code>
两个文档端口以及一个
<n-code inline>/openapi.json</n-code>
结构化 API 数据文件
</n-p>
<n-p
>如果你需要深入研究 Suan API这是来自 FastAPI
的赠礼如有安全方面顾虑也可以关闭</n-p
>
</setting-card>
</n-flex> </n-flex>
</n-collapse-item> </n-collapse-item>
<n-collapse-item name="schedule" title="课表设置"> <n-collapse-item name="schedule" title="课表设置">
@@ -146,12 +158,20 @@ function varTag(code: string, description: string) {
</n-collapse-item> </n-collapse-item>
</n-collapse> </n-collapse>
<teleport v-if="extraVisible" defer to="#center-container"> <teleport v-if="extraVisible" defer to="#extra-control">
<div class="header-card"> <div class="header-card">
<n-flex vertical> <n-flex align="center">
<n-alert type="info">
<n-p class="no-margin">
<n-text strong type="warning">系统设置</n-text>
需要完全重新启动 Suan API 才能应用其他的设置可以即时生效
</n-p>
</n-alert>
<n-button <n-button
circle round
size="large" size="large"
style="margin-left: auto"
type="success" type="success"
@click=" @click="
() => { () => {
@@ -159,14 +179,26 @@ function varTag(code: string, description: string) {
MESSAGE.success('保存设置成功,后端会自动应用新的设置 ~') MESSAGE.success('保存设置成功,后端会自动应用新的设置 ~')
} }
" "
>保存</n-button >保存设置</n-button
> >
<n-button circle size="large" type="warning">重启</n-button>
<n-button circle size="large" type="error">关闭</n-button> <n-popover placement="bottom" trigger="hover">
<template #trigger>
<n-button round size="large" type="tertiary">重启 Suan API</n-button>
</template>
<n-p>由于技术限制无法从 WebUI 重启 Suan API 应用</n-p>
</n-popover>
</n-flex> </n-flex>
</div> </div>
</teleport> </teleport>
</div> </div>
</template> </template>
<style scoped></style> <style scoped>
div.header-card {
border: 1px solid #519f72;
border-radius: 10px;
padding: 10px;
margin-bottom: 10px;
}
</style>
+1
View File
@@ -3,6 +3,7 @@ export interface ConfigSystemDto {
port?: number port?: number
reload?: boolean reload?: boolean
public_host?: string public_host?: string
docs?: boolean
} }
export interface ConfigScheduleDto { export interface ConfigScheduleDto {