更新uniapp和platform
This commit is contained in:
1 parent
31ae07175d
commit
7f9a66da0f
47 files changed
+5207
-1974
No files matched your search
@@ -7,7 +7,23 @@
|
||||
<el-icon><Folder /></el-icon>
|
||||
文件管理系统
|
||||
</span>
|
||||
<el-button :icon="Refresh" @click="refushData"> 刷新 </el-button>
|
||||
<div class="header-right">
|
||||
<!-- 附件空间用量:点击进入扩容页 -->
|
||||
<div class="storage-usage" title="附件空间用量,点击扩容" @click="goStorage">
|
||||
<el-progress
|
||||
:percentage="storagePercent"
|
||||
:status="storageStatus"
|
||||
:stroke-width="6"
|
||||
:show-text="false"
|
||||
class="storage-bar"
|
||||
/>
|
||||
<span class="storage-text">
|
||||
空间 {{ storageText }}
|
||||
<span v-if="storagePercent >= 90" class="storage-warn">(即将用尽)</span>
|
||||
</span>
|
||||
</div>
|
||||
<el-button :icon="Refresh" @click="refushData"> 刷新 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -457,6 +473,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import {
|
||||
Folder,
|
||||
@@ -496,9 +513,49 @@ import UploadFile from "./components/uploadFile.vue";
|
||||
import MoveFile from "./components/moveFile.vue";
|
||||
import RenameCategory from "./components/renameCategory.vue";
|
||||
import CreateCategory from "./components/createCategory.vue";
|
||||
import { getStorageInfo } from "@/api/storage";
|
||||
// 日期显示统一为:YYYY-MM-DD
|
||||
import { formatDate } from "@/utils/datetime";
|
||||
|
||||
// ---------- 附件空间用量 ----------
|
||||
const router = useRouter();
|
||||
const storageInfo = ref<Record<string, any>>({});
|
||||
|
||||
const storagePercent = computed(() => {
|
||||
const p = Number(storageInfo.value.used_percent) || 0;
|
||||
return Math.min(100, Math.max(0, Math.round(p * 10) / 10));
|
||||
});
|
||||
|
||||
const storageStatus = computed(() => {
|
||||
if (storagePercent.value >= 95) return "exception";
|
||||
if (storagePercent.value >= 80) return "warning";
|
||||
return "";
|
||||
});
|
||||
|
||||
const formatStorageSize = (bytes: any) => {
|
||||
const n = Number(bytes) || 0;
|
||||
if (n >= 1024 ** 3) return `${(n / 1024 ** 3).toFixed(2)}GB`;
|
||||
if (n >= 1024 ** 2) return `${(n / 1024 ** 2).toFixed(1)}MB`;
|
||||
if (n >= 1024) return `${(n / 1024).toFixed(1)}KB`;
|
||||
return `${n}B`;
|
||||
};
|
||||
|
||||
const storageText = computed(
|
||||
() =>
|
||||
`${formatStorageSize(storageInfo.value.used_bytes)} / ${formatStorageSize(storageInfo.value.quota_bytes)}`,
|
||||
);
|
||||
|
||||
const loadStorageInfo = async () => {
|
||||
try {
|
||||
const res = await getStorageInfo();
|
||||
if (res?.code === 200) storageInfo.value = res.data || {};
|
||||
} catch {
|
||||
// 空间用量属于辅助信息,失败不影响文件管理
|
||||
}
|
||||
};
|
||||
|
||||
const goStorage = () => router.push("/basicSettings/storage");
|
||||
|
||||
// 分组相关
|
||||
interface Group {
|
||||
id: number;
|
||||
@@ -1247,6 +1304,7 @@ const handleBatchDeletePermanently = () => {
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getUserCateData();
|
||||
loadStorageInfo();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1270,6 +1328,39 @@ onMounted(() => {
|
||||
font-size: 13px;
|
||||
color: var(--el-text-color-placeholder);
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
// 附件空间用量(点击进入扩容页)
|
||||
.storage-usage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
min-width: 190px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover .storage-text {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.storage-bar {
|
||||
width: 190px;
|
||||
}
|
||||
|
||||
.storage-text {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.storage-warn {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.group-card,
|
||||
|
||||
Reference in new issue
Block a user