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:
1 parent
b0e2d91376
commit
9222e79760
8 files changed
+28
-29
No files matched your search
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user