feat: 辅料功能、康正源拉取价格接口
This commit is contained in:
@@ -143,7 +143,12 @@ desktop.onNavigate((route) => {
|
||||
router.push(route);
|
||||
});
|
||||
|
||||
// 桌面端:自动更新事件轻量提示(下载完成后的安装确认由主进程弹窗负责)
|
||||
// 桌面端:托盘「切换账号」→ 打开与头像下拉相同的切换账号弹窗
|
||||
desktop.onOpenSwitchAccount(() => {
|
||||
switchAccountModalRef.value?.openModal();
|
||||
});
|
||||
|
||||
// 桌面端:自动更新事件轻量提示(下载完成后的安装确认由主进程弹窗负责;强制更新则主进程直接重启)
|
||||
desktop.onUpdateEvent((payload) => {
|
||||
if (payload.type === 'available') {
|
||||
const version = (payload.data as { version?: string })?.version;
|
||||
@@ -152,6 +157,25 @@ desktop.onUpdateEvent((payload) => {
|
||||
description: `新版本 ${version ? `v${version} ` : ''}正在后台下载,完成后将提示安装`,
|
||||
duration: 5,
|
||||
});
|
||||
} else if (payload.type === 'progress') {
|
||||
const percent = (payload.data as { percent?: number })?.percent;
|
||||
// 约每 25% 提示一次(25/50/75/100),避免刷屏与 0% 噪音
|
||||
if (typeof percent === 'number' && percent >= 25 && percent % 25 === 0) {
|
||||
notification.info({
|
||||
message: '正在下载更新',
|
||||
description: `已下载 ${percent}%`,
|
||||
duration: 2,
|
||||
key: 'desktop-update-progress',
|
||||
});
|
||||
}
|
||||
} else if (payload.type === 'downloaded') {
|
||||
const version = (payload.data as { version?: string })?.version;
|
||||
notification.success({
|
||||
message: '更新已下载完成',
|
||||
description: `新版本 ${version ? `v${version} ` : ''}已就绪,请按提示重启安装`,
|
||||
duration: 6,
|
||||
key: 'desktop-update-progress',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,6 +188,7 @@ onUnmounted(() => {
|
||||
desktop.setBadge(0);
|
||||
// 解绑系统通知跳转回调,避免登出后点击残留通知仍对已登出会话执行 router.push
|
||||
desktop.offNavigate();
|
||||
desktop.offOpenSwitchAccount();
|
||||
});
|
||||
|
||||
const goNoticeList = () => {
|
||||
|
||||
Reference in New Issue
Block a user