detect
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
<template>
|
||||
<main class="content">
|
||||
<header class="content-header">
|
||||
<h1>装机必备</h1>
|
||||
<button @click="installAll" class="primary-btn">一键安装全部</button>
|
||||
<div class="header-left">
|
||||
<h1>装机必备</h1>
|
||||
<p class="subtitle" v-if="store.loading">正在同步软件状态...</p>
|
||||
</div>
|
||||
<button @click="installAll" class="primary-btn" :disabled="store.loading">一键安装全部</button>
|
||||
</header>
|
||||
|
||||
<div class="software-list">
|
||||
<div v-if="store.loading && store.mergedEssentials.length === 0" class="loading-state">
|
||||
<div class="spinner"></div>
|
||||
<p>正在读取必备软件列表...</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="software-list">
|
||||
<SoftwareCard
|
||||
v-for="item in store.essentials"
|
||||
v-for="item in store.mergedEssentials"
|
||||
:key="item.id"
|
||||
:software="item"
|
||||
action-label="安装"
|
||||
:action-label="item.actionLabel"
|
||||
@install="store.install"
|
||||
/>
|
||||
</div>
|
||||
@@ -25,12 +33,12 @@ import { onMounted } from 'vue';
|
||||
const store = useSoftwareStore();
|
||||
|
||||
onMounted(() => {
|
||||
store.fetchEssentials();
|
||||
store.fetchAllData();
|
||||
store.initListener();
|
||||
});
|
||||
|
||||
const installAll = () => {
|
||||
store.essentials.forEach(s => {
|
||||
store.mergedEssentials.forEach(s => {
|
||||
if (s.status === 'idle') {
|
||||
store.install(s.id);
|
||||
}
|
||||
@@ -58,6 +66,12 @@ const installAll = () => {
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-sec);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
@@ -76,8 +90,37 @@ const installAll = () => {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.primary-btn:disabled {
|
||||
background-color: var(--border-color);
|
||||
box-shadow: none;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.software-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 300px;
|
||||
color: var(--text-sec);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 3px solid rgba(0, 122, 255, 0.1);
|
||||
border-top-color: var(--primary-color);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user