feat(electron-shell): 1.11.0 新增设置中心与执行超时/内存分层,组件运行状态与运行历史峰值内存
This commit is contained in:
@@ -0,0 +1,648 @@
|
||||
<template>
|
||||
<div class="set-page">
|
||||
<PageHead eyebrow="设置" title="设置" :sub="headSub">
|
||||
<template #actions>
|
||||
<span class="save-tip" :class="{ on: saving || savedTip }">
|
||||
{{ saving ? '保存中…' : (savedTip || '改动即时保存') }}
|
||||
</span>
|
||||
<el-button size="small" :icon="Refresh" :loading="loading" @click="loadAll">重新读取</el-button>
|
||||
</template>
|
||||
</PageHead>
|
||||
|
||||
<div class="page-body">
|
||||
<!-- 当前生效值总览:一眼看清"这台机器现在是什么配置" -->
|
||||
<div class="ov">
|
||||
<div class="ov-cell">
|
||||
<span class="ov-k">单次超时</span>
|
||||
<b class="ov-v">{{ fmtTimeout(s.run_timeout_sec) }}</b>
|
||||
<em class="ov-tag" :class="{ on: isCustom('run_timeout_override') }"
|
||||
title="未声明插件超时的场景按此值计时;插件在 plugin.json 声明了 runTimeoutSeconds 的,以插件为准">
|
||||
{{ isCustom('run_timeout_override') ? '自定义' : '默认' }}
|
||||
</em>
|
||||
</div>
|
||||
<div class="ov-cell">
|
||||
<span class="ov-k">内存上限</span>
|
||||
<b class="ov-v">{{ fmtMem(s.run_max_mem_mb) }}</b>
|
||||
<em class="ov-tag" :class="{ on: isCustom('run_max_mem_override') }"
|
||||
title="仅环境包运行时生效;达到上限会让内存分配失败(不会限速),0 = 不限">
|
||||
{{ isCustom('run_max_mem_override') ? '自定义' : '默认' }}
|
||||
</em>
|
||||
</div>
|
||||
<div class="ov-cell">
|
||||
<span class="ov-k">日志保留</span>
|
||||
<b class="ov-v">{{ s.log_max_mb }} MB × {{ s.log_keep }}</b>
|
||||
<em class="ov-tag" :class="{ on: isCustom('log_max_mb_override') || isCustom('log_keep_override') }">
|
||||
{{ isCustom('log_max_mb_override') || isCustom('log_keep_override') ? '自定义' : '默认' }}
|
||||
</em>
|
||||
</div>
|
||||
<div class="ov-cell">
|
||||
<span class="ov-k">关闭窗口</span>
|
||||
<b class="ov-v">{{ form.close_behavior === 'tray' ? '收托盘' : '退出程序' }}</b>
|
||||
<em class="ov-tag" :class="{ on: form.close_behavior === 'quit' }">
|
||||
{{ form.close_behavior === 'tray' ? '常驻' : '退出' }}
|
||||
</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 启动与关闭 -->
|
||||
<section class="card blk">
|
||||
<header class="blk-head">
|
||||
<span class="blk-ico"><el-icon><SwitchButton /></el-icon></span>
|
||||
<div class="blk-txt">
|
||||
<h3>启动与关闭</h3>
|
||||
<p>无人值守(跑定时任务)建议保持「关闭窗口 = 收托盘」,避免误关后任务停摆。</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="blk-body">
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>开机自启</b>
|
||||
<span>登录 Windows 后自动启动客户端,定时任务不会因为没开机而漏跑</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<span class="state" :class="{ on: form.autostart }">{{ form.autostart ? '已开启' : '已关闭' }}</span>
|
||||
<el-switch :model-value="!!form.autostart" :disabled="saving || s.autostart === null"
|
||||
@change="onAutostart" />
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="s.autostart === null" class="hint">
|
||||
当前环境读不到系统登录项(仅客户端窗口内可设置,浏览器预览下不生效)。
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>关闭主窗口时</b>
|
||||
<span>收托盘:服务与插件继续运行,从托盘菜单「退出」才真正退出</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<el-radio-group :model-value="form.close_behavior" size="small" :disabled="saving"
|
||||
@change="onCloseBehavior">
|
||||
<el-radio-button value="tray">收托盘继续运行</el-radio-button>
|
||||
<el-radio-button value="quit">直接退出</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 执行限制 -->
|
||||
<section class="card blk">
|
||||
<header class="blk-head">
|
||||
<span class="blk-ico"><el-icon><Timer /></el-icon></span>
|
||||
<div class="blk-txt">
|
||||
<h3>执行限制</h3>
|
||||
<p>改动在下一个任务启动时生效,不会打断正在执行的任务。</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="blk-body">
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>单次执行超时 <em class="tag" :class="{ on: isCustom('run_timeout_override') }">{{ isCustom('run_timeout_override') ? '自定义' : '跟随默认' }}</em></b>
|
||||
<span>超过后强制结束并记「失败」。插件在 plugin.json 里声明了超时的,以插件为准</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<div class="num">
|
||||
<el-input-number v-model="form.timeoutMin" :min="0" :max="10080" :step="30"
|
||||
size="small" controls-position="right" :disabled="saving" @change="onTimeout" />
|
||||
<span class="unit">分钟</span>
|
||||
</div>
|
||||
<el-button v-if="isCustom('run_timeout_override')" link size="small" :disabled="saving"
|
||||
@click="onTimeoutReset">恢复默认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint">0 = 不限时(不建议:卡死的插件会一直占着设备)· 默认 {{ fmtTimeout(s.run_timeout_default) }}</p>
|
||||
|
||||
<!-- 覆盖清单:把"哪些场景自带超时、不受本设置影响"直接列出来,
|
||||
避免用户以为这里设了就对所有场景生效(实际以插件声明为准) -->
|
||||
<div v-if="timeoutOverrides.length" class="tmo-list">
|
||||
<span class="tmo-k">以下场景在插件里自带超时,不受本设置影响(点击查看):</span>
|
||||
<button v-for="p in timeoutOverrides" :key="p.id" type="button" class="tmo-item" :title="p.tip"
|
||||
@click="openPlugin(p.id)">
|
||||
{{ p.name }}<em>超时 {{ p.text }}</em>
|
||||
</button>
|
||||
</div>
|
||||
<p v-else-if="store.plugins.length" class="hint">当前账号可见的场景都按本设置计时,没有插件单独声明超时。</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>内存上限 <em class="tag" :class="{ on: isCustom('run_max_mem_override') }">{{ isCustom('run_max_mem_override') ? '自定义' : '跟随默认' }}</em></b>
|
||||
<span>达到上限会让内存分配失败、任务失败(不会限速;仅环境包运行时生效)。限的是整次任务(插件主进程 + 它拉起的浏览器等子进程)合计,大表/多标签浏览器请调大,0 = 不限</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<div class="num">
|
||||
<el-input-number v-model="form.memMb" :min="0" :max="32768" :step="256"
|
||||
size="small" controls-position="right" :disabled="saving" @change="onMem" />
|
||||
<span class="unit">MB</span>
|
||||
</div>
|
||||
<el-button v-if="isCustom('run_max_mem_override')" link size="small" :disabled="saving"
|
||||
@click="onMemReset">恢复默认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint">0 = 不限(插件可吃满本机内存,不建议)· 默认按物理内存 70%(下限 4GB、上限 16GB,本机 {{ fmtMem(s.run_max_mem_default) }})· 与任务执行超时同为"下一个任务生效"</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 日志保留 -->
|
||||
<section class="card blk">
|
||||
<header class="blk-head">
|
||||
<span class="blk-ico"><el-icon><Document /></el-icon></span>
|
||||
<div class="blk-txt">
|
||||
<h3>日志保留</h3>
|
||||
<p>按大小滚动:单文件超过上限即换新文件,只保留最近几份,避免长期占盘。</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="blk-body">
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>单文件上限</b>
|
||||
<span>当前每份 {{ fmtMb(s.log_max_mb) }},超出后自动轮转</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<div class="num">
|
||||
<el-input-number v-model="form.logMaxMb" :min="1" :max="512" :step="1"
|
||||
size="small" controls-position="right" :disabled="saving" @change="onLogMax" />
|
||||
<span class="unit">MB</span>
|
||||
</div>
|
||||
<el-button v-if="isCustom('log_max_mb_override')" link size="small" :disabled="saving"
|
||||
@click="onLogMaxReset">恢复默认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="k">
|
||||
<b>保留份数</b>
|
||||
<span>当前保留 {{ s.log_keep }} 份历史日志(最旧的自动丢弃)</span>
|
||||
</div>
|
||||
<div class="ctl">
|
||||
<div class="num">
|
||||
<el-input-number v-model="form.logKeep" :min="1" :max="20" :step="1"
|
||||
size="small" controls-position="right" :disabled="saving" @change="onLogKeep" />
|
||||
<span class="unit">份</span>
|
||||
</div>
|
||||
<el-button v-if="isCustom('log_keep_override')" link size="small" :disabled="saving"
|
||||
@click="onLogKeepReset">恢复默认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="logbox">
|
||||
<div class="logbox-head">
|
||||
<span class="lk">日志目录</span>
|
||||
<code class="path">{{ s.log_dir || '未启用文件日志' }}</code>
|
||||
<el-button size="small" text :disabled="!s.log_dir" @click="onOpenLogDir">打开目录</el-button>
|
||||
</div>
|
||||
<div v-if="s.log_files && s.log_files.length" class="logfiles">
|
||||
<span v-for="f in s.log_files" :key="f.name" class="lf">
|
||||
{{ f.name }}<em>{{ fmtBytes(f.size) }}</em>
|
||||
</span>
|
||||
</div>
|
||||
<p v-else-if="!s.log_dir" class="hint">
|
||||
当前进程没有启用文件日志:CLI 与窗口模式默认都会写到数据目录;若持续如此,请检查数据目录写权限,或确认没有设置 SHELL_LOG_FILE=0。
|
||||
</p>
|
||||
<p v-else class="hint">本机暂无日志文件。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 关于 -->
|
||||
<section class="card blk">
|
||||
<header class="blk-head">
|
||||
<span class="blk-ico"><el-icon><InfoFilled /></el-icon></span>
|
||||
<div class="blk-txt">
|
||||
<h3>关于</h3>
|
||||
<p>客户端版本、本机关键目录与更新日志。</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="blk-body">
|
||||
<div class="about-top">
|
||||
<div class="ver-block">
|
||||
<span class="ver">v{{ about.version || s.version || '—' }}</span>
|
||||
<span class="ver-sub">37du 自动化工作台 · 执行机客户端</span>
|
||||
</div>
|
||||
<el-button size="small" @click="openComponents">
|
||||
本机组件<el-icon class="ic-r"><ArrowRight /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<p class="hint">客户端 / 运行环境 / 插件与 SDK / 浏览器的版本、检查更新与回滚都在「本机组件」页。</p>
|
||||
|
||||
<div class="dirs">
|
||||
<div class="dir">
|
||||
<span class="dk">数据目录</span>
|
||||
<code class="path">{{ about.data_dir || s.data_dir }}</code>
|
||||
</div>
|
||||
<div class="dir">
|
||||
<span class="dk">日志目录</span>
|
||||
<code class="path">{{ about.log_dir || s.log_dir }}</code>
|
||||
</div>
|
||||
<div class="dir">
|
||||
<span class="dk">插件目录</span>
|
||||
<code class="path">{{ about.plugin_root }}</code>
|
||||
</div>
|
||||
<div class="dir">
|
||||
<span class="dk">环境包目录</span>
|
||||
<code class="path">{{ about.env_dir }}</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl-head">
|
||||
<b>更新日志</b>
|
||||
<el-button size="small" link @click="clOpen = !clOpen">{{ clOpen ? '收起' : '展开' }}</el-button>
|
||||
</div>
|
||||
<div v-if="clOpen" class="cl">
|
||||
<div v-for="(line, i) in clLines" :key="i" class="cl-line" :class="line.cls">{{ line.text }}</div>
|
||||
<p v-if="!clLines.length" class="hint">安装包未附带更新日志。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ArrowRight, Document, InfoFilled, Refresh, SwitchButton, Timer } from '@element-plus/icons-vue'
|
||||
import PageHead from './PageHead.vue'
|
||||
import { store, log } from '../store'
|
||||
import { fmtBytes, fmtTimeout } from '../utils/format'
|
||||
import { applyRunTimeout, pluginTimeoutInfo } from '../utils/timeout'
|
||||
import { getSettings, saveSettings, openLogDir, getAbout } from '../api'
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const savedTip = ref('')
|
||||
let savedTimer = null
|
||||
|
||||
// 服务端快照:生效值 + 覆盖值 + 默认值(未取到时给出安全兜底,避免页面空白)
|
||||
const s = ref({
|
||||
version: '', data_dir: '', settings_file: '',
|
||||
autostart: null,
|
||||
close_behavior: 'tray',
|
||||
run_timeout_sec: 21600, run_timeout_override: null, run_timeout_default: 21600,
|
||||
run_max_mem_mb: 4096, run_max_mem_override: null, run_max_mem_default: 4096,
|
||||
log_max_mb: 10, log_keep: 3, log_max_mb_override: null, log_keep_override: null,
|
||||
log_dir: '', log_files: [],
|
||||
})
|
||||
|
||||
// 表单只放"可编辑值",与快照单向同步(保存后用服务端返回值回填,避免本地与后端不一致)
|
||||
const form = reactive({ autostart: false, close_behavior: 'tray', timeoutMin: 360, memMb: 4096, logMaxMb: 10, logKeep: 3 })
|
||||
|
||||
const about = ref({})
|
||||
const clOpen = ref(false)
|
||||
|
||||
const headSub = computed(() => (s.value.settings_file
|
||||
? '个人偏好与运行限制 · 保存本机(%LOCALAPPDATA%),换机不生效'
|
||||
: '个人偏好与运行限制'))
|
||||
|
||||
/** 该项是否用户自定义过(覆盖值非 null = 自定义) */
|
||||
function isCustom(key) {
|
||||
const v = s.value[key]
|
||||
return v !== null && v !== undefined
|
||||
}
|
||||
|
||||
function fmtMb(mb) {
|
||||
return `${Number(mb) || 0} MB`
|
||||
}
|
||||
// 内存上限:0 = 不限(Job Object 不设硬顶);整 GB 显示 GB,其余按 MB
|
||||
function fmtMem(mb) {
|
||||
const n = Number(mb)
|
||||
if (!Number.isFinite(n) || n <= 0) return '不限'
|
||||
return n % 1024 === 0 ? `${n / 1024} GB` : `${n} MB`
|
||||
}
|
||||
|
||||
// 自带超时的场景清单:plugin.json 声明了 runTimeoutSeconds 的插件(0=不限时),
|
||||
// 这些场景执行时以插件为准,本页「单次执行超时」对它们不生效。
|
||||
const timeoutOverrides = computed(() =>
|
||||
(store.plugins || [])
|
||||
.filter((p) => p.timeout_seconds !== null && p.timeout_seconds !== undefined)
|
||||
.map((p) => ({ id: p.id, name: p.name || p.id, ...pluginTimeoutInfo(p) }))
|
||||
)
|
||||
function openPlugin(id) {
|
||||
store.selectedId = id
|
||||
store.view = 'run'
|
||||
store.pendingReplay = null
|
||||
}
|
||||
|
||||
function applySnapshot(r) {
|
||||
if (!r) return
|
||||
s.value = { ...s.value, ...r }
|
||||
// 同步给场景卡/运行台的超时徽章:保存后立即刷新,不必等下次进设置页
|
||||
applyRunTimeout(r.run_timeout_sec)
|
||||
form.autostart = !!r.autostart
|
||||
form.close_behavior = r.close_behavior || 'tray'
|
||||
form.timeoutMin = Math.round((Number(r.run_timeout_sec) || 0) / 60)
|
||||
const mem = Number(r.run_max_mem_mb)
|
||||
form.memMb = Number.isFinite(mem) && mem >= 0 ? mem : 4096
|
||||
form.logMaxMb = Number(r.log_max_mb) || 10
|
||||
form.logKeep = Number(r.log_keep) || 3
|
||||
}
|
||||
|
||||
// 统一保存:patch 只带变化的键;数值 null = 恢复默认
|
||||
async function put(patch, okMsg) {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
const r = await saveSettings(patch)
|
||||
applySnapshot(r)
|
||||
flashSaved()
|
||||
ElMessage.success(okMsg)
|
||||
} catch (e) {
|
||||
ElMessage.error('保存失败:' + (e.message || e))
|
||||
log('ERROR', `设置保存失败:${e.message || e}`)
|
||||
await loadSettings() // 失败回滚表单,避免界面显示与实际存储不一致
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 页头右上角轻提示:保存后 2 秒内显示「已保存」,之后回到默认文案
|
||||
function flashSaved() {
|
||||
savedTip.value = '已保存'
|
||||
if (savedTimer) clearTimeout(savedTimer)
|
||||
savedTimer = setTimeout(() => { savedTip.value = '' }, 2000)
|
||||
}
|
||||
|
||||
async function loadSettings() {
|
||||
try {
|
||||
applySnapshot(await getSettings())
|
||||
} catch (e) {
|
||||
log('ERROR', `读取设置失败:${e.message || e}`)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAll() {
|
||||
loading.value = true
|
||||
try {
|
||||
await Promise.allSettled([
|
||||
loadSettings(),
|
||||
getAbout().then((r) => {
|
||||
about.value = r || {}
|
||||
clOpen.value = false
|
||||
}).catch(() => {}),
|
||||
])
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadAll)
|
||||
|
||||
function openComponents() {
|
||||
store.view = 'components'
|
||||
}
|
||||
|
||||
// ===== 启动与关闭 =====
|
||||
function onAutostart(v) {
|
||||
put({ autostart: !!v }, v ? '已设置开机自启' : '已关闭开机自启')
|
||||
}
|
||||
function onCloseBehavior(v) {
|
||||
put({ close_behavior: v }, v === 'quit' ? '关闭窗口将直接退出程序' : '关闭窗口将收到托盘继续运行')
|
||||
}
|
||||
|
||||
// ===== 执行限制 =====
|
||||
// el-input-number 清空时给 null:不能当成 0(超时/内存里 0 是"不限"的强语义),回填当前生效值
|
||||
function blank(v) {
|
||||
return v === null || v === undefined || v === ''
|
||||
}
|
||||
function onTimeout(v) {
|
||||
if (blank(v)) {
|
||||
form.timeoutMin = Math.round((Number(s.value.run_timeout_sec) || 0) / 60)
|
||||
return
|
||||
}
|
||||
const sec = Math.max(0, Math.round(Number(v) || 0)) * 60
|
||||
put({ run_timeout_sec: sec }, sec ? `单次执行超时已设为 ${fmtTimeout(sec)}` : '已设为不限时')
|
||||
}
|
||||
function onTimeoutReset() {
|
||||
form.timeoutMin = Math.round((Number(s.value.run_timeout_default) || 0) / 60)
|
||||
put({ run_timeout_sec: null }, '已恢复默认超时')
|
||||
}
|
||||
function onMem(v) {
|
||||
if (blank(v)) {
|
||||
form.memMb = Number(s.value.run_max_mem_mb) || 0
|
||||
return
|
||||
}
|
||||
const mb = Math.max(0, Math.round(Number(v) || 0))
|
||||
put({ run_max_mem_mb: mb }, mb ? `内存上限已设为 ${mb} MB` : '已设为不限内存(插件可吃满本机)')
|
||||
}
|
||||
function onMemReset() {
|
||||
const def = Number(s.value.run_max_mem_default)
|
||||
form.memMb = Number.isFinite(def) && def >= 0 ? def : 4096
|
||||
put({ run_max_mem_mb: null }, '已恢复默认内存上限')
|
||||
}
|
||||
|
||||
// ===== 日志 =====
|
||||
function onLogMax(v) {
|
||||
if (blank(v)) { form.logMaxMb = Number(s.value.log_max_mb) || 10; return }
|
||||
put({ log_max_mb: Math.round(Number(v) || 0) }, `单文件上限已设为 ${Number(v)} MB`)
|
||||
}
|
||||
function onLogMaxReset() {
|
||||
form.logMaxMb = 10
|
||||
put({ log_max_mb: null }, '已恢复默认单文件上限')
|
||||
}
|
||||
function onLogKeep(v) {
|
||||
if (blank(v)) { form.logKeep = Number(s.value.log_keep) || 3; return }
|
||||
put({ log_keep: Math.round(Number(v) || 0) }, `日志保留已设为 ${Number(v)} 份`)
|
||||
}
|
||||
function onLogKeepReset() {
|
||||
form.logKeep = 3
|
||||
put({ log_keep: null }, '已恢复默认保留份数')
|
||||
}
|
||||
async function onOpenLogDir() {
|
||||
try {
|
||||
await openLogDir()
|
||||
} catch (e) {
|
||||
ElMessage.error('打开日志目录失败:' + (e.message || e))
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 关于:更新日志按行渲染(只取前 120 行,避免长文档把页面撑爆)=====
|
||||
const clLines = computed(() => {
|
||||
const text = about.value.changelog || ''
|
||||
return text.split(/\r?\n/).slice(0, 120).map((raw) => {
|
||||
const line = raw.trim()
|
||||
if (line.startsWith('## ')) return { cls: 'h1', text: line.slice(3) }
|
||||
if (line.startsWith('### ')) return { cls: 'h2', text: line.slice(4) }
|
||||
if (line.startsWith('- ')) return { cls: 'li', text: line.slice(2) }
|
||||
return { cls: 'p', text: line }
|
||||
}).filter((x) => x.text !== '' || x.cls === 'p')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.set-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
||||
.page-body {
|
||||
flex: 1; min-height: 0; overflow-y: auto;
|
||||
padding: 20px 24px 18px; /* 与其它一级视图一致 */
|
||||
display: flex; flex-direction: column; gap: var(--space-3);
|
||||
}
|
||||
/* 卡片随中栏宽度自适应铺满(不要再限 max-width,否则宽屏下两侧留大片空白)。
|
||||
flex: 0 0 auto 必须写:page-body 是定高 flex 列容器,子项默认可收缩,
|
||||
卡片又带 overflow: hidden,一旦窗口高度不够就会被压扁 + 裁掉内容(看不到第二行/概览数值)。 */
|
||||
.page-body > * { width: 100%; flex: 0 0 auto; }
|
||||
|
||||
/* ---------- 页头右侧保存态 ---------- */
|
||||
.save-tip {
|
||||
margin-right: var(--space-2);
|
||||
font: 400 11.5px/1 var(--f-cn); color: var(--t4);
|
||||
transition: color var(--dur, .16s) var(--ease, ease);
|
||||
}
|
||||
.save-tip.on { color: var(--good-ink); }
|
||||
|
||||
/* ---------- 生效值总览 ---------- */
|
||||
.ov {
|
||||
display: flex; align-items: stretch;
|
||||
background: var(--surface); border: 1px solid var(--line);
|
||||
border-radius: var(--r-card); box-shadow: var(--sh-card);
|
||||
overflow: hidden;
|
||||
}
|
||||
.ov-cell {
|
||||
flex: 1 1 0; min-width: 0;
|
||||
display: flex; flex-direction: column; gap: 3px;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
}
|
||||
.ov-cell + .ov-cell { border-left: 1px solid var(--line-soft); }
|
||||
.ov-k { font: 400 11px/1.4 var(--f-cn); color: var(--t4); letter-spacing: .02em; }
|
||||
.ov-v {
|
||||
font: 600 15px/1.3 var(--f-num, var(--f-cn)); color: var(--t1);
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
.ov-tag {
|
||||
align-self: flex-start; margin-top: 1px;
|
||||
font: 500 10px/1.6 var(--f-cn); font-style: normal;
|
||||
color: var(--t4); background: var(--field);
|
||||
border-radius: 999px; padding: 0 6px;
|
||||
}
|
||||
.ov-tag.on { color: var(--brand-ink); background: var(--brand-soft); }
|
||||
|
||||
/* ---------- 区块卡片 ---------- */
|
||||
.blk { padding: 0; overflow: hidden; }
|
||||
.blk-head {
|
||||
display: flex; align-items: flex-start; gap: var(--space-3);
|
||||
padding: var(--space-4) var(--space-4) var(--space-3);
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
.blk-ico {
|
||||
width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
|
||||
display: grid; place-items: center;
|
||||
background: var(--brand-soft); color: var(--brand-ink);
|
||||
font-size: 16px;
|
||||
}
|
||||
.blk-txt { min-width: 0; }
|
||||
.blk-txt h3 { margin: 0; font: 600 13.5px/1.5 var(--f-cn); color: var(--t1); }
|
||||
.blk-txt p { margin: 2px 0 0; font: 400 11.5px/1.6 var(--f-cn); color: var(--t3); }
|
||||
|
||||
.blk-body { padding: var(--space-2) var(--space-4) var(--space-4); }
|
||||
|
||||
.row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: var(--space-5);
|
||||
padding: var(--space-3) 0;
|
||||
}
|
||||
.row + .row { border-top: 1px dashed var(--line-soft); }
|
||||
.k { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
|
||||
.k b {
|
||||
display: flex; align-items: center; gap: var(--space-2);
|
||||
font: 600 12.5px/1.5 var(--f-cn); color: var(--t1);
|
||||
}
|
||||
.k span { font: 400 11.5px/1.6 var(--f-cn); color: var(--t3); }
|
||||
.ctl { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
|
||||
.num { display: flex; align-items: center; gap: 6px; }
|
||||
.num :deep(.el-input-number) { width: 118px; }
|
||||
.unit { font: 400 12px/1.4 var(--f-cn); color: var(--t3); }
|
||||
|
||||
.state { font: 400 11.5px/1.4 var(--f-cn); color: var(--t4); }
|
||||
.state.on { color: var(--good-ink); }
|
||||
|
||||
.tag {
|
||||
font: 500 10px/1.5 var(--f-cn); font-style: normal;
|
||||
color: var(--t4); background: var(--field);
|
||||
border-radius: 999px; padding: 1px 6px;
|
||||
}
|
||||
.tag.on { color: var(--brand-ink); background: var(--brand-soft); }
|
||||
|
||||
.hint { margin: 0 0 var(--space-1); font: 400 11.5px/1.7 var(--f-cn); color: var(--t4); }
|
||||
/* 自带超时的场景清单:橙色小胶囊,点击跳到对应运行台 */
|
||||
.tmo-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 var(--space-1); }
|
||||
.tmo-k { font: 400 11.5px/1.7 var(--f-cn); color: var(--t4); }
|
||||
.tmo-item {
|
||||
display: inline-flex; align-items: center; gap: 5px; padding: 1px var(--space-2);
|
||||
border: 1px solid var(--warn-line); border-radius: var(--r-pill);
|
||||
background: var(--warn-soft); color: var(--warn-ink);
|
||||
font: 500 11px/1.7 var(--f-cn); cursor: pointer;
|
||||
}
|
||||
.tmo-item em { font-style: normal; font-family: var(--f-num); opacity: .85; }
|
||||
.tmo-item:hover { filter: brightness(.97); }
|
||||
|
||||
/* ---------- 日志 ---------- */
|
||||
.logbox {
|
||||
margin-top: var(--space-2);
|
||||
padding: var(--space-3);
|
||||
display: flex; flex-direction: column; gap: var(--space-2);
|
||||
background: var(--field); border-radius: var(--r-card);
|
||||
}
|
||||
.logbox-head { display: flex; align-items: center; gap: var(--space-2); }
|
||||
.lk { font: 400 11.5px/1.6 var(--f-cn); color: var(--t3); flex-shrink: 0; }
|
||||
.path {
|
||||
font: 400 11.5px/1.6 var(--f-mono, monospace); color: var(--t2);
|
||||
word-break: break-all; background: var(--surface); border: 1px solid var(--line);
|
||||
border-radius: 6px; padding: 1px 7px;
|
||||
}
|
||||
.logfiles { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
||||
.lf {
|
||||
display: inline-flex; align-items: center; gap: 5px;
|
||||
font: 400 11px/1.7 var(--f-mono, monospace); color: var(--t2);
|
||||
background: var(--surface); border: 1px solid var(--line);
|
||||
border-radius: 6px; padding: 0 7px;
|
||||
}
|
||||
.lf em { font-style: normal; color: var(--t4); }
|
||||
|
||||
/* ---------- 关于 ---------- */
|
||||
.about-top {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: var(--space-4); padding: var(--space-1) 0 var(--space-3);
|
||||
}
|
||||
.ver-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.ver { font: 700 22px/1.2 var(--f-num, var(--f-cn)); color: var(--t1); letter-spacing: -.3px; }
|
||||
.ver-sub { font: 400 11.5px/1.5 var(--f-cn); color: var(--t3); }
|
||||
.ic-r { margin-left: 4px; }
|
||||
|
||||
/* 路径很长:单列排布(两列会被挤成断行,读起来很难受) */
|
||||
.dirs {
|
||||
display: flex; flex-direction: column;
|
||||
gap: 7px;
|
||||
padding: var(--space-3);
|
||||
background: var(--field); border-radius: var(--r-card);
|
||||
}
|
||||
.dir { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
|
||||
.dk { flex-shrink: 0; width: 64px; font: 400 11px/1.6 var(--f-cn); color: var(--t4); }
|
||||
.dir .path { background: transparent; border: 0; padding: 0; }
|
||||
|
||||
.cl-head {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: var(--space-3) 0 var(--space-2);
|
||||
}
|
||||
.cl-head b { font: 600 12.5px/1.4 var(--f-cn); color: var(--t1); }
|
||||
.cl {
|
||||
max-height: 320px; overflow-y: auto; padding: var(--space-3);
|
||||
border: 1px solid var(--line); border-radius: var(--r-card);
|
||||
display: flex; flex-direction: column; gap: 2px;
|
||||
}
|
||||
.cl-line { font: 400 11.5px/1.7 var(--f-cn); color: var(--t2); }
|
||||
.cl-line.h1 { margin-top: 8px; font-weight: 700; font-size: 13px; color: var(--t1); }
|
||||
.cl-line.h1:first-child { margin-top: 0; }
|
||||
.cl-line.h2 { margin-top: 5px; font-weight: 600; color: var(--t1); }
|
||||
.cl-line.li { padding-left: 10px; }
|
||||
.cl-line.li::before { content: '· '; color: var(--t4); }
|
||||
|
||||
/* 窄窗(按中栏自身宽度判断,而不是视口):总览折成两行,避免四格被压得看不清 */
|
||||
.set-page { container-type: inline-size; }
|
||||
@container (max-width: 640px) {
|
||||
.ov { flex-wrap: wrap; }
|
||||
.ov-cell { flex: 1 1 50%; }
|
||||
.ov-cell:nth-child(3) { border-left: 0; }
|
||||
.ov-cell:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user