Browse Source

动态菜单栏

master
nili 9 months ago
parent
commit
dc206ca98e
  1. 10
      config/routes.ts
  2. 14
      dist/271.5eec43d2.async.js
  3. 10
      dist/393.fb29dfde.async.js
  4. 40
      dist/64.c7fff68e.async.js
  5. 12
      dist/913.dea6f481.async.js
  6. 58
      dist/930.0d0532dc.async.js
  7. 3
      dist/941.3ce529e6.async.js
  8. 97
      dist/963.fd5abb07.async.js
  9. 2
      dist/index.html
  10. 10
      dist/p__Admin.4451895f.async.js
  11. 1
      dist/p__Admin.d103d507.async.js
  12. 1
      dist/p__AdvRecordList.9dd0bcc8.async.js
  13. 1
      dist/p__AdvRecordList.bf32001c.async.js
  14. 1
      dist/p__Welcome.61596037.async.js
  15. 102
      dist/umi.62542788.js
  16. 21
      src/app.tsx
  17. 62
      src/pages/AdvRecordList.tsx
  18. 115
      src/pages/Welcome.tsx

10
config/routes.ts

@ -23,7 +23,13 @@ export default [
], ],
}, },
{ {
path: '/advList', path: '/welcome',
name: '欢迎',
icon: 'smile',
component: './Welcome',
},
{
path: '/advList/:code',
name: '广告列表', name: '广告列表',
icon: 'smile', icon: 'smile',
component: './AdvRecordList', component: './AdvRecordList',
@ -47,7 +53,7 @@ export default [
}, },
{ {
path: '/', path: '/',
redirect: '/advList', redirect: '/welcome',
}, },
{ {
path: '*', path: '*',

14
dist/271.5eec43d2.async.js

File diff suppressed because one or more lines are too long

10
dist/393.fb29dfde.async.js

File diff suppressed because one or more lines are too long

40
dist/64.c7fff68e.async.js

File diff suppressed because one or more lines are too long

12
dist/913.dea6f481.async.js

File diff suppressed because one or more lines are too long

58
dist/930.0d0532dc.async.js

File diff suppressed because one or more lines are too long

3
dist/941.3ce529e6.async.js

File diff suppressed because one or more lines are too long

97
dist/963.fd5abb07.async.js

File diff suppressed because one or more lines are too long

2
dist/index.html

@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.d5108968.js"></script> <script src="/umi.62542788.js"></script>
</body></html> </body></html>

10
dist/p__Admin.4451895f.async.js

File diff suppressed because one or more lines are too long

1
dist/p__Admin.d103d507.async.js

@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[551],{9940:function(j,l,e){e.r(l),e.d(l,{default:function(){return y}});var o=e(1413),s=e(67294),m={icon:function(a,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z",fill:a}},{tag:"path",attrs:{d:"M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zM288 421a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm224 272c-85.5 0-155.6-67.3-160-151.6a8 8 0 018-8.4h48.1c4.2 0 7.8 3.2 8.1 7.4C420 589.9 461.5 629 512 629s92.1-39.1 95.8-88.6c.3-4.2 3.9-7.4 8.1-7.4H664a8 8 0 018 8.4C667.6 625.7 597.5 693 512 693zm176-224a48.01 48.01 0 010-96 48.01 48.01 0 010 96z",fill:n}},{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm376 112h-48.1c-4.2 0-7.8 3.2-8.1 7.4-3.7 49.5-45.3 88.6-95.8 88.6s-92-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4zm-24-112a48 48 0 1096 0 48 48 0 10-96 0z",fill:a}}]}},name:"smile",theme:"twotone"},g=m,i=e(91146),c=function(a,n){return s.createElement(i.Z,(0,o.Z)((0,o.Z)({},a),{},{ref:n,icon:g}))};c.displayName="SmileTwoTone";var f=s.forwardRef(c),T={icon:function(a,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M923 283.6a260.04 260.04 0 00-56.9-82.8 264.4 264.4 0 00-84-55.5A265.34 265.34 0 00679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 00-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9zM512 814.8S156 586.7 156 385.5C156 283.6 240.3 201 344.3 201c73.1 0 136.5 40.8 167.7 100.4C543.2 241.8 606.6 201 679.7 201c104 0 188.3 82.6 188.3 184.5 0 201.2-356 429.3-356 429.3z",fill:a}},{tag:"path",attrs:{d:"M679.7 201c-73.1 0-136.5 40.8-167.7 100.4C480.8 241.8 417.4 201 344.3 201c-104 0-188.3 82.6-188.3 184.5 0 201.2 356 429.3 356 429.3s356-228.1 356-429.3C868 283.6 783.7 201 679.7 201z",fill:n}}]}},name:"heart",theme:"twotone"},v=T,d=function(a,n){return s.createElement(i.Z,(0,o.Z)((0,o.Z)({},a),{},{ref:n,icon:v}))};d.displayName="HeartTwoTone";var h=s.forwardRef(d),u=e(90930),p=e(35312),w=e(4393),x=e(38925),z=e(31064),t=e(85893),M=function(){var a=(0,p.useIntl)();return(0,t.jsxs)(u._z,{content:a.formatMessage({id:"pages.admin.subPage.title",defaultMessage:"This page can only be viewed by admin"}),children:[(0,t.jsxs)(w.Z,{children:[(0,t.jsx)(x.Z,{message:a.formatMessage({id:"pages.welcome.alertMessage",defaultMessage:"Faster and stronger heavy-duty components have been released."}),type:"success",showIcon:!0,banner:!0,style:{margin:-12,marginBottom:48}}),(0,t.jsxs)(z.Z.Title,{level:2,style:{textAlign:"center"},children:[(0,t.jsx)(f,{})," Ant Design Pro ",(0,t.jsx)(h,{twoToneColor:"#eb2f96"})," You"]})]}),(0,t.jsxs)("p",{style:{textAlign:"center",marginTop:24},children:["Want to add more pages? Please refer to"," ",(0,t.jsx)("a",{href:"https://pro.ant.design/docs/block-cn",target:"_blank",rel:"noopener noreferrer",children:"use block"}),"\u3002"]})]})},y=M}}]);

1
dist/p__AdvRecordList.9dd0bcc8.async.js

@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(O,i,e){e.r(i);var p=e(15009),d=e.n(p),v=e(99289),o=e.n(v),m=e(48357),h=e(90930),E=e(76104),I=e(35312),f=e(67294),c=e(85893),x=function(){var T=(0,f.useRef)(),M=(0,I.useIntl)(),D=function(){var u=o()(d()().mark(function a(){var s,_,r;return d()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,m.ln)();case 2:return _=n.sent,r=[],(s=_.data)===null||s===void 0||s.forEach(function(t){r.push({label:t.name,value:t.id})}),n.abrupt("return",r);case 6:case"end":return n.stop()}},a)}));return function(){return u.apply(this,arguments)}}(),P=[{title:"\u8BBE\u5907Id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(a){return a/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"},{title:"\u5E94\u7528\u540D\u79F0",hideInTable:!0,dataIndex:"appId",valueType:"select",request:D}];return(0,c.jsx)(h._z,{children:(0,c.jsx)(E.Z,{headerTitle:M.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:T,rowKey:"key",search:{labelWidth:120},request:function(){var u=o()(d()().mark(function a(s){var _,r,l;return d()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,m._5)(s);case 2:return l=t.sent,t.abrupt("return",{data:(_=l.data)===null||_===void 0?void 0:_.data,total:(r=l.data)===null||r===void 0?void 0:r.total,success:!0});case 4:case"end":return t.stop()}},a)}));return function(a){return u.apply(this,arguments)}}(),columns:P})})};i.default=x}}]);

1
dist/p__AdvRecordList.bf32001c.async.js

@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(U,d,e){e.r(d);var E=e(15009),u=e.n(E),p=e(97857),l=e.n(p),x=e(99289),f=e.n(x),I=e(48357),h=e(90930),D=e(76104),M=e(35312),i=e(67294),T=e(96974),o=e(85893),P=function(){var m=(0,i.useRef)(),O=(0,M.useIntl)(),j=[{title:"\u8BBE\u5907Id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(_){return _/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"}],b=(0,T.UO)(),c=b.code,R=function(){var t=f()(u()().mark(function _(v){var r,n,s;return u()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,(0,I._5)(l()(l()({},v),{},{code:c}));case 2:return s=a.sent,a.abrupt("return",{data:(r=s.data)===null||r===void 0?void 0:r.data,total:(n=s.data)===null||n===void 0?void 0:n.total,success:!0});case 4:case"end":return a.stop()}},_)}));return function(v){return t.apply(this,arguments)}}();return(0,i.useEffect)(function(){var t;(t=m.current)===null||t===void 0||t.reload()},[c]),(0,o.jsx)(h._z,{children:(0,o.jsx)(D.Z,{headerTitle:O.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:m,rowKey:"key",search:{labelWidth:120},request:R,columns:j})})};d.default=P}}]);

1
dist/p__Welcome.61596037.async.js

@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[185],{9622:function(g,i,n){n.r(i);var o=n(90930),d=n(35312),r=n(9361),s=n(4393),c=n(67294),a=n(85893),l=function(){var e,u=r.Z.useToken(),_=u.token,A=(0,d.useModel)("@@initialState"),t=A.initialState;return(0,a.jsx)(o._z,{children:(0,a.jsx)(s.Z,{style:{borderRadius:8},bodyStyle:{backgroundImage:(t==null||(e=t.settings)===null||e===void 0?void 0:e.navTheme)==="realDark"?"background-image: linear-gradient(75deg, #1A1B1F 0%, #191C1F 100%)":"background-image: linear-gradient(75deg, #FBFDFF 0%, #F5F7FF 100%)"},children:(0,a.jsx)("div",{style:{backgroundPosition:"100% -30%",backgroundRepeat:"no-repeat",backgroundSize:"274px auto",backgroundImage:"url('https://gw.alipayobjects.com/mdn/rms_a9745b/afts/img/A*BuFmQqsB2iAAAAAAAAAAAAAAARQnAQ')"},children:(0,a.jsx)("div",{style:{fontSize:"20px",color:_.colorTextHeading},children:"\u6B22\u8FCE\u4F7F\u7528 Matrix"})})})})};i.default=l}}]);

102
dist/umi.d5108968.js → dist/umi.62542788.js

File diff suppressed because one or more lines are too long

21
src/app.tsx

@ -1,12 +1,13 @@
import { AvatarDropdown, AvatarName, Footer, Question, SelectLang } from '@/components'; import { AvatarDropdown, AvatarName, Footer, Question, SelectLang } from '@/components';
import { current } from '@/services/matrix/admin'; import { current } from '@/services/matrix/admin';
import { LinkOutlined } from '@ant-design/icons'; import { LinkOutlined } from '@ant-design/icons';
import { SettingDrawer } from '@ant-design/pro-components'; import { MenuDataItem, SettingDrawer } from '@ant-design/pro-components';
import { history, Link } from '@umijs/max'; import { history, Link } from '@umijs/max';
import React from 'react'; import React from 'react';
import defaultSettings from '../config/defaultSettings'; import defaultSettings from '../config/defaultSettings';
import { errorConfig } from './requestErrorConfig'; import { errorConfig } from './requestErrorConfig';
import { appList } from './services/matrix/admin';
import type { Settings as LayoutSettings } from '@ant-design/pro-components'; import type { Settings as LayoutSettings } from '@ant-design/pro-components';
import type { RunTimeLayoutConfig } from '@umijs/max'; import type { RunTimeLayoutConfig } from '@umijs/max';
@ -52,6 +53,24 @@ export async function getInitialState(): Promise<{
// ProLayout 支持的api https://procomponents.ant.design/components/layout // ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
return { return {
menu: {
// 每当 initialState?.currentUser?.userid 发生修改时重新执行 request
params: {
userId: initialState?.currentUser?.id,
},
request: async () => {
const apps = await appList();
const menuData:MenuDataItem[] = [];
apps.data?.forEach((x) => {
menuData.push({
"path": "/advList/" + x.code,
"name": x.name,
"component": "./AdvRecordList"
})
})
return menuData;
},
},
actionsRender: () => [<Question key="doc" />, <SelectLang key="SelectLang" />], actionsRender: () => [<Question key="doc" />, <SelectLang key="SelectLang" />],
avatarProps: { avatarProps: {
// src: initialState?.currentUser?.avatar, // src: initialState?.currentUser?.avatar,

62
src/pages/AdvRecordList.tsx

@ -1,11 +1,13 @@
import { advList, appList } from '@/services/matrix/admin'; import { advList } from '@/services/matrix/admin';
import { PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; import { PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import React, { useRef } from 'react'; import React, { useEffect, useRef } from 'react';
import { RequestOptionsType, ProFieldRequestData } from "@ant-design/pro-utils"; import { useParams } from 'react-router-dom';
// import { RequestOptionsType, ProFieldRequestData } from "@ant-design/pro-utils";
import type { ActionType } from '@ant-design/pro-components'; import type { ActionType } from '@ant-design/pro-components';
const AdvRecordList: React.FC = () => { const AdvRecordList: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
@ -15,15 +17,15 @@ const AdvRecordList: React.FC = () => {
* */ * */
const intl = useIntl(); const intl = useIntl();
const appNameMap: ProFieldRequestData = async () => { // const appNameMap: ProFieldRequestData = async () => {
let res = await appList(); // let res = await appList();
let data: RequestOptionsType[] = []; // let data: RequestOptionsType[] = [];
res.data?.forEach(x=>{ // res.data?.forEach(x=>{
data.push({label: x.name, value: x.id}) // data.push({label: x.name, value: x.id})
}) // })
return data; // return data;
} // }
const columns: ProColumns<API.MatrixAdvRecordBo>[] = [ const columns: ProColumns<API.MatrixAdvRecordBo>[] = [
{ {
@ -125,15 +127,28 @@ const AdvRecordList: React.FC = () => {
dataIndex: 'createdAt', dataIndex: 'createdAt',
valueType: 'dateRange' valueType: 'dateRange'
}, },
{ // {
title: "应用名称", // title: "应用名称",
hideInTable: true, // hideInTable: true,
dataIndex: 'appId', // dataIndex: 'appId',
valueType: "select", // valueType: "select",
request: appNameMap // request: appNameMap
} // }
]; ];
const {code} = useParams();
const fetchData = async (params:any) => {
const res = await advList({...params, code:code});
return {
data: res.data?.data,
total: res.data?.total,
success: true
}
};
useEffect(() => {
actionRef.current?.reload();
}, [code]);
return ( return (
<PageContainer> <PageContainer>
@ -147,14 +162,7 @@ const AdvRecordList: React.FC = () => {
search={{ search={{
labelWidth: 120, labelWidth: 120,
}} }}
request={async (params: any) => { request={fetchData}
const res = await advList(params);
return {
data: res.data?.data,
total: res.data?.total,
success: true
}
}}
columns={columns} columns={columns}
/> />
</PageContainer> </PageContainer>

115
src/pages/Welcome.tsx

@ -8,80 +8,6 @@ import React from 'react';
* @param param0 * @param param0
* @returns * @returns
*/ */
const InfoCard: React.FC<{
title: string;
index: number;
desc: string;
href: string;
}> = ({ title, href, index, desc }) => {
const { useToken } = theme;
const { token } = useToken();
return (
<div
style={{
backgroundColor: token.colorBgContainer,
boxShadow: token.boxShadow,
borderRadius: '8px',
fontSize: '14px',
color: token.colorTextSecondary,
lineHeight: '22px',
padding: '16px 19px',
minWidth: '220px',
flex: 1,
}}
>
<div
style={{
display: 'flex',
gap: '4px',
alignItems: 'center',
}}
>
<div
style={{
width: 48,
height: 48,
lineHeight: '22px',
backgroundSize: '100%',
textAlign: 'center',
padding: '8px 16px 16px 12px',
color: '#FFF',
fontWeight: 'bold',
backgroundImage:
"url('https://gw.alipayobjects.com/zos/bmw-prod/daaf8d50-8e6d-4251-905d-676a24ddfa12.svg')",
}}
>
{index}
</div>
<div
style={{
fontSize: '16px',
color: token.colorText,
paddingBottom: 8,
}}
>
{title}
</div>
</div>
<div
style={{
fontSize: '14px',
color: token.colorTextSecondary,
textAlign: 'justify',
lineHeight: '22px',
marginBottom: 8,
}}
>
{desc}
</div>
<a href={href} target="_blank" rel="noreferrer">
{'>'}
</a>
</div>
);
};
const Welcome: React.FC = () => { const Welcome: React.FC = () => {
const { token } = theme.useToken(); const { token } = theme.useToken();
@ -114,46 +40,7 @@ const Welcome: React.FC = () => {
color: token.colorTextHeading, color: token.colorTextHeading,
}} }}
> >
使 Ant Design Pro 使 Matrix
</div>
<p
style={{
fontSize: '14px',
color: token.colorTextSecondary,
lineHeight: '22px',
marginTop: 16,
marginBottom: 32,
width: '65%',
}}
>
Ant Design Pro umiAnt Design ProComponents
//
</p>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
gap: 16,
}}
>
<InfoCard
index={1}
href="https://umijs.org/docs/introduce/introduce"
title="了解 umi"
desc="umi 是一个可扩展的企业级前端应用框架,umi 以路由为基础的,同时支持配置式路由和约定式路由,保证路由的功能完备,并以此进行功能扩展。"
/>
<InfoCard
index={2}
title="了解 ant design"
href="https://ant.design"
desc="antd 是基于 Ant Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。"
/>
<InfoCard
index={3}
title="了解 Pro Components"
href="https://procomponents.ant.design"
desc="ProComponents 是一个基于 Ant Design 做了更高抽象的模板组件,以 一个组件就是一个页面为开发理念,为中后台开发带来更好的体验。"
/>
</div> </div>
</div> </div>
</Card> </Card>

Loading…
Cancel
Save