20260905172534
This commit is contained in:
1 parent
1b01a31252
commit
7b00eeb88c
711 files changed
+2849
-959
No files matched your search
@@ -0,0 +1 @@
|
||||
import{$ as e,A as t,G as n,H as r,Ht as i,Lt as a,M as o,Q as s,T as c,U as l,V as u,_ as d,a as f,b as p,d as m,gt as h,it as g,lt as _,p as v,t as y,ut as b,v as x,w as S,wt as C,x as w,y as T,zt as E}from"./_plugin-vue_export-helper-Ktpf6lZe.js";import{B as D,D as O,E as ee,G as k,K as A,R as j,T as M,b as N,c as P,g as F,h as te,i as ne,l as re,n as ie,p as ae,r as oe,s as se,t as I}from"./ui-BhP3ZSBa.js";import{n as ce,t as le}from"./upload-BQ-x-HCK.js";import{i as L,n as R,r as ue,t as de}from"./folder-open-xxjo8zBP.js";import{t as z}from"./inbox-c3GPUSJZ.js";import{t as fe}from"./layout-grid-4RbS718w.js";import{t as pe}from"./list-CLWjpOzg.js";import{t as B}from"./rotate-ccw-AQ4L8JGg.js";import{t as me}from"./trash-2-CumKnXxQ.js";import{a as V,c as H,n as U,o as he}from"./api-BHfsXASe.js";g(),o();var W={class:`fc-panel`},ge={class:`fc-panel__tree`},_e={key:0,class:`fc-panel__loading`},ve=y({__name:`FileCategoryPanel`,props:{treeData:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1},selectedKey:{type:String,default:``},expandedKeys:{type:Array,default:()=>[]}},emits:[`select`,`update:expandedKeys`],setup(e,{emit:t}){let n=e,r=t,i=d(()=>n.selectedKey?[n.selectedKey]:[]);function a(e,t){if(t?.node?.isFmsRoot){r(`select`,``);return}r(`select`,e.length?String(e[0]):``)}function o(e){r(`update:expandedKeys`,e)}return(t,n)=>(l(),w(`aside`,W,[x(`div`,ge,[c(h(ie),{"tree-data":e.treeData,"selected-keys":i.value,"expanded-keys":e.expandedKeys,"block-node":!0,onSelect:a,"onUpdate:expandedKeys":o},null,8,[`tree-data`,`selected-keys`,`expanded-keys`]),e.loading?(l(),w(`div`,_e,[c(h(re))])):p(``,!0)])]))}},[[`__scopeId`,`data-v-4cc6122a`]]),G=null,K=null,q=3e5;async function J(){return G||(G=(await H(`/file/config`)).data.storageType,G)}async function ye({files:e,father:t,moduleId:n,cateId:r}){return G||await J(),G===`aliyun-oss`?Y({files:e,father:t,moduleId:n,cateId:r}):be({files:e,father:t,moduleId:n,cateId:r})}async function be({files:e,father:t,moduleId:n,cateId:r}){let i=new FormData;for(let t of e)i.append(`files`,t);return i.append(`father`,t),i.append(`moduleId`,n),r&&i.append(`cateId`,r),(await H(`/file/upload`,i,{headers:{"Content-Type":void 0}})).data}async function Y({files:e,father:t,moduleId:n,cateId:r}){let{accessid:i,policy:a,signature:o,dir:s,host:c}=await xe(),l=[];for(let u of e){let e=await V(),d=String(e.data),f=Te(u.name),p=crypto.randomUUID().replace(/-/g,``)+(f?`.`+f:``),m=await Ce(c,{key:s+p,OSSAccessKeyId:i,policy:a,Signature:o,file:u,filename:p}),h={subid:d,father:t,mx_moduleid:n,mx_cate_id:r||``,mx_filename:u.name,mx_filesize:String(u.size),mx_fileext:f,mx_mapfilename:m};await H(`/file/save-record`,h),l.push(h)}return l}async function xe(){return K&&!Se(K)||(K={...(await H(`/file/upload-credential`)).data,fetchedAt:Date.now()}),K}function Se(e){return e.expire?Date.now()+q>Number(e.expire)*1e3:e.Expiration?Date.now()+q>new Date(e.Expiration).getTime():Date.now()-e.fetchedAt>33e5}function Ce(e,t){let n=new FormData;return n.append(`key`,t.key),n.append(`OSSAccessKeyId`,t.OSSAccessKeyId),n.append(`policy`,t.policy),n.append(`Signature`,t.Signature),n.append(`file`,t.file,t.filename),new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`POST`,e),a.addEventListener(`load`,()=>{a.status===200||a.status===204?r(e+`/`+t.key):i(Error(`OSS 上传失败: `+a.status))}),a.addEventListener(`error`,()=>i(Error(`OSS 上传异常`))),a.send(n)})}function X(e){return e.mx_mapfilename}async function we(e){return H(`/file/delete`,{subid:e})}function Te(e){return!e||!e.includes(`.`)?``:e.substring(e.lastIndexOf(`.`)+1).toLowerCase()}var Ee={pdf:`#f5222d`,doc:`#1677ff`,docx:`#1677ff`,txt:`#8c8c8c`,md:`#8c8c8c`,xls:`#52c41a`,xlsx:`#52c41a`,csv:`#52c41a`,ppt:`#fa541c`,pptx:`#fa541c`,jpg:`#722ed1`,jpeg:`#722ed1`,png:`#722ed1`,gif:`#722ed1`,bmp:`#722ed1`,webp:`#722ed1`,svg:`#722ed1`,zip:`#fa8c16`,rar:`#fa8c16`,"7z":`#fa8c16`,mp3:`#13c2c2`,wav:`#13c2c2`,mp4:`#13c2c2`,mov:`#13c2c2`},De=`#8c8c8c`;function Oe(e){let t=(e||``).lastIndexOf(`.`);return t>=0?e.substring(t+1).toLowerCase():``}function ke(e){return Ee[Oe(e)]||De}function Ae(e){return[`jpg`,`jpeg`,`png`,`gif`,`bmp`,`webp`,`svg`].includes(Oe(e))}function je(e){let t=Number(e||0);return t<1024?t+` B`:t<1048576?(t/1024).toFixed(1)+` KB`:t<1073741824?(t/1048576).toFixed(1)+` MB`:(t/1073741824).toFixed(2)+` GB`}o(),C(),g(),f();var Me=[`title`],Z={class:`fcard__thumb`},Q=[`src`],Ne={class:`fcard__info`},Pe={class:`fcard__name`},Fe=[`title`],Ie={class:`fcard__meta`},Le=y({__name:`FileCard`,props:{file:{type:Object,required:!0},selected:{type:Boolean,default:!1}},emits:[`select`,`preview`,`download`,`delete`],setup(n,{emit:r}){let o=n,s=r,u=d(()=>!!o.file?.pending),f=d(()=>Ae(o.file?.mx_filename||``)),g=d(()=>f.value&&(o.file?.blobUrl||X(o.file))||``),_=d(()=>Oe(o.file?.mx_filename||``)),v=d(()=>_.value.toUpperCase()||`?`),y=d(()=>ke(o.file?.mx_filename||``)),b=d(()=>[{key:`preview`,label:`预览`,icon:t(j,{size:13})}]);function C(e){s(`select`,o.filLine truncated
|
||||
Reference in new issue
Block a user