feat(ui): 更新入口移到状态栏右下角「检查更新」,弹窗精简并居中(v2.6.3)

老板看实际界面后提的三点:
  1. 升级弹窗里「当前版本 v2.6.2」那行去掉
  2. 弹窗按钮居中
  3. 工具条右上角的更新图标不要了,改到右下角、蓝色文字链接「检查更新」

改动:
  · index.html:删掉 <button id="btn-update">(工具条图标);
    在 .statusbar 的 .st-right 末尾加 <a class="st-link" id="btn-update">检查更新</a>
  · style.css:.st-link 用主题色 var(--accent)(浅色 #2f6feb / 深色 #4f8ef7),hover 下划线,
    .busy 时降透明度并禁用点击
  · tauri-bridge.js:
      - 「已是最新版本」弹窗不再带 detail(去掉当前版本行)
      - 「发现新版本」的说明里也不再写「当前 vX →」,只留发布时间 + 更新说明
      - 模态框按钮行 justify-content: flex-end → center(Tauri 下所有模态统一)
      - 状态栏是 <a>,没有 disabled,改用 updating 标志 + .busy 类

版本 2.6.2 → 2.6.3,已构建并发布:
  · xymd_2.6.3.exe(2.21 MB)+ .sig
  · latest.json 指向新包,签名按 minisign 规则实验通过
This commit is contained in:
Jidekin committed 2026-11-20 10:42:30 +08:00
1 parent 859c922729
commit 4f8692ca38
8 files changed
+28 -29

No files matched your search

+2 -3
View File
@@ -80,9 +80,6 @@
<span id="openmode-label">标签</span>
</button>
<button class="tb-icon" id="btn-update" title="检查更新 / 在线升级" hidden>
<svg viewBox="0 0 16 16"><path d="M7.25 1.4h1.5v6.15l2.29-2.3 1.06 1.07L8 10.5 3.9 6.32 4.96 5.25l2.29 2.3V1.4zM2 11h1.5v2.5h9V11H14v4H2v-4z"/></svg>
</button>
<button class="tb-icon" id="btn-theme" title="切换深色/浅色 (Ctrl+Shift+L)">
<svg viewBox="0 0 16 16"><path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 1.5v11a5.5 5.5 0 010-11z"/></svg>
@@ -164,6 +161,8 @@
<span id="st-cursor">第 1 行, 第 1 列</span>
<span class="st-div">|</span>
<span>UTF-8</span>
<span class="st-div">|</span>
<a class="st-link" id="btn-update" title="检查更新">检查更新</a>
</div>
</footer>
+4
View File
@@ -699,6 +699,10 @@ html[data-theme="dark"] .markdown-body code { color: #f0a1c0; }
color: var(--text-faint);
}
.st-left, .st-right { display: flex; align-items: center; gap: 8px; }
/* 状态栏里的「检查更新」文字链接 */
.st-link { color: var(--accent); cursor: pointer; text-decoration: none; }
.st-link:hover { text-decoration: underline; }
.st-link.busy { opacity: .5; pointer-events: none; }
.st-file { color: var(--text-dim); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-dirty {
padding: 1px 6px;
+11 -15
View File
@@ -38,7 +38,7 @@
box.appendChild(d);
}
const row = document.createElement('div');
row.style.cssText = 'display:flex;gap:8px;justify-content:flex-end;';
row.style.cssText = 'display:flex;gap:10px;justify-content:center;margin-top:4px;';
buttons.forEach((label, i) => {
const b = document.createElement('button');
b.textContent = label;
@@ -161,10 +161,8 @@
/* ---------- 在线升级(服务端:https://md.wangjinding.com/update/latest.json) ---------- */
const updateBtn = document.getElementById('btn-update');
if (updateBtn) {
updateBtn.hidden = false;
updateBtn.addEventListener('click', runUpdate);
}
if (updateBtn) updateBtn.addEventListener('click', runUpdate);
let updating = false;
/* 升级进度浮层 */
function progressUI(title) {
@@ -207,21 +205,18 @@
}
async function runUpdate() {
if (!updateBtn || updateBtn.disabled) return;
updateBtn.disabled = true;
if (!updateBtn || updating) return;
updating = true;
updateBtn.classList.add('busy');
try {
const st = await invoke('check_update');
if (!st || !st.available) {
await modalDialog({
message: '已是最新版本',
detail: `当前版本 v${(st && st.current) || ''}`,
buttons: ['好'],
});
await modalDialog({ message: '已是最新版本', buttons: ['好'] });
return;
}
const lines = [`当前 v${st.current} → 新版本 v${st.version}`];
const lines = [];
if (st.date) lines.push(`发布时间:${st.date}`);
if (st.notes) lines.push('', '更新说明:', st.notes);
if (st.notes) lines.push('', st.notes);
const pick = await modalDialog({
message: `发现新版本 v${st.version}`,
detail: lines.join('\n'),
@@ -243,7 +238,8 @@
} catch (e) {
await modalDialog({ message: '检查更新失败', detail: String((e && e.message) || e), buttons: ['好'] });
} finally {
updateBtn.disabled = false;
updating = false;
updateBtn.classList.remove('busy');
}
}