304.7be99ab5.chunk.js 7.8 KB

12
  1. "use strict";(self.webpackChunkyge_admin=self.webpackChunkyge_admin||[]).push([[304],{1720:function(e,t,n){n.d(t,{Wo:function(){return l},lQ:function(){return a},x4:function(){return o},XB:function(){return r},pt:function(){return c},BG:function(){return i}});var s=n(3310);const a={getList:e=>(0,s.WY)("/api/sys/log/list",e)},i={getList:e=>(0,s.NE)("/api/sys/user/list",e),handleType:(e,t)=>(0,s.JP)("/api/sys/user/editStatus/".concat(e,"/").concat(t)),del:e=>(0,s.JP)("/api/sys/user/removes/".concat(e)),resetPwd:e=>(0,s.JP)("/api/sys/user/resetPass/".concat(e)),getDetail:e=>(0,s.JP)("/api/sys/user/detail/".concat(e)),edit:e=>(0,s.NE)("/api/sys/user/save",e)},l={getList:e=>(0,s.NE)("/api/cms/goods/pageList",e),save:e=>(0,s.NE)("/api/cms/goods/save",e),delete:e=>(0,s.JP)("/api/cms/goods/remove/".concat(e)),getDetail:e=>(0,s.JP)("/api/cms/goods/detail/".concat(e))},o=e=>(0,s.NE)("/api/admin/login",e),r=()=>(0,s.JP)("/api/admin/logout"),c=e=>(0,s.NE)("/api/sys/user/updatePwd",e)},1304:function(e,t,n){n.r(t),n.d(t,{default:function(){return F}});var s=n(6836),a=n(4965),i=n(9469),l=n(9543),o=n(5294),r=n(5716),c=n(9486),d=n(556),u="Header_header__5MYak",h="Header_user__zAbbm",p="Header_userPopover__CqE0i",m=n(6592),f=n(5422),x=n(7634),g=n(4917),j=n(2726),v=n(1720);const y=async()=>{await(0,v.XB)(),(0,s.FT)(),globalThis.location.href="#/login"};var P=n(1667),b=n(5666),w=n(2346),C=n(5223),Z=n(4196),k=n(2518);const N=e=>{let{visible:t,...n}=e;const s=(0,a.useRef)(""),i=(0,a.useRef)(null),[l,o]=(0,a.useState)(!1),r=async()=>{o(!0);try{var e,t;if(!await(null===(e=i.current)||void 0===e?void 0:e.validateFields()))return;const n=null===(t=i.current)||void 0===t?void 0:t.getFieldsValue(),s={oldPassword:(0,j.z)(P.DS.encode(n.oldPassword)),newPassword:(0,j.z)(P.DS.encode(n.newPassword))};await(0,v.pt)(s),b.ZP.open({type:"success",content:"\u4fee\u6539\u6210\u529f!"}),y()}finally{o(!1)}};return(0,k.jsx)(w.Z,{open:t,title:"\u4fee\u6539\u5bc6\u7801",...n,maskClosable:!1,destroyOnClose:!0,confirmLoading:l,onOk:r,children:(0,k.jsxs)(C.Z,{ref:i,labelCol:{span:5},wrapperCol:{span:16},onFinish:r,autoComplete:"off",children:[(0,k.jsx)(C.Z.Item,{label:"\u65e7\u5bc6\u7801",name:"oldPassword",rules:[{required:!0,message:"\u4e0d\u80fd\u4e3a\u7a7a!"}],children:(0,k.jsx)(Z.Z.Password,{maxLength:15})}),(0,k.jsx)(C.Z.Item,{label:"\u65b0\u5bc6\u7801",name:"newPassword",rules:[{required:!0,message:"\u4e0d\u80fd\u4e3a\u7a7a!"},{min:6,max:15,message:"\u5bc6\u7801\u957f\u5ea6\u4e3a6-15\u4e2a\u5b57\u7b26!"}],children:(0,k.jsx)(Z.Z.Password,{maxLength:15,onChange:e=>s.current=e.target.value})}),(0,k.jsx)(C.Z.Item,{label:"\u786e\u5b9a\u65b0\u5bc6\u7801",name:"checkPass",rules:[{required:!0,message:"\u4e0d\u80fd\u4e3a\u7a7a!"},{validator:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t!==s.current?Promise.reject("\u65b0\u5bc6\u7801\u4e0d\u4e00\u81f4!"):Promise.resolve(t)}}],children:(0,k.jsx)(Z.Z.Password,{maxLength:15})})]})})},z=(e,t)=>{const n=t.split("/");for(const s of e){if(s.path.replace(/\/:[^/]+/g,"")===t)return s;if(2!==n.length&&s.path.indexOf(n[1])>-1&&s.children){const e=z(s.children,t);if(e)return e}}return null};var _=n(1189);const E=window.location.href.includes("#"),L=e=>{let{menuData:t}=e;const{modal:n}=i.Z.useApp(),s=(0,r.TH)(),l=(0,a.useMemo)((()=>((e,t)=>{if(!e||!t.length)return[];const n=[],s=e.split("/").filter((e=>""!==e));let a="";for(let i=0;i<s.length;i++){a+="/".concat(s[i]);const e=z(t,a);if(e&&(n.push({title:e.title,href:i<s.length-1&&e.children?"".concat(E?"#":"").concat(e.redirect||e.path):void 0}),!e.children))break}return n})(s.pathname,t)),[s,t]),[d,j]=(0,a.useState)(!1),{userInfo:v}=(0,o.v9)((e=>e.base)),P=(0,a.useCallback)((()=>{n.confirm({title:"\u63d0\u793a",content:"\u786e\u5b9a\u9000\u51fa\u5417?",async onOk(){await y()}})}),[n]);return(0,k.jsxs)(c.h4,{className:u,children:[(0,k.jsx)(m.Z,{items:l}),(0,k.jsx)(f.Z,{placement:"bottom",content:(0,k.jsxs)("ul",{className:p,children:[(0,k.jsx)("li",{children:(0,k.jsx)(x.ZP,{type:"text",onClick:()=>j(!0),children:"\u4fee\u6539\u5bc6\u7801"})}),(0,k.jsx)("li",{children:(0,k.jsx)(x.ZP,{type:"text",onClick:P,children:"\u9000\u51fa\u767b\u5f55"})})]}),children:(0,k.jsxs)("div",{className:h,children:[(0,k.jsx)(g.C,{size:40,shape:"square",icon:(0,k.jsx)(_.Z,{}),alt:null===v||void 0===v?void 0:v.user.nickName}),(0,k.jsx)("span",{children:null===v||void 0===v?void 0:v.user.nickName})]})}),(0,k.jsx)(N,{visible:d,onCancel:()=>j(!1)})]})};var S=n(3754);const A=(0,a.memo)((e=>{let{menuData:t,maxShowLevel:n=2,...s}=e;const i=(0,r.TH)(),l=(0,r.s0)(),o=(0,a.useMemo)((()=>{let e="";const n=[],s=i.pathname.split("/").filter((e=>""!==e));for(let a=0;a<s.length;a++){e+="/".concat(s[a]);const i=z(t,e);i&&n.push(i.path)}return n}),[t,i]),c=(0,a.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const s=[];return e.forEach((e=>{let a=[];const{title:i,path:l,icon:o,children:r,hide:d}=e,u={key:l,icon:o,label:i};if(d)return null;t<=n-1&&r&&(a=c(r,t+1)),a.length&&(u.children=a),s.push(u)})),s}),[n]),d=(0,a.useCallback)((e=>{l(e.key)}),[l]);return t.length?(0,k.jsx)(S.Z,{mode:"inline",items:c(t),selectedKeys:i.pathname.split("/").map((e=>"/".concat(e))),defaultOpenKeys:o,onClick:d,...s}):null}));var D=n(4980),I=n(6494);const J=a.lazy((()=>Promise.all([n.e(347),n.e(977)]).then(n.bind(n,7977))));function F(){const e=(0,r.s0)(),t=(0,o.v9)((e=>e.base)),n=(0,a.useMemo)((()=>{var e;return null!==(e=t.userInfo)&&void 0!==e&&e.user.isAdmin?[...D.p,...D.U]:[...D.p]}),[t.userInfo]);return(0,a.useEffect)((()=>{(0,s.hA)()?d.Z.dispatch({type:"setUserInfo",payload:(0,s.z3)()}):e("/login",{replace:!0})}),[e]),(0,k.jsx)(i.Z,{children:(0,k.jsxs)(l.Z,{hasSider:!0,className:"layout",children:[(0,k.jsxs)(l.Z.Sider,{width:220,style:{position:"fixed",top:0,left:0,bottom:0,background:"var(--primary-color)"},children:[(0,k.jsx)("div",{className:"logo",children:"\u96c5\u6208\u5c14\u540e\u53f0\u7ba1\u7406"}),(0,k.jsx)(A,{className:"layout-menu",theme:"dark",inlineIndent:20,menuData:n})]}),(0,k.jsxs)(l.Z,{style:{marginLeft:220},children:[(0,k.jsx)(L,{menuData:n}),(0,k.jsx)(c.VY,{style:{margin:"15px",overflow:"initial",position:"relative",background:"#ffffff",padding:20,borderRadius:4},children:(0,k.jsx)(a.Suspense,{fallback:(0,k.jsx)(I.B,{}),children:n.length&&(0,k.jsxs)(r.Z5,{children:[(0,k.jsx)(r.AW,{path:"/",element:(0,k.jsx)(r.Fg,{to:n[0].redirect||n[0].path})}),W(n).map((e=>e.redirect?(0,k.jsx)(r.AW,{path:e.path,element:(0,k.jsx)(r.Fg,{replace:!0,to:e.redirect})},e.path):(0,k.jsx)(r.AW,{path:e.path,Component:e.Component},e.path))),(0,k.jsx)(r.AW,{path:"*",Component:J})]})})})]})]})})}function W(e){return function e(t){const n=[];return t.forEach((t=>{const{children:s=[],...a}=t;n.push(a),s.length&&n.push(...e(s))})),n}(e)}},4980:function(e,t,n){n.d(t,{p:function(){return r},U:function(){return c}});var s=n(5541),a=n(1189),i=n(5340),l=n(4965),o=n(2518);const r=[],c=[{path:"/collection",title:"\u9986\u85cf\u7ba1\u7406",icon:(0,o.jsx)(s.Z,{}),Component:l.lazy((()=>Promise.all([n.e(306),n.e(926),n.e(778),n.e(782),n.e(295),n.e(231),n.e(268),n.e(274)]).then(n.bind(n,4274)))),children:[{path:"/collection/create",title:"\u65b0\u589e",hide:!0,Component:l.lazy((()=>Promise.all([n.e(306),n.e(926),n.e(782),n.e(346),n.e(247),n.e(364)]).then(n.bind(n,6364))))},{path:"/collection/edit/:id",title:"\u7f16\u8f91",hide:!0,Component:l.lazy((()=>Promise.all([n.e(306),n.e(926),n.e(782),n.e(346),n.e(247),n.e(364)]).then(n.bind(n,6364))))}]},{path:"/user",title:"\u7528\u6237\u7ba1\u7406",icon:(0,o.jsx)(a.Z,{}),Component:l.lazy((()=>Promise.all([n.e(306),n.e(926),n.e(778),n.e(782),n.e(295),n.e(346),n.e(231),n.e(995)]).then(n.bind(n,9995))))},{path:"/log",title:"\u64cd\u4f5c\u65e5\u5fd7",icon:(0,o.jsx)(i.Z,{}),Component:l.lazy((()=>Promise.all([n.e(306),n.e(926),n.e(778),n.e(295),n.e(556),n.e(979)]).then(n.bind(n,7179))))}]}}]);
  2. //# sourceMappingURL=304.7be99ab5.chunk.js.map