update file struct
This commit is contained in:
@@ -15,6 +15,7 @@ export interface LogEntry {
|
||||
export const useSoftwareStore = defineStore('software', {
|
||||
state: () => ({
|
||||
essentials: [] as any[],
|
||||
essentialsVersion: '',
|
||||
updates: [] as any[],
|
||||
allSoftware: [] as any[],
|
||||
selectedEssentialIds: [] as string[],
|
||||
@@ -117,7 +118,14 @@ export const useSoftwareStore = defineStore('software', {
|
||||
},
|
||||
|
||||
async fetchEssentials() {
|
||||
this.essentials = await invoke('get_essentials')
|
||||
const res = await invoke('get_essentials') as any;
|
||||
if (res) {
|
||||
this.essentials = res.essentials;
|
||||
this.essentialsVersion = res.version;
|
||||
} else {
|
||||
this.essentials = [];
|
||||
this.essentialsVersion = '';
|
||||
}
|
||||
},
|
||||
async fetchUpdates() {
|
||||
if (this.isBusy) return;
|
||||
@@ -156,12 +164,20 @@ export const useSoftwareStore = defineStore('software', {
|
||||
// 在获取全量数据之前,先同步云端清单
|
||||
await invoke('sync_essentials').catch(() => {});
|
||||
|
||||
const [essentials, all, updates] = await Promise.all([
|
||||
invoke('get_essentials'),
|
||||
const [repo, all, updates] = await Promise.all([
|
||||
invoke('get_essentials') as Promise<any>,
|
||||
invoke('get_all_software'),
|
||||
invoke('get_updates')
|
||||
]);
|
||||
this.essentials = essentials as any[];
|
||||
|
||||
if (repo) {
|
||||
this.essentials = repo.essentials;
|
||||
this.essentialsVersion = repo.version;
|
||||
} else {
|
||||
this.essentials = [];
|
||||
this.essentialsVersion = '';
|
||||
}
|
||||
|
||||
this.allSoftware = all as any[];
|
||||
this.updates = updates as any[];
|
||||
this.lastFetched = Date.now();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<header class="content-header">
|
||||
<div class="header-left">
|
||||
<h1>装机必备</h1>
|
||||
<span v-if="store.essentialsVersion" class="version-badge">版本: {{ store.essentialsVersion }}</span>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button
|
||||
@@ -101,6 +102,21 @@ onMounted(() => {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.version-badge {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-sec);
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
padding: 4px 10px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.content-header h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
|
||||
Reference in New Issue
Block a user