optimize
This commit is contained in:
@@ -39,10 +39,12 @@ export const useSoftwareStore = defineStore('software', {
|
||||
|
||||
let displayStatus = item.status;
|
||||
let actionLabel = '安装';
|
||||
let currentVersion = item.version; // 默认使用清单中的推荐版本
|
||||
|
||||
// 统一字段:version 始终代表当前安装的版本,recommended_version 代表清单推荐的版本
|
||||
const currentVersion = installedInfo ? installedInfo.version : null;
|
||||
const recommendedVersion = item.version;
|
||||
|
||||
if (isInstalled) {
|
||||
currentVersion = installedInfo.version; // 如果已安装,显示本地真实版本
|
||||
if (hasUpdate) {
|
||||
actionLabel = '更新';
|
||||
} else if (displayStatus === 'idle') {
|
||||
@@ -54,7 +56,7 @@ export const useSoftwareStore = defineStore('software', {
|
||||
return {
|
||||
...item,
|
||||
version: currentVersion,
|
||||
recommended_version: item.version, // 额外保存一个原始推荐版本字段供前端判断
|
||||
recommended_version: recommendedVersion,
|
||||
status: displayStatus,
|
||||
actionLabel
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user