Browse Source

feat: 隐藏账号

lihao
nili 7 months ago
parent
commit
5b1cbf8c2d
  1. 2
      dist/_umi_route_preload_helper.50964f90.js
  2. 4
      dist/index.html
  3. 1
      dist/p__AdminManagement.4b0ea38b.async.js
  4. 1
      dist/p__AdminManagement.badd5c65.async.js
  5. 144
      dist/umi.20a01b46.js
  6. 45
      src/pages/Admin.tsx
  7. 49
      src/pages/Admin/AdminHideForm.tsx
  8. 57
      src/pages/AdminManagement.tsx
  9. 15
      src/services/matrix/admin.ts
  10. 8
      src/services/matrix/typings.d.ts

2
dist/_umi_route_preload_helper.4c89d74d.js → dist/_umi_route_preload_helper.50964f90.js

@ -1 +1 @@
!function(){"use strict";var t="/".replace(/([^/])$/,"$1/"),e=location.pathname,n=e.startsWith(t)&&decodeURI("/".concat(e.slice(t.length)));if(n){var a=document,c=a.head,r=a.createElement.bind(a),i=function(t,e,n){var a,c=e.r[t]||(null===(a=Object.entries(e.r).find((function(e){var n=e[0];return new RegExp("^".concat(n.replace(/\/:[^/]+/g,"/[^/]+").replace("/*","/.+"),"$")).test(t)})))||void 0===a?void 0:a[1]);return null==c?void 0:c.map((function(t){var a=e.f[t][1],c=e.f[t][0];return{type:c.split(".").pop(),url:"".concat(n.publicPath).concat(c),attrs:[["data-".concat(e.b),"".concat(e.p,":").concat(a)]]}}))}(n,{"p":"ant-design-pro","b":"webpack","f":[["51.a2ea1b3b.async.js",51],["63.86ff1d28.async.js",63],["134.6fc81d91.async.js",134],["169.57647c7d.async.js",169],["p__Welcome.61596037.async.js",185],["p__MoneyManagement.27e1a086.async.js",190],["247.3fe8fb10.async.js",247],["t__plugin-layout__Layout.6cae69f5.chunk.css",301],["t__plugin-layout__Layout.4594a64b.async.js",301],["p__User__Login__index.9d3ab92e.async.js",366],["p__DeviceOwnerApp.ec53e5c4.async.js",371],["390.41467286.async.js",390],["393.38316f72.async.js",393],["397.fb5f72c1.async.js",397],["427.f16a2970.async.js",427],["p__SuperAdmin.aaa0f8d9.async.js",455],["531.3d4ec55a.async.js",531],["539.49b7b156.async.js",539],["p__AdvRecordListV2.52c0941e.async.js",542],["p__Bind.b6ee068f.async.js",557],["559.016bfdbb.async.js",559],["p__404.0c100574.async.js",571],["635.20e45f05.async.js",635],["p__App__AppManagement.a12680df.async.js",731],["804.139cd916.async.js",804],["p__AdminManagement.4b0ea38b.async.js",816],["841.614ef4c0.async.js",841],["p__AdvRecordList.8e5ef22c.async.js",857],["p__UserManagement.2c68b70b.async.js",903],["905.6e225d1b.async.js",905],["930.fca7adbf.async.js",930]],"r":{"/*":[21,29],"/":[2,7,8,20,22,29],"/welcome":[2,3,4,12,20,30,7,8,22,29],"/super":[0,1,2,3,6,14,15,30,7,8,20,22,29],"/adminList":[0,3,14,24,25,2,7,8,20,22,29],"/bind":[2,3,12,13,19,20,30,7,8,22,29],"/appList":[0,1,2,3,6,13,14,16,17,23,24,29,30,7,8,20,22],"/advList/:code":[0,1,2,3,14,16,17,20,24,26,27,29,30,7,8,22],"/advListV2/:code":[0,1,2,3,14,16,17,18,20,24,26,29,30,7,8,22],"/user/:code":[0,1,2,3,14,16,17,24,28,29,30,7,8,20,22],"/money/:code":[0,1,2,3,5,14,16,17,24,29,30,7,8,20,22],"/app/:code":[0,1,2,3,10,14,16,17,20,24,26,29,30,7,8,22],"/user/login":[1,2,3,9,14,16,24]}},{publicPath:"/"});null==i||i.forEach((function(t){var e,n=t.type,a=t.url;if("js"===n)(e=r("script")).src=a,e.async=!0;else{if("css"!==n)return;(e=r("link")).href=a,e.rel="preload",e.as="style"}t.attrs.forEach((function(t){e.setAttribute(t[0],t[1]||"")})),c.appendChild(e)}))}}(); !function(){"use strict";var t="/".replace(/([^/])$/,"$1/"),e=location.pathname,n=e.startsWith(t)&&decodeURI("/".concat(e.slice(t.length)));if(n){var a=document,c=a.head,r=a.createElement.bind(a),i=function(t,e,n){var a,c=e.r[t]||(null===(a=Object.entries(e.r).find((function(e){var n=e[0];return new RegExp("^".concat(n.replace(/\/:[^/]+/g,"/[^/]+").replace("/*","/.+"),"$")).test(t)})))||void 0===a?void 0:a[1]);return null==c?void 0:c.map((function(t){var a=e.f[t][1],c=e.f[t][0];return{type:c.split(".").pop(),url:"".concat(n.publicPath).concat(c),attrs:[["data-".concat(e.b),"".concat(e.p,":").concat(a)]]}}))}(n,{"p":"ant-design-pro","b":"webpack","f":[["51.a2ea1b3b.async.js",51],["63.86ff1d28.async.js",63],["134.6fc81d91.async.js",134],["169.57647c7d.async.js",169],["p__Welcome.61596037.async.js",185],["p__MoneyManagement.27e1a086.async.js",190],["247.3fe8fb10.async.js",247],["t__plugin-layout__Layout.6cae69f5.chunk.css",301],["t__plugin-layout__Layout.4594a64b.async.js",301],["p__User__Login__index.9d3ab92e.async.js",366],["p__DeviceOwnerApp.ec53e5c4.async.js",371],["390.41467286.async.js",390],["393.38316f72.async.js",393],["397.fb5f72c1.async.js",397],["427.f16a2970.async.js",427],["p__SuperAdmin.aaa0f8d9.async.js",455],["531.3d4ec55a.async.js",531],["539.49b7b156.async.js",539],["p__AdvRecordListV2.52c0941e.async.js",542],["p__Bind.b6ee068f.async.js",557],["559.016bfdbb.async.js",559],["p__404.0c100574.async.js",571],["635.20e45f05.async.js",635],["p__App__AppManagement.a12680df.async.js",731],["804.139cd916.async.js",804],["p__AdminManagement.badd5c65.async.js",816],["841.614ef4c0.async.js",841],["p__AdvRecordList.8e5ef22c.async.js",857],["p__UserManagement.2c68b70b.async.js",903],["905.6e225d1b.async.js",905],["930.fca7adbf.async.js",930]],"r":{"/*":[21,29],"/":[2,7,8,20,22,29],"/welcome":[2,3,4,12,20,30,7,8,22,29],"/super":[0,1,2,3,6,14,15,30,7,8,20,22,29],"/adminList":[0,3,14,24,25,2,7,8,20,22,29],"/bind":[2,3,12,13,19,20,30,7,8,22,29],"/appList":[0,1,2,3,6,13,14,16,17,23,24,29,30,7,8,20,22],"/advList/:code":[0,1,2,3,14,16,17,20,24,26,27,29,30,7,8,22],"/advListV2/:code":[0,1,2,3,14,16,17,18,20,24,26,29,30,7,8,22],"/user/:code":[0,1,2,3,14,16,17,24,28,29,30,7,8,20,22],"/money/:code":[0,1,2,3,5,14,16,17,24,29,30,7,8,20,22],"/app/:code":[0,1,2,3,10,14,16,17,20,24,26,29,30,7,8,22],"/user/login":[1,2,3,9,14,16,24]}},{publicPath:"/"});null==i||i.forEach((function(t){var e,n=t.type,a=t.url;if("js"===n)(e=r("script")).src=a,e.async=!0;else{if("css"!==n)return;(e=r("link")).href=a,e.rel="preload",e.as="style"}t.attrs.forEach((function(t){e.setAttribute(t[0],t[1]||"")})),c.appendChild(e)}))}}();

4
dist/index.html

@ -7,10 +7,10 @@
<title>Ant Design Pro</title> <title>Ant Design Pro</title>
<link rel="stylesheet" href="/umi.1ca9308c.css"> <link rel="stylesheet" href="/umi.1ca9308c.css">
<script async src="/scripts/loading.js"></script> <script async src="/scripts/loading.js"></script>
<script src="/_umi_route_preload_helper.4c89d74d.js"></script> <script src="/_umi_route_preload_helper.50964f90.js"></script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.6eed2810.js"></script> <script src="/umi.20a01b46.js"></script>
</body> </body>
</html> </html>

1
dist/p__AdminManagement.4b0ea38b.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AdminManagement.badd5c65.async.js

File diff suppressed because one or more lines are too long

144
dist/umi.6eed2810.js → dist/umi.20a01b46.js

File diff suppressed because one or more lines are too long

45
src/pages/Admin.tsx

@ -1,45 +0,0 @@
import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Alert, Card, Typography } from 'antd';
import React from 'react';
const Admin: React.FC = () => {
const intl = useIntl();
return (
<PageContainer
content={intl.formatMessage({
id: 'pages.admin.subPage.title',
defaultMessage: 'This page can only be viewed by admin',
})}
>
<Card>
<Alert
message={intl.formatMessage({
id: 'pages.welcome.alertMessage',
defaultMessage: 'Faster and stronger heavy-duty components have been released.',
})}
type="success"
showIcon
banner
style={{
margin: -12,
marginBottom: 48,
}}
/>
<Typography.Title level={2} style={{ textAlign: 'center' }}>
<SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
</Typography.Title>
</Card>
<p style={{ textAlign: 'center', marginTop: 24 }}>
Want to add more pages? Please refer to{' '}
<a href="https://pro.ant.design/docs/block-cn" target="_blank" rel="noopener noreferrer">
use block
</a>
</p>
</PageContainer>
);
};
export default Admin;

49
src/pages/Admin/AdminHideForm.tsx

@ -0,0 +1,49 @@
import { Col, Form, Modal, Row, Switch } from 'antd';
import React from 'react';
import { changeAdminHide } from '../../services/matrix/admin';
export type AdminHideFormProps = {
onSubmit: () => void;
data: API.MatrixAdminBo[];
};
const AdminHideForm: React.FC<AdminHideFormProps> = (props) => {
const [form] = Form.useForm();
const handleOk = () => {
props.onSubmit();
};
console.log(props.data);
return (
<Modal title="批量编辑" visible footer={[]} onCancel={handleOk}>
<Row gutter={20}>
<Col span={10}>
<p style={{ textAlign: 'right' }}></p>
</Col>
<Col></Col>
</Row>
<Form labelWrap labelCol={{ span: 10 }} form={form}>
{props.data.map((x) => (
<>
<Form.Item key={x.id} label={x.name} name={x.name}>
<Switch
key={x.id}
defaultValue={x.hide !== 0}
onChange={(val) => {
if (x.id) {
changeAdminHide({ adminId: x.id, hide: val ? 1 : 0 });
}
}}
/>
</Form.Item>
</>
))}
</Form>
</Modal>
);
};
export default AdminHideForm;

57
src/pages/AdminManagement.tsx

@ -1,14 +1,16 @@
import { adminList, appList, saveAdmin } from '@/services/matrix/admin';
import { useModel } from '@umijs/max'; import { useModel } from '@umijs/max';
import { Button, Col, Form, Input, InputNumber, Modal, Row, Select, Table, Tabs, Tag } from 'antd'; import { Button, Col, Form, Input, InputNumber, Modal, Row, Select, Table, Tabs, Tag } from 'antd';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import TabPane from 'antd/es/tabs/TabPane';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { adminList, appList, saveAdmin } from '@/services/matrix/admin'; import AdminHideForm from './Admin/AdminHideForm';
import TabPane from 'antd/es/tabs/TabPane';
const AdminManagement = () => { const AdminManagement = () => {
const [data, setData] = useState<API.MatrixAdminBo[]>([]); const [data, setData] = useState<API.MatrixAdminBo[]>([]);
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [hideFormVisible, setHideFormVisible] = useState(false);
const [editing, setEditing] = useState(false); const [editing, setEditing] = useState(false);
const [role, setRole] = useState<number>(0); const [role, setRole] = useState<number>(0);
const [form] = Form.useForm(); const [form] = Form.useForm();
@ -213,25 +215,52 @@ const AdminManagement = () => {
return ( return (
<div> <div>
<Row align="stretch" gutter={20}>
<Col>
<Button onClick={handleNew}></Button> <Button onClick={handleNew}></Button>
<Tabs centered style={{ backgroundColor: 'white', padding: '20px' }}> </Col>
<Col>
<Button
onClick={() => {
setHideFormVisible(true);
}}
>
</Button>
</Col>
</Row>
<Tabs centered style={{ backgroundColor: 'white', padding: '20px', marginTop: 20 }}>
{currentUser?.role && currentUser.role < 3 && ( {currentUser?.role && currentUser.role < 3 && (
<TabPane tab="游戏主" key="1"> <TabPane tab="游戏主" key="1">
<Table columns={columns} dataSource={data.filter((x) => x.role === 3)} /> <Table
columns={columns}
dataSource={data.filter((x) => x.role === 3 && x.hide === 0)}
/>
</TabPane> </TabPane>
)} )}
<TabPane tab="设备主" key="2"> <TabPane tab="设备主" key="2">
<Table columns={deviceColumns} dataSource={data.filter((x) => x.role === 4)} /> <Table
columns={deviceColumns}
dataSource={data.filter((x) => x.role === 4 && x.hide === 0)}
/>
</TabPane> </TabPane>
{currentUser?.role && currentUser.role < 2 && ( {currentUser?.role && currentUser.role < 2 && (
<TabPane tab="管理员" key="3"> <TabPane tab="管理员" key="3">
<Table columns={columns} dataSource={data.filter((x) => x.role === 2)} /> <Table
columns={columns}
dataSource={data.filter((x) => x.role === 2 && x.hide === 0)}
/>
</TabPane> </TabPane>
)} )}
</Tabs> </Tabs>
<Modal title="编辑" visible={visible} onOk={handleOk} onCancel={handleCancel}> <Modal title="编辑" visible={visible} onOk={handleOk} onCancel={handleCancel}>
<Form form={form} onFinish={handleSaveAdmin}> <Form
labelCol={{ span: 4 }}
wrapperCol={{ span: 18 }}
form={form}
onFinish={handleSaveAdmin}
>
<Form.Item name="id" style={{ display: 'none' }}> <Form.Item name="id" style={{ display: 'none' }}>
<Input type="hidden" /> <Input type="hidden" />
</Form.Item> </Form.Item>
@ -271,12 +300,12 @@ const AdminManagement = () => {
{role > 3 && ( {role > 3 && (
<Row> <Row>
<Col span={12}> <Col span={12}>
<Form.Item label="收入比例" name="incomeRate"> <Form.Item labelCol={{ span: 8 }} label="收入比例" name="incomeRate">
<InputNumber placeholder="1-100整数" style={{ width: '80%' }} /> <InputNumber placeholder="1-100整数" style={{ width: '80%' }} />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item label="设备数" name="deviceCnt"> <Form.Item labelCol={{ span: 8 }} label="设备数" name="deviceCnt">
<InputNumber style={{ width: '80%' }} /> <InputNumber style={{ width: '80%' }} />
</Form.Item> </Form.Item>
</Col> </Col>
@ -284,6 +313,16 @@ const AdminManagement = () => {
)} )}
</Form> </Form>
</Modal> </Modal>
{hideFormVisible && (
<AdminHideForm
data={data}
onSubmit={() => {
setHideFormVisible(false);
fetchData();
}}
/>
)}
</div> </div>
); );
}; };

15
src/services/matrix/admin.ts

@ -57,6 +57,21 @@ export async function appList(options?: { [key: string]: any }) {
}); });
} }
/** 此处后端没有提供注释 POST /api/admin/changeAdminHide */
export async function changeAdminHide(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.changeAdminHideParams,
options?: { [key: string]: any },
) {
return request<API.RVoid>('/api/admin/changeAdminHide', {
method: 'POST',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 GET /api/admin/current */ /** 此处后端没有提供注释 GET /api/admin/current */
export async function current(options?: { [key: string]: any }) { export async function current(options?: { [key: string]: any }) {
return request<API.RMatrixAdmin>('/api/admin/current', { return request<API.RMatrixAdmin>('/api/admin/current', {

8
src/services/matrix/typings.d.ts

@ -60,6 +60,11 @@ declare namespace API {
date: number; date: number;
}; };
type changeAdminHideParams = {
adminId: number;
hide: number;
};
type DateIncome = { type DateIncome = {
date?: number; date?: number;
income?: number; income?: number;
@ -128,6 +133,7 @@ declare namespace API {
parentAdminId?: number; parentAdminId?: number;
deviceCnt?: number; deviceCnt?: number;
incomeRate?: number; incomeRate?: number;
hide?: number;
}; };
type MatrixAdminBo = { type MatrixAdminBo = {
@ -135,6 +141,7 @@ declare namespace API {
name?: string; name?: string;
password?: string; password?: string;
appIds?: number[]; appIds?: number[];
hide?: number;
role?: number; role?: number;
deviceCnt?: number; deviceCnt?: number;
incomeRate?: number; incomeRate?: number;
@ -162,6 +169,7 @@ declare namespace API {
ip?: string; ip?: string;
advId?: number; advId?: number;
sign?: string; sign?: string;
timestamp?: number;
appName?: string; appName?: string;
appId?: number; appId?: number;
createdAt?: number; createdAt?: number;

Loading…
Cancel
Save