feat: 管理后台文件列表支持下载文件,格式化过期时间

This commit is contained in:
Yanlongli
2024-03-29 17:55:18 +08:00
parent 7b37269dfb
commit e309e89379
24 changed files with 152 additions and 40 deletions
+3
View File
@@ -14,6 +14,9 @@ instance.interceptors.request.use(
});
instance.interceptors.response.use(
(response:any) => {
if (response.status === 200 && response.config.url === '/admin/file/download') {
return response;
}
if (response.data.code === 200) {
return response.data;
} else {
+11
View File
@@ -0,0 +1,11 @@
export function formatTimestamp(timestamp: string): string {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}