import{c as w,d as N,r as M,u as R,f as U,a as u,b as t,l as Y,n as i,h as e,i as G,m as x,g as l,v as y,M as J,x as h,F as S,s as z,t as g,N as V,e as p}from"./index-B-Ka-o3f.js";import{F as O}from"./file-ExORVwAL.js";import{T as Q}from"./trash-McEm8LQt.js";/** * @license lucide-vue-next v0.535.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f=w("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-vue-next v0.535.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W=w("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-vue-next v0.535.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X=w("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-vue-next v0.535.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L=w("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-vue-next v0.535.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T=w("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Z={class:"p-6 overflow-y-auto custom-scrollbar"},tt={class:"mb-8"},et={class:"flex flex-1 gap-4 w-full sm:w-auto"},ot={class:"relative flex-1"},st={class:"overflow-x-auto"},it={class:"px-6 py-4 whitespace-nowrap"},at={class:"flex items-center"},rt={class:"px-6 py-4"},nt={class:"flex items-center group relative"},lt=["title"],dt={class:"absolute left-0 -top-2 -translate-y-full opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none"},gt={class:"bg-gray-900 text-white text-sm rounded px-2 py-1 max-w-xs break-all"},ct={class:"px-6 py-4 whitespace-nowrap"},ut={class:"px-6 py-4"},pt={class:"group relative"},xt={class:"absolute left-0 -top-2 -translate-y-full opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none z-10"},yt={class:"bg-gray-900 text-white text-sm rounded px-2 py-1 max-w-xs break-all"},ht={class:"px-6 py-4 whitespace-nowrap"},ft={class:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium"},bt={class:"flex items-center space-x-2"},mt=["onClick"],vt=["onClick"],wt={class:"flex items-center space-x-2"},_t=["disabled"],kt={class:"flex items-center space-x-1"},Ct=["onClick"],Mt=["disabled"],St={key:0,class:"fixed inset-0 z-50","aria-labelledby":"modal-title",role:"dialog","aria-modal":"true"},Ft={class:"fixed inset-0 z-10 overflow-y-auto"},jt={class:"flex min-h-full items-center justify-center p-4 text-center sm:p-0"},zt={class:"flex items-center justify-between"},Vt={class:"flex items-center space-x-3"},$t={class:"px-6 py-5"},Dt={class:"grid gap-6"},Ut={class:"space-y-2 group"},Lt={class:"relative rounded-lg shadow-sm"},Tt={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"},Bt={class:"space-y-2 group"},At={class:"relative rounded-lg shadow-sm"},Et={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"},Pt={class:"space-y-2 group"},Ht={class:"relative rounded-lg shadow-sm"},Kt={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"},qt={class:"space-y-2 group"},It={class:"relative rounded-lg shadow-sm"},Nt={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"},Rt={class:"space-y-2 group"},Yt={class:"relative rounded-lg shadow-sm"},Gt={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"},Xt=N({__name:"FileManageView",setup(Jt){function B(r){const o=new Date(r),a=o.getFullYear(),c=(o.getMonth()+1).toString().padStart(2,"0"),k=o.getDate().toString().padStart(2,"0"),C=o.getHours().toString().padStart(2,"0"),v=o.getMinutes().toString().padStart(2,"0"),I=o.getSeconds().toString().padStart(2,"0");return`${a}-${c}-${k} ${C}:${v}:${I}`}const s=G("isDarkMode"),$=M([]),A=R(),E=["取件码","名称","大小","描述","过期时间","操作"],n=M({page:1,size:10,total:0,keyword:""}),F=M(!1),d=M({id:null,code:"",prefix:"",suffix:"",expired_at:"",expired_count:null}),P=r=>{d.value={id:r.id,code:r.code,prefix:r.prefix,suffix:r.suffix,expired_at:r.expired_at?r.expired_at.slice(0,16):"",expired_count:r.expired_count},F.value=!0},_=()=>{F.value=!1,d.value={id:null,code:"",prefix:"",suffix:"",expired_at:"",expired_count:null}},H=async()=>{try{await V.updateFile(d.value),await b(),_()}catch(r){const o=r;A.showAlert(o.response?.data?.detail||"更新失败","error")}},K=async r=>{try{await V.deleteAdminFile(r),await b()}catch(o){console.error("删除失败:",o)}},b=async()=>{try{const r=await V.getAdminFileList(n.value);r.detail&&($.value=r.detail.data,n.value.total=r.detail.total)}catch(r){console.error("加载文件列表失败:",r)}},j=async r=>{typeof r!="string"&&(r<1||r>m.value||(n.value.page=r,await b()))};b();const m=U(()=>Math.ceil(n.value.total/n.value.size)),q=U(()=>{const r=n.value.page,o=m.value,a=2,c=[];c.push(1);const k=Math.max(2,r-a),C=Math.min(o-1,r+a);k>2&&c.push("...");for(let v=k;v<=C;v++)c.push(v);return C1&&c.push(o),c}),D=async()=>{n.value.page=1,await b()};return(r,o)=>(p(),u("div",Z,[t("div",tt,[t("h2",{class:i(["text-2xl font-bold mb-4",[e(s)?"text-white":"text-gray-800"]])}," 文件管理 ",2)]),t("div",{class:i(["mb-6 flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between bg-opacity-70 p-4 rounded-lg shadow-sm",[e(s)?"bg-gray-800":"bg-white"]])},[t("div",et,[t("div",ot,[x(t("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=a=>n.value.keyword=a),onKeyup:J(D,["enter"]),class:i([e(s)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-400","w-full pl-10 pr-4 py-2.5 rounded-lg border focus:ring-2 focus:ring-indigo-500 focus:border-transparent"]),placeholder:"搜索文件名称、描述..."},null,34),[[y,n.value.keyword]]),l(e(T),{class:i(["absolute left-3 top-3 w-5 h-5",[e(s)?"text-gray-400":"text-gray-500"]])},null,8,["class"])]),t("button",{onClick:D,class:"px-4 py-2.5 rounded-lg inline-flex items-center transition-all duration-200 bg-indigo-600 hover:bg-indigo-700 text-white shadow-sm"},[l(e(T),{class:"w-5 h-5 mr-2"}),o[8]||(o[8]=h(" 搜索 ",-1))])])],2),t("div",{class:i(["rounded-lg shadow-sm overflow-hidden transition-all duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",{class:i(["px-6 py-4 border-b",[e(s)?"border-gray-700":"border-gray-200"]])},[t("h3",{class:i(["text-lg font-medium",[e(s)?"text-white":"text-gray-800"]])}," 所有文件 ",2)],2),t("div",st,[t("table",{class:i(["min-w-full divide-y",[e(s)?"divide-gray-700":"divide-gray-200"]])},[t("thead",{class:i([e(s)?"bg-gray-900/50":"bg-gray-50"])},[t("tr",null,[(p(),u(S,null,z(E,a=>t("th",{key:a,class:i(["px-6 py-3.5 text-left text-xs font-medium uppercase tracking-wider",[e(s)?"text-gray-400":"text-gray-500"]])},g(a),3)),64))])],2),t("tbody",{class:i([e(s)?"bg-gray-800/50 divide-y divide-gray-700":"bg-white divide-y divide-gray-200"])},[(p(!0),u(S,null,z($.value,a=>(p(),u("tr",{key:a.id,class:i(["hover:bg-opacity-50 transition-colors duration-200",[e(s)?"hover:bg-gray-700":"hover:bg-gray-50"]])},[t("td",it,[t("div",at,[t("span",{class:i(["font-medium select-all",[e(s)?"text-white":"text-gray-900"]])},g(a.code),3)])]),t("td",rt,[t("div",nt,[l(e(O),{class:i(["w-5 h-5 mr-2 flex-shrink-0",[e(s)?"text-indigo-400":"text-indigo-500"]])},null,8,["class"]),t("span",{class:i(["font-medium truncate max-w-[200px]",[e(s)?"text-white":"text-gray-900"]]),title:a.prefix},g(a.prefix),11,lt),t("div",dt,[t("div",gt,g(a.prefix),1)])])]),t("td",ct,[t("span",{class:i(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",[e(s)?"bg-gray-700 text-gray-300":"bg-gray-100 text-gray-800"]])},g(Math.round(a.size/1024/1024*100)/100)+"MB ",3)]),t("td",ut,[t("div",pt,[t("span",{class:i(["block truncate max-w-[250px]",[e(s)?"text-gray-400":"text-gray-500"]])},g(a.text),3),t("div",xt,[t("div",yt,g(a.text),1)])])]),t("td",ht,[t("span",{class:i(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",[a.expired_at?e(s)?"bg-yellow-900/30 text-yellow-400":"bg-yellow-100 text-yellow-800":e(s)?"bg-green-900/30 text-green-400":"bg-green-100 text-green-800"]])},g(a.expired_at?B(a.expired_at):"永久"),3)]),t("td",ft,[t("div",bt,[t("button",{onClick:c=>P(a),class:i(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[e(s)?"bg-blue-900/20 text-blue-400 hover:bg-blue-900/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"]])},[l(e(L),{class:"w-4 h-4 mr-1.5"}),o[9]||(o[9]=h(" 编辑 ",-1))],10,mt),t("button",{onClick:c=>K(a.id),class:i(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[e(s)?"bg-red-900/20 text-red-400 hover:bg-red-900/30":"bg-red-50 text-red-600 hover:bg-red-100"]])},[l(e(Q),{class:"w-4 h-4 mr-1.5"}),o[10]||(o[10]=h(" 删除 ",-1))],10,vt)])])],2))),128))],2)],2)]),t("div",{class:i(["mt-4 flex items-center justify-between px-6 py-4 border-t",[e(s)?"border-gray-700":"border-gray-200"]])},[t("div",{class:i(["flex items-center text-sm",[e(s)?"text-gray-400":"text-gray-500"]])}," 显示第 "+g((n.value.page-1)*n.value.size+1)+" 到 "+g(Math.min(n.value.page*n.value.size,n.value.total))+" 条,共 "+g(n.value.total)+" 条 ",3),t("div",wt,[t("button",{onClick:o[1]||(o[1]=a=>j(n.value.page-1)),disabled:n.value.page===1,class:i(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[e(s)?n.value.page===1?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-gray-300 hover:bg-gray-700":n.value.page===1?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},[l(e(X),{class:"w-4 h-4"}),o[11]||(o[11]=h(" 上一页 ",-1))],10,_t),t("div",kt,[(p(!0),u(S,null,z(q.value,a=>(p(),u(S,{key:a},[a!=="..."?(p(),u("button",{key:0,onClick:c=>j(a),class:i(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[n.value.page===a?"bg-indigo-600 text-white":e(s)?"bg-gray-800 text-gray-300 hover:bg-gray-700":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},g(a),11,Ct)):(p(),u("span",{key:1,class:i(["px-2",[e(s)?"text-gray-400":"text-gray-500"]])}," ... ",2))],64))),128))]),t("button",{onClick:o[2]||(o[2]=a=>j(n.value.page+1)),disabled:n.value.page>=m.value,class:i(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[e(s)?n.value.page>=m.value?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-gray-300 hover:bg-gray-700":n.value.page>=m.value?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},[o[12]||(o[12]=h(" 下一页 ",-1)),l(e(W),{class:"w-4 h-4"})],10,Mt)])],2)],2),F.value?(p(),u("div",St,[t("div",{class:"fixed inset-0 bg-gradient-to-br from-gray-900/90 to-black/90 backdrop-blur-sm transition-opacity duration-300",onClick:_}),t("div",Ft,[t("div",jt,[t("div",{class:i(["relative transform overflow-hidden rounded-2xl text-left shadow-2xl transition-all sm:my-8 sm:w-full sm:max-w-xl animate-modal-scale",[e(s)?"bg-gray-800/95 backdrop-blur-md":"bg-white"]])},[t("div",{class:i(["relative px-6 pt-6 pb-4",[e(s)?"bg-gradient-to-r from-gray-800/50 to-gray-700/50":"bg-gradient-to-r from-gray-50 to-white"]])},[t("div",zt,[t("div",Vt,[t("div",{class:i(["p-2 rounded-lg",[e(s)?"bg-indigo-500/10":"bg-indigo-50"]])},[l(e(L),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])],2),t("h3",{class:i(["text-xl font-semibold leading-6",[e(s)?"text-white":"text-gray-900"]])}," 编辑文件信息 ",2)]),t("button",{onClick:_,class:i(["rounded-lg p-2 transition-all duration-200 hover:rotate-90",[e(s)?"text-gray-400 hover:text-white hover:bg-white/10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"]])},o[13]||(o[13]=[t("svg",{class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)]),2)])],2),t("div",$t,[t("div",Dt,[t("div",Ut,[t("label",{class:i(["text-sm font-medium flex items-center space-x-2 transition-colors duration-200",[e(s)?"text-gray-300 group-focus-within:text-indigo-400":"text-gray-700 group-focus-within:text-indigo-600"]])},[o[14]||(o[14]=t("span",null,"取件码",-1)),t("div",{class:i(["h-px flex-1 transition-colors duration-200",[e(s)?"bg-gray-700 group-focus-within:bg-indigo-500/50":"bg-gray-200 group-focus-within:bg-indigo-500/30"]])},null,2)],2),t("div",Lt,[x(t("input",{type:"text","onUpdate:modelValue":o[3]||(o[3]=a=>d.value.code=a),class:i(["block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm",[e(s)?"bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50":"bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500"]]),placeholder:"输入取件码"},null,2),[[y,d.value.code]]),t("div",Tt,[l(e(f),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])])])]),t("div",Bt,[t("label",{class:i(["text-sm font-medium flex items-center space-x-2 transition-colors duration-200",[e(s)?"text-gray-300 group-focus-within:text-indigo-400":"text-gray-700 group-focus-within:text-indigo-600"]])},[o[15]||(o[15]=t("span",null,"文件名称",-1)),t("div",{class:i(["h-px flex-1 transition-colors duration-200",[e(s)?"bg-gray-700 group-focus-within:bg-indigo-500/50":"bg-gray-200 group-focus-within:bg-indigo-500/30"]])},null,2)],2),t("div",At,[x(t("input",{type:"text","onUpdate:modelValue":o[4]||(o[4]=a=>d.value.prefix=a),class:i(["block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm",[e(s)?"bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50":"bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500"]]),placeholder:"输入文件名称"},null,2),[[y,d.value.prefix]]),t("div",Et,[l(e(f),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])])])]),t("div",Pt,[t("label",{class:i(["text-sm font-medium flex items-center space-x-2 transition-colors duration-200",[e(s)?"text-gray-300 group-focus-within:text-indigo-400":"text-gray-700 group-focus-within:text-indigo-600"]])},[o[16]||(o[16]=t("span",null,"文件后缀",-1)),t("div",{class:i(["h-px flex-1 transition-colors duration-200",[e(s)?"bg-gray-700 group-focus-within:bg-indigo-500/50":"bg-gray-200 group-focus-within:bg-indigo-500/30"]])},null,2)],2),t("div",Ht,[x(t("input",{type:"text","onUpdate:modelValue":o[5]||(o[5]=a=>d.value.suffix=a),class:i(["block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm",[e(s)?"bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50":"bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500"]]),placeholder:"输入文件后缀"},null,2),[[y,d.value.suffix]]),t("div",Kt,[l(e(f),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])])])]),t("div",qt,[t("label",{class:i(["text-sm font-medium flex items-center space-x-2 transition-colors duration-200",[e(s)?"text-gray-300 group-focus-within:text-indigo-400":"text-gray-700 group-focus-within:text-indigo-600"]])},[o[17]||(o[17]=t("span",null,"过期时间",-1)),t("div",{class:i(["h-px flex-1 transition-colors duration-200",[e(s)?"bg-gray-700 group-focus-within:bg-indigo-500/50":"bg-gray-200 group-focus-within:bg-indigo-500/30"]])},null,2)],2),t("div",It,[x(t("input",{type:"datetime-local","onUpdate:modelValue":o[6]||(o[6]=a=>d.value.expired_at=a),class:i(["block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm",[e(s)?"bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50":"bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500"]])},null,2),[[y,d.value.expired_at]]),t("div",Nt,[l(e(f),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])])])]),t("div",Rt,[t("label",{class:i(["text-sm font-medium flex items-center space-x-2 transition-colors duration-200",[e(s)?"text-gray-300 group-focus-within:text-indigo-400":"text-gray-700 group-focus-within:text-indigo-600"]])},[o[18]||(o[18]=t("span",null,"下载次数限制",-1)),t("div",{class:i(["h-px flex-1 transition-colors duration-200",[e(s)?"bg-gray-700 group-focus-within:bg-indigo-500/50":"bg-gray-200 group-focus-within:bg-indigo-500/30"]])},null,2)],2),t("div",Yt,[x(t("input",{type:"number","onUpdate:modelValue":o[7]||(o[7]=a=>d.value.expired_count=a),class:i(["block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm",[e(s)?"bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50":"bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500"]]),placeholder:"输入下载次数限制"},null,2),[[y,d.value.expired_count]]),t("div",Gt,[l(e(f),{class:i(["w-5 h-5",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])])])])])]),t("div",{class:i(["flex items-center justify-end gap-3 px-6 py-4 border-t bg-gradient-to-b",[e(s)?"border-gray-700/50 from-gray-800/50 to-gray-800":"border-gray-200 from-gray-50 to-white"]])},[t("button",{onClick:_,class:i(["inline-flex items-center justify-center rounded-lg px-4 py-2.5 text-sm font-medium transition-all duration-200",[e(s)?"bg-gray-700/50 text-gray-300 hover:bg-gray-600/50 hover:text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])}," 取消 ",2),t("button",{onClick:H,class:"inline-flex items-center justify-center rounded-lg px-4 py-2.5 text-sm font-medium transition-all duration-200 bg-gradient-to-r from-indigo-600 to-indigo-500 hover:from-indigo-500 hover:to-indigo-600 text-white shadow-lg shadow-indigo-500/25 hover:shadow-indigo-500/35"},[l(e(f),{class:"w-4 h-4 mr-2"}),o[19]||(o[19]=h(" 保存更改 ",-1))])],2)],2)])])])):Y("",!0)]))}});export{Xt as default};