mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
es lint fix
This commit is contained in:
@@ -1,57 +1,78 @@
|
||||
<script setup lang="ts">
|
||||
import { formatFileSize } from "@/@core/utils/formatters";
|
||||
import api from "@/api";
|
||||
import trophy from "@images/misc/storage.png";
|
||||
import triangleDark from "@images/misc/triangle-dark.png";
|
||||
import triangleLight from "@images/misc/triangle-light.png";
|
||||
import { useTheme } from "vuetify";
|
||||
import { useTheme } from 'vuetify'
|
||||
import { formatFileSize } from '@/@core/utils/formatters'
|
||||
import api from '@/api'
|
||||
import trophy from '@images/misc/storage.png'
|
||||
import triangleDark from '@images/misc/triangle-dark.png'
|
||||
import triangleLight from '@images/misc/triangle-light.png'
|
||||
|
||||
const { global } = useTheme()
|
||||
|
||||
const { global } = useTheme();
|
||||
const triangleBg = computed(() =>
|
||||
global.name.value === "light" ? triangleLight : triangleDark
|
||||
);
|
||||
global.name.value === 'light' ? triangleLight : triangleDark,
|
||||
)
|
||||
|
||||
// 总存储空间
|
||||
const storage = ref(0);
|
||||
const storage = ref(0)
|
||||
|
||||
// 已使用存储空间
|
||||
const used = ref(0);
|
||||
const used = ref(0)
|
||||
|
||||
// 计算已使用存储空间百分比,精确到小数点后1位
|
||||
const usedPercent = computed(() => {
|
||||
return Math.round((used.value / storage.value) * 1000) / 10;
|
||||
});
|
||||
return Math.round((used.value / storage.value) * 1000) / 10
|
||||
})
|
||||
|
||||
// 调用API,查询存储空间
|
||||
const getStorage = async () => {
|
||||
async function getStorage() {
|
||||
try {
|
||||
const res: Storage = await api.get("dashboard/storage");
|
||||
storage.value = res.total_storage;
|
||||
used.value = res.used_storage;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
const res: Storage = await api.get('dashboard/storage')
|
||||
|
||||
storage.value = res.total_storage
|
||||
used.value = res.used_storage
|
||||
}
|
||||
};
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getStorage();
|
||||
});
|
||||
getStorage()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard title="存储空间" subtitle="" class="position-relative">
|
||||
<VCard
|
||||
title="存储空间"
|
||||
subtitle=""
|
||||
class="position-relative"
|
||||
>
|
||||
<VCardText>
|
||||
<h5 class="text-2xl font-weight-medium text-primary">
|
||||
{{ formatFileSize(storage) }}
|
||||
</h5>
|
||||
<p class="mt-2">已使用 {{ usedPercent }}% 🚀</p>
|
||||
<p class="mt-1"><VProgressLinear :model-value="usedPercent" color="primary" /></p>
|
||||
<p class="mt-2">
|
||||
已使用 {{ usedPercent }}% 🚀
|
||||
</p>
|
||||
<p class="mt-1">
|
||||
<VProgressLinear
|
||||
:model-value="usedPercent"
|
||||
color="primary"
|
||||
/>
|
||||
</p>
|
||||
</VCardText>
|
||||
|
||||
<!-- Triangle Background -->
|
||||
<VImg :src="triangleBg" class="triangle-bg flip-in-rtl" />
|
||||
<VImg
|
||||
:src="triangleBg"
|
||||
class="triangle-bg flip-in-rtl"
|
||||
/>
|
||||
|
||||
<!-- Trophy -->
|
||||
<VImg :src="trophy" class="trophy" />
|
||||
<VImg
|
||||
:src="trophy"
|
||||
class="trophy"
|
||||
/>
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user