nili
9 months ago
24 changed files with 1239 additions and 1012 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@ |
|||||
"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}}]); |
|
File diff suppressed because one or more lines are too long
@ -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(1507),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 +0,0 @@ |
|||||
"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 +0,0 @@ |
|||||
"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}}]); |
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,9 +1,14 @@ |
|||||
/** |
/** |
||||
* @see https://umijs.org/docs/max/access#access
|
* @see https://umijs.org/docs/max/access#access
|
||||
* */ |
* */ |
||||
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { |
export default function access(initialState: { currentUser?: API.MatrixAdmin } | undefined) { |
||||
const { currentUser } = initialState ?? {}; |
const { currentUser } = initialState ?? {}; |
||||
return { |
console.log("access"); |
||||
canAdmin: currentUser && currentUser.access === 'admin', |
console.log(currentUser); |
||||
|
let data = { |
||||
|
canAdmin: currentUser && currentUser.role && currentUser.role < 3 |
||||
}; |
}; |
||||
|
console.log(data); |
||||
|
return data; |
||||
|
|
||||
} |
} |
||||
|
@ -0,0 +1,158 @@ |
|||||
|
import { Button, Form, Input, Modal, Select, Table, Tag } from 'antd'; |
||||
|
import { ColumnsType } from 'antd/es/table'; |
||||
|
import React, { useEffect, useState } from 'react'; |
||||
|
|
||||
|
import { adminList, appList, saveAdmin } from '../services/matrix/admin'; |
||||
|
|
||||
|
const AdminManagement = () => { |
||||
|
const [data, setData] = useState<API.MatrixAdminBo[]>([]); |
||||
|
const [visible, setVisible] = useState(false); |
||||
|
const [form] = Form.useForm(); |
||||
|
const [appArr, setAppArr] = useState<API.MatrixApp[]>([]); |
||||
|
|
||||
|
const getAppNameById = (appId:number) => { |
||||
|
const app = appArr.find(app => app.id === appId); |
||||
|
return app ? app.name : ''; |
||||
|
}; |
||||
|
|
||||
|
const handleEdit = (record:API.MatrixAdminBo) => { |
||||
|
form.setFieldsValue(record); |
||||
|
setVisible(true); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
const columns:ColumnsType<API.MatrixAdminBo> = [ |
||||
|
{ |
||||
|
title: '姓名', |
||||
|
dataIndex: 'name', |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: '应用IDs', |
||||
|
dataIndex: 'appIds', |
||||
|
render: (text:[]) => ( |
||||
|
<div> |
||||
|
{text?.map(appId => ( |
||||
|
<Tag color="blue" key={appId}> |
||||
|
{getAppNameById(appId)} |
||||
|
</Tag> |
||||
|
))} |
||||
|
</div> |
||||
|
), |
||||
|
}, |
||||
|
{ |
||||
|
title: '角色', |
||||
|
dataIndex: 'role', |
||||
|
render: (r:number) => { |
||||
|
let roleText = ''; |
||||
|
switch (r) { |
||||
|
case 1: |
||||
|
roleText = '超级管理员'; |
||||
|
break; |
||||
|
case 2: |
||||
|
roleText = '管理员'; |
||||
|
break; |
||||
|
case 3: |
||||
|
roleText = '普通账号'; |
||||
|
break; |
||||
|
default: |
||||
|
roleText = ''; |
||||
|
} |
||||
|
return roleText; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
render: (record:API.MatrixAdminBo) => [ |
||||
|
<a key="edit" onClick={() => handleEdit(record)}>编辑</a>, |
||||
|
], |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
const handleOk = () => { |
||||
|
form.submit(); |
||||
|
}; |
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
setVisible(false); |
||||
|
}; |
||||
|
|
||||
|
const fetchData = async () => { |
||||
|
const res = await adminList(); |
||||
|
if (res.data) { |
||||
|
setData(res.data); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const fetchApp = async() =>{ |
||||
|
const res = await appList(); |
||||
|
if (res.data) { |
||||
|
setAppArr(res.data); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchData(); |
||||
|
fetchApp(); |
||||
|
}, []); |
||||
|
|
||||
|
const handleNew = () => { |
||||
|
form.resetFields(); // 重置表单字段
|
||||
|
setVisible(true); |
||||
|
}; |
||||
|
|
||||
|
const handleSaveAdmin = async (values: API.MatrixAdminBo) => { |
||||
|
try{ |
||||
|
await saveAdmin(values); |
||||
|
} catch (e) { |
||||
|
return; |
||||
|
} |
||||
|
setVisible(false); |
||||
|
fetchData(); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<div> |
||||
|
<Button onClick={handleNew}>新建账号</Button> |
||||
|
<Table columns={columns} dataSource={data} /> |
||||
|
|
||||
|
<Modal |
||||
|
title="编辑" |
||||
|
visible={visible} |
||||
|
onOk={handleOk} |
||||
|
onCancel={handleCancel} |
||||
|
> |
||||
|
<Form form={form} onFinish={handleSaveAdmin}> |
||||
|
<Form.Item name="id" style={{ display: 'none' }}> |
||||
|
<Input type="hidden" /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="用户名" name="name"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="密码" name="password"> |
||||
|
<Input.Password /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="应用" name="appIds"> |
||||
|
<Select mode="multiple"> |
||||
|
{appArr.map(app => ( |
||||
|
<Select.Option key={app.id} value={app.id}> |
||||
|
{app.name} |
||||
|
</Select.Option> |
||||
|
))} |
||||
|
</Select> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="角色" name="role"> |
||||
|
<Select> |
||||
|
<Select.Option value={2}>管理员</Select.Option> |
||||
|
<Select.Option value={3}>普通账号</Select.Option> |
||||
|
</Select> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
</div> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
export default AdminManagement; |
Loading…
Reference in new issue