adjust ui
This commit is contained in:
20
src/App.vue
20
src/App.vue
@@ -43,6 +43,7 @@ const fastState = ref({
|
||||
const memoryState = ref({
|
||||
stats: null as MemoryStats | null,
|
||||
isCleaning: false,
|
||||
cleaningType: null as 'fast' | 'deep' | null,
|
||||
lastFreed: "",
|
||||
isDone: false,
|
||||
});
|
||||
@@ -377,18 +378,20 @@ async function getMemoryStats() {
|
||||
async function startMemoryClean(deep = false) {
|
||||
if (memoryState.value.isCleaning) return;
|
||||
memoryState.value.isCleaning = true;
|
||||
memoryState.value.isDone = false;
|
||||
memoryState.value.cleaningType = deep ? 'deep' : 'fast';
|
||||
|
||||
try {
|
||||
const cmd = deep ? "run_deep_memory_clean" : "run_memory_clean";
|
||||
const freedBytes = await invoke<number>(cmd);
|
||||
memoryState.value.lastFreed = formatItemSize(freedBytes);
|
||||
memoryState.value.isDone = true;
|
||||
// 使用弹窗显示结果
|
||||
showAlert("优化完成", `已为您释放 ${memoryState.value.lastFreed} 内存空间`, 'success');
|
||||
await getMemoryStats();
|
||||
} catch (err) {
|
||||
showAlert("清理失败", String(err), 'error');
|
||||
} finally {
|
||||
memoryState.value.isCleaning = false;
|
||||
memoryState.value.cleaningType = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,7 +723,7 @@ watch(activeTab, (newTab) => {
|
||||
<!-- 扫描完成 -->
|
||||
<div class="result-card" v-else-if="chromeState.scanResult && !chromeState.isDone">
|
||||
<div class="result-header">
|
||||
<span class="result-icon">🌐</span>
|
||||
<span class="result-icon">🌍</span>
|
||||
<h2>扫描完成</h2>
|
||||
</div>
|
||||
<div class="result-stats">
|
||||
@@ -782,7 +785,7 @@ watch(activeTab, (newTab) => {
|
||||
</div>
|
||||
<div class="result-card" v-else-if="edgeState.scanResult && !edgeState.isDone">
|
||||
<div class="result-header">
|
||||
<span class="result-icon">🌐</span>
|
||||
<span class="result-icon">🌍</span>
|
||||
<h2>扫描完成</h2>
|
||||
</div>
|
||||
<div class="result-stats">
|
||||
@@ -978,7 +981,7 @@ watch(activeTab, (newTab) => {
|
||||
<p>压缩所有进程的内存工作集,释放物理内存,不影响程序运行。</p>
|
||||
</div>
|
||||
<button class="btn-primary" @click="startMemoryClean(false)" :disabled="memoryState.isCleaning">
|
||||
{{ memoryState.isCleaning ? '清理中...' : '立即加速' }}
|
||||
{{ memoryState.cleaningType === 'fast' ? '清理中...' : '立即加速' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -988,16 +991,11 @@ watch(activeTab, (newTab) => {
|
||||
<p>强制清空系统备用列表(待机列表),释放更多被缓存的物理空间。</p>
|
||||
</div>
|
||||
<button class="btn-secondary" @click="startMemoryClean(true)" :disabled="memoryState.isCleaning">
|
||||
深度加速
|
||||
{{ memoryState.cleaningType === 'deep' ? '清理中...' : '深度加速' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clean-feedback" v-if="memoryState.isDone">
|
||||
<span class="success-icon">✨</span>
|
||||
优化完成!已为您释放 <span class="freed-amount">{{ memoryState.lastFreed }}</span> 内存空间
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 5. 其他占位 -->
|
||||
|
||||
Reference in New Issue
Block a user