增加定时清理回收站文件

This commit is contained in:
2026-04-03 22:27:43 +08:00
parent d47c60a5e0
commit 97f1482497
18 changed files with 220 additions and 59 deletions

View File

@@ -225,7 +225,7 @@ const movableFolders = ref([])
// 存储 —— 真实数据
const storagePercent = computed(() => {
const limit = userStore.storageLimit || 20 * 1024 * 1024 * 1024
const limit = userStore.storageLimit || 0
const used = userStore.storageUsed || 0
if (limit <= 0) return 0
return Math.min(Math.round((used / limit) * 100), 100)
@@ -237,13 +237,14 @@ const usedStorage = computed(() => {
: (used / (1024 * 1024)).toFixed(2) + ' MB'
})
const totalStorage = computed(() => {
const limit = userStore.storageLimit || 20 * 1024 * 1024 * 1024
const limit = userStore.storageLimit || 0
if (limit <= 0) return '—'
return (limit / (1024 * 1024 * 1024)).toFixed(0) + ' GB'
})
// 剩余存储空间(字节)
const remainingStorage = computed(() => {
const limit = userStore.storageLimit || 20 * 1024 * 1024 * 1024
const limit = userStore.storageLimit || 0
const used = userStore.storageUsed || 0
return Math.max(0, limit - used)
})
@@ -251,12 +252,14 @@ const remainingStorage = computed(() => {
// 刷新存储数据(从后端精确重算)
const refreshStorage = async () => {
try {
// 先获取系统配置(存储配额)
await userStore.fetchStorageLimit()
// 再获取用户当前用量
const res = await getCurrentUser()
const data = res.data
if (data) {
userStore.setUser({
storageUsed: data.storageUsed ?? 0,
storageLimit: data.storageLimit ?? 20 * 1024 * 1024 * 1024
storageUsed: data.storageUsed ?? 0
})
}
} catch (e) {