diff --git a/dist/index.html b/dist/index.html index c43c373..07a1fab 100644 --- a/dist/index.html +++ b/dist/index.html @@ -8,6 +8,6 @@
- + \ No newline at end of file diff --git a/dist/umi.0614d338.js b/dist/umi.d85c33d7.js similarity index 99% rename from dist/umi.0614d338.js rename to dist/umi.d85c33d7.js index 06a8766..65950e2 100644 --- a/dist/umi.0614d338.js +++ b/dist/umi.d85c33d7.js @@ -180,7 +180,7 @@ Try polyfilling it using "@formatjs/intl-displaynames" \u4F7F\u7528\u6B64 api \u4F1A\u9020\u6210\u5207\u6362\u8BED\u8A00\u7684\u65F6\u5019\u65E0\u6CD5\u81EA\u52A8\u5237\u65B0\uFF0C\u8BF7\u4F7F\u7528 useIntl \u6216 injectIntl\u3002 http://j.mp/37Fkd5Q - `),So=!1),Gn||co(Io()),Gn.formatMessage(Pt,Ce)},li=function(){return Object.keys(ta)}},49236:function(h,m,e){"use strict";e.d(m,{t:function(){return Z},z:function(){return P}});var r=e(48305),t=e.n(r),n=e(17069),o=e.n(n),l=e(25298),a=e.n(l),s=e(82092),c=e.n(s),v=e(3341),g=e.n(v),x=e(50959),u=e(11527),f=x.createContext(null),S=o()(function D(){var L=this;a()(this,D),c()(this,"callbacks",{}),c()(this,"data",{}),c()(this,"update",function(I){L.callbacks[I]&&L.callbacks[I].forEach(function(T){try{var q=L.data[I];T(q)}catch(Q){T(void 0)}})})});function O(D){var L=D.hook,I=D.onUpdate,T=D.namespace,q=(0,x.useRef)(I),Q=(0,x.useRef)(!1),M;try{M=L()}catch(J){console.error("plugin-model: Invoking '".concat(T||"unknown","' model failed:"),J)}return(0,x.useMemo)(function(){q.current(M)},[]),(0,x.useEffect)(function(){Q.current?q.current(M):Q.current=!0}),null}var w=new S;function P(D){return(0,u.jsxs)(f.Provider,{value:{dispatcher:w},children:[Object.keys(D.models).map(function(L){return(0,u.jsx)(O,{hook:D.models[L],namespace:L,onUpdate:function(T){w.data[L]=T,w.update(L)}},L)}),D.children]})}function Z(D,L){var I=(0,x.useContext)(f),T=I.dispatcher,q=(0,x.useRef)(L);q.current=L;var Q=(0,x.useState)(function(){return q.current?q.current(T.data[D]):T.data[D]}),M=t()(Q,2),J=M[0],X=M[1],V=(0,x.useRef)(J);V.current=J;var U=(0,x.useRef)(!1);return(0,x.useEffect)(function(){return U.current=!0,function(){U.current=!1}},[]),(0,x.useEffect)(function(){var ae,le=function(R){if(!U.current)setTimeout(function(){T.data[D]=R,T.update(D)});else{var B=q.current?q.current(R):R,G=V.current;g()(B,G)||(V.current=B,X(B))}};return(ae=T.callbacks)[D]||(ae[D]=new Set),T.callbacks[D].add(le),T.update(D),function(){T.callbacks[D].delete(le)}},[D]),J}},2733:function(h,m,e){"use strict";e.d(m,{Z:function(){return qe}});var r=e(26068),t=e.n(r),n=e(90228),o=e.n(n),l=e(87999),a=e.n(l),s=e(48305),c=e.n(s),v=e(67825),g=e.n(v),x=e(50959),u=e(47698),f=e(50159),S=e(36735),O=e(52221),w=e(25666),P=e(41268),Z=e(79062),D=e(94675),L=e(40676),I=e(953),T=e(63463),q=e(98984),Q=e(38546),M=e(44368),J=e(74852),X=e(75201),V=e(49547),U=e(19014),ae=e(55725),le=e(75343),ue=e(69793),R=e(5e4),B=e(11527),G=function(ze){var W=ze.values,F=ze.modalOpenState,A=ze.onModalOpenState,K=ze.onSubmit,re=(0,x.useRef)();return(0,x.useEffect)(function(){var de;(de=re.current)===null||de===void 0||de.setFieldsValue(W)},[W]),(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(R.Y,{title:"\u6587\u4EF6\u5206\u7C7B-\u6DFB\u52A0",formRef:re,submitter:{searchConfig:{resetText:"\u91CD\u7F6E"},resetButtonProps:{onClick:function(){var Y;(Y=re.current)===null||Y===void 0||Y.resetFields()}}},initialValues:W,onFinish:K,open:F,onOpenChange:A,children:[(0,B.jsx)(U.Z,{hidden:!0,width:"md",name:"id"}),(0,B.jsx)(U.Z,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0!"}],width:"md",name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})]})})},$=function(ze){var W=ze.values,F=ze.modalOpenState,A=ze.onModalOpenState,K=ze.onSubmit,re=(0,x.useRef)();return(0,x.useEffect)(function(){var de;(de=re.current)===null||de===void 0||de.setFieldsValue(W)},[W]),(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(R.Y,{title:"\u6587\u4EF6\u5206\u7C7B-\u7F16\u8F91",formRef:re,submitter:{searchConfig:{resetText:"\u91CD\u7F6E"},resetButtonProps:{onClick:function(){var Y;(Y=re.current)===null||Y===void 0||Y.resetFields()}}},initialValues:W,onFinish:K,open:F,onOpenChange:A,children:[(0,B.jsx)(U.Z,{hidden:!0,width:"md",name:"id"}),(0,B.jsx)(U.Z,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0!"}],width:"md",name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})]})})},j=e(7485);function se(ze,W){return(0,j.request)("/admin/files/category/add",t()({method:"POST",data:ze},W||{}))}function me(ze,W){return(0,j.request)("/admin/files/category/list",t()({method:"POST",data:ze},W||{}))}function ne(ze,W){return(0,j.request)("/admin/files/category/deleteBatchByIds",t()({method:"POST",data:ze},W||{}))}function k(ze,W){return request("/admin/sys/role/update",_objectSpread({method:"POST",data:ze},W||{}))}function ve(ze,W){return(0,j.request)("/admin/files/page",t()({method:"POST",data:ze},W||{}))}function be(ze,W){return(0,j.request)("/admin/files/add",t()({method:"POST",data:ze},W||{}))}function Ee(ze,W){return(0,j.request)("/admin/files/deleteBatchByIds",t()({method:"POST",data:ze},W||{}))}function je(ze,W){return(0,j.request)("/admin/files/moveFile",t()({method:"POST",data:ze},W||{}))}function we(ze,W){return(0,j.request)("/admin/files/getOssUploadParams",t()({method:"GET",data:ze},W||{}))}var st=function(ze){var W=ze.cid,F=ze.setCid,A=ze.setFilesCategoryItems,K=(0,x.useState)([]),re=c()(K,2),de=re[0],Y=re[1],N=(0,x.useState)(!1),ie=c()(N,2),oe=ie[0],ee=ie[1],fe=(0,x.useState)(!1),Ne=c()(fe,2),tt=Ne[0],$e=Ne[1],he={id:"",name:""},Ue=(0,x.useState)(he),Ge=c()(Ue,2),pe=Ge[0],xe=Ge[1];(0,x.useEffect)(function(){Oe()},[]);var Oe=function(){me().then(function(Ae){var at=Ae.data;Y(at),A(at)})},Fe=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return xe(at),ot.next=3,se(t()({},at));case 3:mt=ot.sent,zt=mt.success,zt&&(xe(he),ee(!1),Oe());case 6:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}(),We=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return xe(at),ot.next=3,ne(t()({},at));case 3:mt=ot.sent,zt=mt.success,zt&&(xe(he),$e(!1),Oe());case 6:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}(),Se=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:ot.t0=at.key,ot.next=ot.t0==="create"?3:ot.t0==="update"?5:ot.t0==="delete"?8:14;break;case 3:return ee(!0),ot.abrupt("break",15);case 5:return xe(at),$e(!0),ot.abrupt("break",15);case 8:return ot.next=10,filesCategoryDelete(at);case 10:return mt=ot.sent,zt=mt.success,zt&&Oe(),ot.abrupt("break",15);case 14:return ot.abrupt("break",15);case 15:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}();return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{values:pe,modalOpenState:tt,onModalOpenState:$e,onSubmit:We}),(0,B.jsx)(G,{values:pe,modalOpenState:oe,onModalOpenState:ee,onSubmit:Fe}),(0,B.jsxs)(S.Z,{direction:"vertical",className:"w-28",children:[(0,B.jsxs)("div",{className:"flex justify-between",children:[(0,B.jsx)("div",{className:"".concat(W?"":"text-blue-500"," cursor-pointer hover:text-blue-500"),onClick:function(){F(null)},children:"\u5168\u90E8\u6587\u4EF6"},null),(0,B.jsx)("div",{className:"cursor-pointer",children:(0,B.jsx)(le.Z,{onClick:function(){Se(t()({key:"create"},he))}})})]}),de==null?void 0:de.map(function(Te){return(0,B.jsxs)("div",{className:"flex justify-between",children:[(0,B.jsx)("div",{className:"".concat(W===Te.id?"text-blue-500":""," cursor-pointer hover:text-blue-500"),onClick:function(){F(Te.id)},children:Te.name},null),(0,B.jsx)("div",{className:"cursor-pointer",children:(0,B.jsx)(ae.Z,{menu:{items:[{label:"\u7F16\u8F91\u5206\u7C7B",key:"update"},{label:"\u5220\u9664\u5206\u7C7B",key:"delete"}],onClick:function(at){var mt=at.key;Se(t()({key:mt},Te))}},children:(0,B.jsx)(ue.Z,{})})})]},Te.id)})]})]})},ct=e(92694),Ye=["fileType","count","defaultValue","mode","imagesShow"],ut=function(W){var F,A=W.fileType,K=W.count,re=W.defaultValue,de=W.mode,Y=W.imagesShow,N=Y===void 0?!0:Y,ie=g()(W,Ye),oe=(0,x.useState)([]),ee=c()(oe,2),fe=ee[0],Ne=ee[1],tt=(0,x.useState)([]),$e=c()(tt,2),he=$e[0],Ue=$e[1],Ge=(0,x.useState)([]),pe=c()(Ge,2),xe=pe[0],Oe=pe[1],Fe=(0,x.useState)([]),We=c()(Fe,2),Se=We[0],Te=We[1],Ae=(0,x.useState)([]),at=c()(Ae,2),mt=at[0],zt=at[1],hn=(0,x.useState)(),ot=c()(hn,2),un=ot[0],Cn=ot[1],On=(0,x.useState)([]),yt=c()(On,2),Lt=yt[0],Qt=yt[1],Kt=(0,x.useState)(!1),an=c()(Kt,2),$n=an[0],Un=an[1],dn=(0,x.useState)(null),on=c()(dn,2),Sn=on[0],vn=on[1],Bn=(0,x.useState)(1),Jn=c()(Bn,2),vr=Jn[0],It=Jn[1],Ct=ie.onChange,Dt=function(Ze){Ct(Ze.target.value)};(0,x.useEffect)(function(){localStorage.getItem("token")&&we().then(function(Et){var Ze=Et.data;Cn(Ze)})},[]),(0,x.useEffect)(function(){dt()},[Sn,vr]);var dt=function(){ve({categoryId:Sn||"",current:vr,fileType:A,pageSize:20}).then(function(Ze){var Ke=Ze.data;Ne(Ke)})},en=function(Ze){if(console.log(Ze.fileType),console.log(A),A&&!Ze.fileType.includes(A)){u.ZP.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u683C\u5F0F");return}var Ke=xe.indexOf(Ze.id);Ke===-1?(Oe(function(wt){return wt.concat(Ze.id)}),Ue(function(wt){return wt.concat(Ze)}),xe.length>=K&&(Oe(function(wt){return wt.filter(function(xt,kt){return kt!==0})}),Ue(function(wt){return wt.filter(function(xt,kt){return kt!==0})}))):(Oe(function(wt){return wt.filter(function(xt){return xt!==Ze.id})}),Ue(function(wt){return wt.filter(function(xt){return xt.id!==Ze.id})}))},pn=function(){var Et=a()(o()().mark(function Ze(){var Ke,wt;return o()().wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Ee(xe);case 2:Ke=kt.sent,wt=Ke.success,wt&&(Oe([]),Ue([]),dt());case 5:case"end":return kt.stop()}},Ze)}));return function(){return Et.apply(this,arguments)}}(),Rn=function(){var Et=a()(o()().mark(function Ze(Ke){var wt,xt;return o()().wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,je({batchMoveParams:xe.map(function(Jt){return{id:Jt,categoryId:Ke}})});case 2:wt=Rt.sent,xt=wt.success,xt&&(Oe([]),Ue([]),dt());case 5:case"end":return Rt.stop()}},Ze)}));return function(Ke){return Et.apply(this,arguments)}}(),Tn=function(){var Ze=Se;he.map(function(Ke){Ze.push(Ke.fullPath)}),console.log(he,"checkedFilesItems"),K<=1?(Ct(Ze.slice(-1)[0]),Te([Ze.slice(-1)[0]])):(Ct(Ze),Te(Ze)),Oe([]),Ue([]),Un(!1)},or=function(Ze){Te(typeof Se=="string"?"":Se.splice(Ze,1)),Te(Se.splice(Ze,1)),Se.length>=1?Ct(Se):Ct("")};(0,x.useEffect)(function(){re&&re.length?Te(typeof re=="string"?[re]:re):Te([])},[re]);var Kn={name:"file",action:un==null?void 0:un.host,multiple:!0,fileList:Lt,data:function(Ze){var Ke={key:(un==null?void 0:un.dir)+Ze.name,OSSAccessKeyId:un==null?void 0:un.accessId,Policy:un==null?void 0:un.policy,success_action_status:"200",Signature:un==null?void 0:un.signature};return Ke},progress:{strokeColor:{"0%":"#108ee9","100%":"#87d068"},size:3,format:function(Ze){return"".concat(parseFloat(Ze.toFixed(2)),"%")}},beforeUpload:function(Ze){}},ht=function(Ze){Qt(Ze.fileList),Ze.file.status,Ze.file.status==="done"?(console.log(Ze),be({path:(un==null?void 0:un.dir)+Ze.file.name,categoryId:Sn,fileType:"images",name:Ze.file.name}).then(function(){Qt(null),dt()})):Ze.file.status==="error"&&u.ZP.error("".concat(Ze.file.name," \u4E0A\u4F20\u5931\u8D25"))};return(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("div",{className:"Itemaaa",children:[(0,B.jsxs)(V.A.Item,t()(t()({},ie),{},{children:[(0,B.jsx)(U.Z,t()({hidden:!0,onChange:Dt,placeholder:ie.placeholder},ie.fieldProps)),de==="text"?(0,B.jsx)(f.ZP,{size:"small",type:"link",onClick:function(){Un(!0)},children:"\u6587\u4EF6\u7BA1\u7406"}):(0,B.jsxs)(S.Z,{children:[Se.map(function(Et){return N&&(0,B.jsxs)("a",{className:"w-20",children:[A==="image"?(0,B.jsx)(O.Z,{width:"100px",height:"100px",src:Et}):(0,B.jsx)("video",{style:{width:100,height:100},src:Et}),(0,B.jsx)(w.Z,{content:(0,B.jsxs)("div",{style:{width:500},children:[(0,B.jsx)("video",{src:Et,controls:!0,width:500}),(0,B.jsx)(P.Z,{defaultValue:Et})]}),title:"",children:""}),(0,B.jsx)(Z.Z,{offset:[-4,-60],onClick:function(){or(Et)},count:(0,B.jsx)(J.Z,{})})]},Et)}),(0,B.jsx)(f.ZP,{onClick:function(){Un(!0)},type:"primary",icon:(0,B.jsx)(X.Z,{})})]})]})),(0,B.jsx)(D.Z,{title:"\u6587\u4EF6\u7BA1\u7406",open:$n,onCancel:function(){Un(!1)},onOk:function(){Un(!1)},footer:null,width:"70%",styles:{body:{padding:0}},children:(0,B.jsxs)("div",{className:"flex",children:[(0,B.jsx)(st,{cid:Sn,setCid:vn,setFilesCategoryItems:zt}),(0,B.jsx)("div",{className:"w-2",children:(0,B.jsx)(L.Z,{})}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{children:(0,B.jsxs)(S.Z,{children:[(0,B.jsx)(f.ZP,{type:"primary",disabled:!xe.length||de==="text",onClick:Tn,children:"\u4F7F\u7528"}),(0,B.jsx)(I.Z,t()(t()({onChange:ht},Kn),{},{showUploadList:!1,children:(0,B.jsx)(f.ZP,{type:"primary",children:"\u4E0A\u4F20\u6587\u4EF6"})})),(0,B.jsx)(T.Z,{title:"\u786E\u8BA4\u5220\u9664\uFF1F",disabled:!xe.length,onConfirm:function(){pn()},children:(0,B.jsx)(f.ZP,{disabled:!xe.length,danger:!0,children:"\u5220\u9664"})}),(0,B.jsx)(q.Z,{className:"w-52",placeholder:"\u79FB\u52A8",disabled:!xe.length,onChange:function(Ze){Rn(Ze)},fieldNames:{label:"name",value:"id"},options:mt})]})}),(0,B.jsx)("div",{className:"h-2"}),(0,B.jsx)("div",{className:"max-w-[712px]",children:(0,B.jsx)(S.Z,{wrap:!0,children:fe==null||(F=fe.records)===null||F===void 0?void 0:F.map(function(Et){return(0,B.jsxs)(Z.Z,{count:xe.indexOf(Et.id)+1,offset:[-16,16],children:[Et.fileType=="images"?(0,B.jsx)(O.Z,{width:112,height:100,preview:!1,src:Et.fullPath,onClick:function(){en(Et)}}):(0,B.jsx)("video",{style:{width:112,height:100},src:Et.fullPath,onClick:function(){en(Et)}}),(0,B.jsxs)("div",{className:"flex justify-between h-6 leading-6",children:[(0,B.jsx)(Q.Z,{title:Et.name,children:(0,B.jsx)("div",{className:"w-20 truncate",children:Et.name})}),(0,B.jsx)("a",{onClick:function(){return(0,ct.JG)(Et.fullPath)},children:"\u590D\u5236"})]})]},Et.id)})})}),(0,B.jsx)("div",{className:"h-2"}),(0,B.jsx)("div",{children:(0,B.jsx)(M.Z,{onChange:function(Ze,Ke){It(Ze)},showQuickJumper:!0,showTotal:function(Ze){return"\u5171 ".concat(fe.total," \u6761")},defaultCurrent:1,defaultPageSize:18,total:fe.total})})]})]})}),(0,B.jsx)("style",{children:` + `),So=!1),Gn||co(Io()),Gn.formatMessage(Pt,Ce)},li=function(){return Object.keys(ta)}},49236:function(h,m,e){"use strict";e.d(m,{t:function(){return Z},z:function(){return P}});var r=e(48305),t=e.n(r),n=e(17069),o=e.n(n),l=e(25298),a=e.n(l),s=e(82092),c=e.n(s),v=e(3341),g=e.n(v),x=e(50959),u=e(11527),f=x.createContext(null),S=o()(function D(){var L=this;a()(this,D),c()(this,"callbacks",{}),c()(this,"data",{}),c()(this,"update",function(I){L.callbacks[I]&&L.callbacks[I].forEach(function(T){try{var q=L.data[I];T(q)}catch(Q){T(void 0)}})})});function O(D){var L=D.hook,I=D.onUpdate,T=D.namespace,q=(0,x.useRef)(I),Q=(0,x.useRef)(!1),M;try{M=L()}catch(J){console.error("plugin-model: Invoking '".concat(T||"unknown","' model failed:"),J)}return(0,x.useMemo)(function(){q.current(M)},[]),(0,x.useEffect)(function(){Q.current?q.current(M):Q.current=!0}),null}var w=new S;function P(D){return(0,u.jsxs)(f.Provider,{value:{dispatcher:w},children:[Object.keys(D.models).map(function(L){return(0,u.jsx)(O,{hook:D.models[L],namespace:L,onUpdate:function(T){w.data[L]=T,w.update(L)}},L)}),D.children]})}function Z(D,L){var I=(0,x.useContext)(f),T=I.dispatcher,q=(0,x.useRef)(L);q.current=L;var Q=(0,x.useState)(function(){return q.current?q.current(T.data[D]):T.data[D]}),M=t()(Q,2),J=M[0],X=M[1],V=(0,x.useRef)(J);V.current=J;var U=(0,x.useRef)(!1);return(0,x.useEffect)(function(){return U.current=!0,function(){U.current=!1}},[]),(0,x.useEffect)(function(){var ae,le=function(R){if(!U.current)setTimeout(function(){T.data[D]=R,T.update(D)});else{var B=q.current?q.current(R):R,G=V.current;g()(B,G)||(V.current=B,X(B))}};return(ae=T.callbacks)[D]||(ae[D]=new Set),T.callbacks[D].add(le),T.update(D),function(){T.callbacks[D].delete(le)}},[D]),J}},2733:function(h,m,e){"use strict";e.d(m,{Z:function(){return qe}});var r=e(26068),t=e.n(r),n=e(90228),o=e.n(n),l=e(87999),a=e.n(l),s=e(48305),c=e.n(s),v=e(67825),g=e.n(v),x=e(50959),u=e(47698),f=e(50159),S=e(36735),O=e(52221),w=e(25666),P=e(41268),Z=e(79062),D=e(94675),L=e(40676),I=e(953),T=e(63463),q=e(98984),Q=e(38546),M=e(44368),J=e(74852),X=e(75201),V=e(49547),U=e(19014),ae=e(55725),le=e(75343),ue=e(69793),R=e(5e4),B=e(11527),G=function(ze){var W=ze.values,F=ze.modalOpenState,A=ze.onModalOpenState,K=ze.onSubmit,re=(0,x.useRef)();return(0,x.useEffect)(function(){var de;(de=re.current)===null||de===void 0||de.setFieldsValue(W)},[W]),(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(R.Y,{title:"\u6587\u4EF6\u5206\u7C7B-\u6DFB\u52A0",formRef:re,submitter:{searchConfig:{resetText:"\u91CD\u7F6E"},resetButtonProps:{onClick:function(){var Y;(Y=re.current)===null||Y===void 0||Y.resetFields()}}},initialValues:W,onFinish:K,open:F,onOpenChange:A,children:[(0,B.jsx)(U.Z,{hidden:!0,width:"md",name:"id"}),(0,B.jsx)(U.Z,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0!"}],width:"md",name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})]})})},$=function(ze){var W=ze.values,F=ze.modalOpenState,A=ze.onModalOpenState,K=ze.onSubmit,re=(0,x.useRef)();return(0,x.useEffect)(function(){var de;(de=re.current)===null||de===void 0||de.setFieldsValue(W)},[W]),(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(R.Y,{title:"\u6587\u4EF6\u5206\u7C7B-\u7F16\u8F91",formRef:re,submitter:{searchConfig:{resetText:"\u91CD\u7F6E"},resetButtonProps:{onClick:function(){var Y;(Y=re.current)===null||Y===void 0||Y.resetFields()}}},initialValues:W,onFinish:K,open:F,onOpenChange:A,children:[(0,B.jsx)(U.Z,{hidden:!0,width:"md",name:"id"}),(0,B.jsx)(U.Z,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0!"}],width:"md",name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})]})})},j=e(7485);function se(ze,W){return(0,j.request)("/api/files/category/add",t()({method:"POST",data:ze},W||{}))}function me(ze,W){return(0,j.request)("/api/files/category/list",t()({method:"POST",data:ze},W||{}))}function ne(ze,W){return(0,j.request)("/api/files/category/deleteBatchByIds",t()({method:"POST",data:ze},W||{}))}function k(ze,W){return request("/api/sys/role/update",_objectSpread({method:"POST",data:ze},W||{}))}function ve(ze,W){return(0,j.request)("/api/files/page",t()({method:"POST",data:ze},W||{}))}function be(ze,W){return(0,j.request)("/api/files/add",t()({method:"POST",data:ze},W||{}))}function Ee(ze,W){return(0,j.request)("/api/files/deleteBatchByIds",t()({method:"POST",data:ze},W||{}))}function je(ze,W){return(0,j.request)("/api/files/moveFile",t()({method:"POST",data:ze},W||{}))}function we(ze,W){return(0,j.request)("/api/files/getOssUploadParams",t()({method:"GET",data:ze},W||{}))}var st=function(ze){var W=ze.cid,F=ze.setCid,A=ze.setFilesCategoryItems,K=(0,x.useState)([]),re=c()(K,2),de=re[0],Y=re[1],N=(0,x.useState)(!1),ie=c()(N,2),oe=ie[0],ee=ie[1],fe=(0,x.useState)(!1),Ne=c()(fe,2),tt=Ne[0],$e=Ne[1],he={id:"",name:""},Ue=(0,x.useState)(he),Ge=c()(Ue,2),pe=Ge[0],xe=Ge[1];(0,x.useEffect)(function(){Oe()},[]);var Oe=function(){me().then(function(Ae){var at=Ae.data;Y(at),A(at)})},Fe=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return xe(at),ot.next=3,se(t()({},at));case 3:mt=ot.sent,zt=mt.success,zt&&(xe(he),ee(!1),Oe());case 6:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}(),We=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return xe(at),ot.next=3,ne(t()({},at));case 3:mt=ot.sent,zt=mt.success,zt&&(xe(he),$e(!1),Oe());case 6:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}(),Se=function(){var Te=a()(o()().mark(function Ae(at){var mt,zt;return o()().wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:ot.t0=at.key,ot.next=ot.t0==="create"?3:ot.t0==="update"?5:ot.t0==="delete"?8:14;break;case 3:return ee(!0),ot.abrupt("break",15);case 5:return xe(at),$e(!0),ot.abrupt("break",15);case 8:return ot.next=10,filesCategoryDelete(at);case 10:return mt=ot.sent,zt=mt.success,zt&&Oe(),ot.abrupt("break",15);case 14:return ot.abrupt("break",15);case 15:case"end":return ot.stop()}},Ae)}));return function(at){return Te.apply(this,arguments)}}();return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{values:pe,modalOpenState:tt,onModalOpenState:$e,onSubmit:We}),(0,B.jsx)(G,{values:pe,modalOpenState:oe,onModalOpenState:ee,onSubmit:Fe}),(0,B.jsxs)(S.Z,{direction:"vertical",className:"w-28",children:[(0,B.jsxs)("div",{className:"flex justify-between",children:[(0,B.jsx)("div",{className:"".concat(W?"":"text-blue-500"," cursor-pointer hover:text-blue-500"),onClick:function(){F(null)},children:"\u5168\u90E8\u6587\u4EF6"},null),(0,B.jsx)("div",{className:"cursor-pointer",children:(0,B.jsx)(le.Z,{onClick:function(){Se(t()({key:"create"},he))}})})]}),de==null?void 0:de.map(function(Te){return(0,B.jsxs)("div",{className:"flex justify-between",children:[(0,B.jsx)("div",{className:"".concat(W===Te.id?"text-blue-500":""," cursor-pointer hover:text-blue-500"),onClick:function(){F(Te.id)},children:Te.name},null),(0,B.jsx)("div",{className:"cursor-pointer",children:(0,B.jsx)(ae.Z,{menu:{items:[{label:"\u7F16\u8F91\u5206\u7C7B",key:"update"},{label:"\u5220\u9664\u5206\u7C7B",key:"delete"}],onClick:function(at){var mt=at.key;Se(t()({key:mt},Te))}},children:(0,B.jsx)(ue.Z,{})})})]},Te.id)})]})]})},ct=e(92694),Ye=["fileType","count","defaultValue","mode","imagesShow"],ut=function(W){var F,A=W.fileType,K=W.count,re=W.defaultValue,de=W.mode,Y=W.imagesShow,N=Y===void 0?!0:Y,ie=g()(W,Ye),oe=(0,x.useState)([]),ee=c()(oe,2),fe=ee[0],Ne=ee[1],tt=(0,x.useState)([]),$e=c()(tt,2),he=$e[0],Ue=$e[1],Ge=(0,x.useState)([]),pe=c()(Ge,2),xe=pe[0],Oe=pe[1],Fe=(0,x.useState)([]),We=c()(Fe,2),Se=We[0],Te=We[1],Ae=(0,x.useState)([]),at=c()(Ae,2),mt=at[0],zt=at[1],hn=(0,x.useState)(),ot=c()(hn,2),un=ot[0],Cn=ot[1],On=(0,x.useState)([]),yt=c()(On,2),Lt=yt[0],Qt=yt[1],Kt=(0,x.useState)(!1),an=c()(Kt,2),$n=an[0],Un=an[1],dn=(0,x.useState)(null),on=c()(dn,2),Sn=on[0],vn=on[1],Bn=(0,x.useState)(1),Jn=c()(Bn,2),vr=Jn[0],It=Jn[1],Ct=ie.onChange,Dt=function(Ze){Ct(Ze.target.value)};(0,x.useEffect)(function(){localStorage.getItem("token")&&we().then(function(Et){var Ze=Et.data;Cn(Ze)})},[]),(0,x.useEffect)(function(){dt()},[Sn,vr]);var dt=function(){ve({categoryId:Sn||"",current:vr,fileType:A,pageSize:20}).then(function(Ze){var Ke=Ze.data;Ne(Ke)})},en=function(Ze){if(console.log(Ze.fileType),console.log(A),A&&!Ze.fileType.includes(A)){u.ZP.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u683C\u5F0F");return}var Ke=xe.indexOf(Ze.id);Ke===-1?(Oe(function(wt){return wt.concat(Ze.id)}),Ue(function(wt){return wt.concat(Ze)}),xe.length>=K&&(Oe(function(wt){return wt.filter(function(xt,kt){return kt!==0})}),Ue(function(wt){return wt.filter(function(xt,kt){return kt!==0})}))):(Oe(function(wt){return wt.filter(function(xt){return xt!==Ze.id})}),Ue(function(wt){return wt.filter(function(xt){return xt.id!==Ze.id})}))},pn=function(){var Et=a()(o()().mark(function Ze(){var Ke,wt;return o()().wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Ee(xe);case 2:Ke=kt.sent,wt=Ke.success,wt&&(Oe([]),Ue([]),dt());case 5:case"end":return kt.stop()}},Ze)}));return function(){return Et.apply(this,arguments)}}(),Rn=function(){var Et=a()(o()().mark(function Ze(Ke){var wt,xt;return o()().wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,je({batchMoveParams:xe.map(function(Jt){return{id:Jt,categoryId:Ke}})});case 2:wt=Rt.sent,xt=wt.success,xt&&(Oe([]),Ue([]),dt());case 5:case"end":return Rt.stop()}},Ze)}));return function(Ke){return Et.apply(this,arguments)}}(),Tn=function(){var Ze=Se;he.map(function(Ke){Ze.push(Ke.fullPath)}),console.log(he,"checkedFilesItems"),K<=1?(Ct(Ze.slice(-1)[0]),Te([Ze.slice(-1)[0]])):(Ct(Ze),Te(Ze)),Oe([]),Ue([]),Un(!1)},or=function(Ze){Te(typeof Se=="string"?"":Se.splice(Ze,1)),Te(Se.splice(Ze,1)),Se.length>=1?Ct(Se):Ct("")};(0,x.useEffect)(function(){re&&re.length?Te(typeof re=="string"?[re]:re):Te([])},[re]);var Kn={name:"file",action:un==null?void 0:un.host,multiple:!0,fileList:Lt,data:function(Ze){var Ke={key:(un==null?void 0:un.dir)+Ze.name,OSSAccessKeyId:un==null?void 0:un.accessId,Policy:un==null?void 0:un.policy,success_action_status:"200",Signature:un==null?void 0:un.signature};return Ke},progress:{strokeColor:{"0%":"#108ee9","100%":"#87d068"},size:3,format:function(Ze){return"".concat(parseFloat(Ze.toFixed(2)),"%")}},beforeUpload:function(Ze){}},ht=function(Ze){Qt(Ze.fileList),Ze.file.status,Ze.file.status==="done"?(console.log(Ze),be({path:(un==null?void 0:un.dir)+Ze.file.name,categoryId:Sn,fileType:"images",name:Ze.file.name}).then(function(){Qt(null),dt()})):Ze.file.status==="error"&&u.ZP.error("".concat(Ze.file.name," \u4E0A\u4F20\u5931\u8D25"))};return(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("div",{className:"Itemaaa",children:[(0,B.jsxs)(V.A.Item,t()(t()({},ie),{},{children:[(0,B.jsx)(U.Z,t()({hidden:!0,onChange:Dt,placeholder:ie.placeholder},ie.fieldProps)),de==="text"?(0,B.jsx)(f.ZP,{size:"small",type:"link",onClick:function(){Un(!0)},children:"\u6587\u4EF6\u7BA1\u7406"}):(0,B.jsxs)(S.Z,{children:[Se.map(function(Et){return N&&(0,B.jsxs)("a",{className:"w-20",children:[A==="image"?(0,B.jsx)(O.Z,{width:"100px",height:"100px",src:Et}):(0,B.jsx)("video",{style:{width:100,height:100},src:Et}),(0,B.jsx)(w.Z,{content:(0,B.jsxs)("div",{style:{width:500},children:[(0,B.jsx)("video",{src:Et,controls:!0,width:500}),(0,B.jsx)(P.Z,{defaultValue:Et})]}),title:"",children:""}),(0,B.jsx)(Z.Z,{offset:[-4,-60],onClick:function(){or(Et)},count:(0,B.jsx)(J.Z,{})})]},Et)}),(0,B.jsx)(f.ZP,{onClick:function(){Un(!0)},type:"primary",icon:(0,B.jsx)(X.Z,{})})]})]})),(0,B.jsx)(D.Z,{title:"\u6587\u4EF6\u7BA1\u7406",open:$n,onCancel:function(){Un(!1)},onOk:function(){Un(!1)},footer:null,width:"70%",styles:{body:{padding:0}},children:(0,B.jsxs)("div",{className:"flex",children:[(0,B.jsx)(st,{cid:Sn,setCid:vn,setFilesCategoryItems:zt}),(0,B.jsx)("div",{className:"w-2",children:(0,B.jsx)(L.Z,{})}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{children:(0,B.jsxs)(S.Z,{children:[(0,B.jsx)(f.ZP,{type:"primary",disabled:!xe.length||de==="text",onClick:Tn,children:"\u4F7F\u7528"}),(0,B.jsx)(I.Z,t()(t()({onChange:ht},Kn),{},{showUploadList:!1,children:(0,B.jsx)(f.ZP,{type:"primary",children:"\u4E0A\u4F20\u6587\u4EF6"})})),(0,B.jsx)(T.Z,{title:"\u786E\u8BA4\u5220\u9664\uFF1F",disabled:!xe.length,onConfirm:function(){pn()},children:(0,B.jsx)(f.ZP,{disabled:!xe.length,danger:!0,children:"\u5220\u9664"})}),(0,B.jsx)(q.Z,{className:"w-52",placeholder:"\u79FB\u52A8",disabled:!xe.length,onChange:function(Ze){Rn(Ze)},fieldNames:{label:"name",value:"id"},options:mt})]})}),(0,B.jsx)("div",{className:"h-2"}),(0,B.jsx)("div",{className:"max-w-[712px]",children:(0,B.jsx)(S.Z,{wrap:!0,children:fe==null||(F=fe.records)===null||F===void 0?void 0:F.map(function(Et){return(0,B.jsxs)(Z.Z,{count:xe.indexOf(Et.id)+1,offset:[-16,16],children:[Et.fileType=="images"?(0,B.jsx)(O.Z,{width:112,height:100,preview:!1,src:Et.fullPath,onClick:function(){en(Et)}}):(0,B.jsx)("video",{style:{width:112,height:100},src:Et.fullPath,onClick:function(){en(Et)}}),(0,B.jsxs)("div",{className:"flex justify-between h-6 leading-6",children:[(0,B.jsx)(Q.Z,{title:Et.name,children:(0,B.jsx)("div",{className:"w-20 truncate",children:Et.name})}),(0,B.jsx)("a",{onClick:function(){return(0,ct.JG)(Et.fullPath)},children:"\u590D\u5236"})]})]},Et.id)})})}),(0,B.jsx)("div",{className:"h-2"}),(0,B.jsx)("div",{children:(0,B.jsx)(M.Z,{onChange:function(Ze,Ke){It(Ze)},showQuickJumper:!0,showTotal:function(Ze){return"\u5171 ".concat(fe.total," \u6761")},defaultCurrent:1,defaultPageSize:18,total:fe.total})})]})]})}),(0,B.jsx)("style",{children:` .Itemaaa .ant-form-item { margin-bottom: 0px; } diff --git a/src/services/files/index.ts b/src/services/files/index.ts index 6ed789b..41b803d 100644 --- a/src/services/files/index.ts +++ b/src/services/files/index.ts @@ -3,7 +3,7 @@ import { request } from '@umijs/max'; // 分类 export function categoryAdd(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/category/add`, { + return request(`/api/files/category/add`, { method: 'POST', data:params, ...(options || {}) @@ -12,7 +12,7 @@ export function categoryAdd(params?: any, options?: { [key: string]: any }) { export function categoryList(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/category/list`, { + return request(`/api/files/category/list`, { method: 'POST', data:params, ...(options || {}) @@ -20,7 +20,7 @@ export function categoryList(params?: any, options?: { [key: string]: any }) { } export function categoryDelete(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/category/deleteBatchByIds`, { + return request(`/api/files/category/deleteBatchByIds`, { method: 'POST', data:params, ...(options || {}) @@ -28,7 +28,7 @@ export function categoryDelete(params?: any, options?: { [key: string]: any }) { } export function roleUpdate(params?: any, options?: { [key: string]: any }) { - return request(`/admin/sys/role/update`, { + return request(`/api/sys/role/update`, { method: 'POST', data:params, ...(options || {}) @@ -37,7 +37,7 @@ export function roleUpdate(params?: any, options?: { [key: string]: any }) { // 文件 export function filesPage(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/page`, { + return request(`/api/files/page`, { method: 'POST', data:params, ...(options || {}) @@ -45,7 +45,7 @@ export function filesPage(params?: any, options?: { [key: string]: any }) { } export function filesAdd(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/add`, { + return request(`/api/files/add`, { method: 'POST', data:params, ...(options || {}) @@ -53,7 +53,7 @@ export function filesAdd(params?: any, options?: { [key: string]: any }) { } export function filesDelete(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/deleteBatchByIds`, { + return request(`/api/files/deleteBatchByIds`, { method: 'POST', data:params, ...(options || {}) @@ -61,7 +61,7 @@ export function filesDelete(params?: any, options?: { [key: string]: any }) { } export function filesMove(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/moveFile`, { + return request(`/api/files/moveFile`, { method: 'POST', data:params, ...(options || {}) @@ -70,7 +70,7 @@ export function filesMove(params?: any, options?: { [key: string]: any }) { // OSS export function getOssUploadParams(params?: any, options?: { [key: string]: any }) { - return request(`/admin/files/getOssUploadParams`, { + return request(`/api/files/getOssUploadParams`, { method: 'GET', data:params, ...(options || {})