Files
filecodebox/themes/2024/assets/DashboardView-BZkkNpA6.js
T
2024-12-20 19:46:24 +08:00

7 lines
4.9 KiB
Python

import{c as b,B as f,H as v,o as _,p as g,b as x,d as t,n as a,e,t as i,f as p,F as w,x as C,i as F,z,A as k,J as D,K as S}from"./index-Du-dk8JL.js";import{F as B}from"./file-ivaREKmJ.js";import{H as U}from"./hard-drive-BBm9eeol.js";/**
* @license lucide-vue-next v0.445.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M=b("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),$={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},A={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8"},j={class:"flex items-center justify-between"},H={class:"flex items-center justify-between"},L={class:"flex items-center justify-between"},V={class:"p-6"},I={class:"space-y-4"},N={class:"flex-shrink-0"},K={class:"flex-1"},T={key:0},O=f({__name:"DashboardView",setup(E){const s=z("isDarkMode"),o=v({totalFiles:0,storageUsed:0,yesterdayCount:0,todayCount:0,yesterdaySize:0,todaySize:0,sysUptime:0}),u=[],m=r=>{const l=new Date().getTime()-r,n=Math.floor(l/(24*60*60*1e3)),c=Math.floor(l%(24*60*60*1e3)/(60*60*1e3));return`${n}${c}小时`},y=r=>{const d=parseInt(r)/1024,l=d/1024,n=l/1024,c=n/1024;return c>1?`${c.toFixed(2)}TB`:n>1?`${n.toFixed(2)}GB`:l>1?`${l.toFixed(2)}MB`:d>1?`${d.toFixed(2)}KB`:`${r}B`},h=async()=>{const r=await k.get("/admin/dashboard");o.totalFiles=r.detail.totalFiles,o.storageUsed=y(r.detail.storageUsed),o.yesterdaySize=y(r.detail.yesterdaySize),o.todaySize=y(r.detail.todaySize),o.yesterdayCount=r.detail.yesterdayCount,o.todayCount=r.detail.todayCount,o.sysUptime=m(r.detail.sysUptime)};return _(()=>{h()}),(r,d)=>(g(),x("div",$,[t("h2",{class:a(["text-2xl font-bold mb-6",[e(s)?"text-white":"text-gray-800"]])}," 仪表盘 ",2),t("div",A,[t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",j,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 总文件数 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])},i(o.totalFiles),3)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-indigo-900":"bg-indigo-100"]])},[p(e(B),{class:a(["w-6 h-6",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-green-400":"text-green-600"]])},[t("span",{class:a([e(s)?"text-gray-400":"text-gray-600"])},"昨天:",2),t("span",null,i(o.yesterdayCount),1),t("span",{class:a(["ml-2",[e(s)?"text-gray-400":"text-gray-600"]])},"今天:",2),t("span",null,i(o.todayCount),1)],2)],2),t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",H,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 存储空间 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])},i(o.storageUsed),3)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-purple-900":"bg-purple-100"]])},[p(e(U),{class:a(["w-6 h-6",[e(s)?"text-purple-400":"text-purple-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-green-400":"text-green-600"]])},[t("span",{class:a([e(s)?"text-gray-400":"text-gray-600"])},"昨天:",2),t("span",null,i(o.yesterdaySize),1),t("span",{class:a(["ml-2",[e(s)?"text-gray-400":"text-gray-600"]])},"今天:",2),t("span",null,i(o.todaySize),1)],2)],2),t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",L,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 系统状态 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])}," 正常 ",2)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-blue-900":"bg-blue-100"]])},[p(e(M),{class:a(["w-6 h-6",[e(s)?"text-blue-400":"text-blue-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-gray-400":"text-gray-600"]])}," 服务器运行时间: "+i(o.sysUptime),3)],2)]),t("div",{class:a(["rounded-lg shadow-md overflow-hidden transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",{class:a(["px-6 py-4 border-b",[e(s)?"border-gray-700":"border-gray-200"]])},[t("h3",{class:a(["text-lg font-medium",[e(s)?"text-white":"text-gray-800"]])}," 最近活动 ",2)],2),t("div",V,[t("div",I,[(g(),x(w,null,C(u,(l,n)=>t("div",{key:n,class:"flex items-center space-x-4"},[t("div",N,[(g(),D(S(l.icon),{class:a(["w-5 h-5",[e(s)?"text-gray-400":"text-gray-600"]])},null,8,["class"]))]),t("div",K,[t("p",{class:a([e(s)?"text-gray-300":"text-gray-700"])},i(l.description),3),t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-500"]])},i(l.time),3)])])),64)),u.length===0?(g(),x("div",T,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 暂无活动 ",2)])):F("",!0)])])],2)]))}});export{O as default};