Browse Source

H5版本默认只显示ECPM和时间,刷数据批量添加

master
nili 8 months ago
parent
commit
dcbe21032f
  1. 2
      dist/index.html
  2. 1
      dist/p__AdvRecordList.2fce5070.async.js
  3. 1
      dist/p__AdvRecordList.32672198.async.js
  4. 1
      dist/p__AppManagement.4953f9d3.async.js
  5. 1
      dist/p__AppManagement.f5520ac7.async.js
  6. 1
      dist/p__DeviceOwnerApp.bd572567.async.js
  7. 1
      dist/p__DeviceOwnerApp.d8b740d9.async.js
  8. 1
      dist/p__SuperAdmin.168ca415.async.js
  9. 1
      dist/p__SuperAdmin.ffff8e8d.async.js
  10. 433
      dist/umi.23ba36fb.js
  11. 433
      dist/umi.317bccfe.js
  12. 21
      src/pages/AdvRecordList.tsx
  13. 32
      src/pages/AppManagement.tsx
  14. 20
      src/pages/DeviceOwnerApp.tsx
  15. 40
      src/pages/SuperAdmin.tsx
  16. 15
      src/services/matrix/admin.ts
  17. 15
      src/services/matrix/device.ts
  18. 12
      src/services/matrix/typings.d.ts

2
dist/index.html

@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.317bccfe.js"></script> <script src="/umi.23ba36fb.js"></script>
</body></html> </body></html>

1
dist/p__AdvRecordList.2fce5070.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AdvRecordList.32672198.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AppManagement.4953f9d3.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AppManagement.f5520ac7.async.js

File diff suppressed because one or more lines are too long

1
dist/p__DeviceOwnerApp.bd572567.async.js

File diff suppressed because one or more lines are too long

1
dist/p__DeviceOwnerApp.d8b740d9.async.js

File diff suppressed because one or more lines are too long

1
dist/p__SuperAdmin.168ca415.async.js

File diff suppressed because one or more lines are too long

1
dist/p__SuperAdmin.ffff8e8d.async.js

File diff suppressed because one or more lines are too long

433
dist/umi.23ba36fb.js

File diff suppressed because one or more lines are too long

433
dist/umi.317bccfe.js

File diff suppressed because one or more lines are too long

21
src/pages/AdvRecordList.tsx

@ -1,5 +1,6 @@
import { Column } from '@ant-design/charts'; import { Column } from '@ant-design/charts';
import { import {
ColumnsState,
PageContainer, PageContainer,
ProColumns, ProColumns,
ProFormDateRangePicker, ProFormDateRangePicker,
@ -30,6 +31,20 @@ const AdvRecordList: React.FC = () => {
* */ * */
const intl = useIntl(); const intl = useIntl();
const isMobile = () => {
return window.innerWidth <= 768;
};
const [columnsState, setColumnsState] = useState<Record<string, ColumnsState>>({
deviceId: { show: !isMobile() },
appName: { show: !isMobile() },
platform: { show: !isMobile() },
deviceBrand: { show: !isMobile() },
deviceName: { show: !isMobile() },
ip: { show: !isMobile() },
advType: { show: !isMobile() },
});
const columns: ProColumns<API.MatrixAdvRecordBo>[] = [ const columns: ProColumns<API.MatrixAdvRecordBo>[] = [
{ {
title: '设备id', title: '设备id',
@ -233,6 +248,12 @@ const AdvRecordList: React.FC = () => {
}} }}
request={fetchData} request={fetchData}
columns={columns} columns={columns}
columnsState={{
value: columnsState,
onChange: (newState) => {
setColumnsState(newState);
},
}}
/> />
</TabPane> </TabPane>
<TabPane tab="数据总览" key="2"> <TabPane tab="数据总览" key="2">

32
src/pages/AppManagement.tsx

@ -10,6 +10,7 @@ const AppManagement = () => {
const [editing, setEditing] = useState(false); const [editing, setEditing] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [appArr, setAppArr] = useState<API.MatrixApp[]>([]); const [appArr, setAppArr] = useState<API.MatrixApp[]>([]);
const [filteredAppArr, setFilteredAppArr] = useState<API.MatrixApp[]>([]);
const { initialState } = useModel('@@initialState'); const { initialState } = useModel('@@initialState');
const currentUser = initialState?.currentUser; const currentUser = initialState?.currentUser;
const canUpdate = currentUser && currentUser.role && currentUser.role < 2; const canUpdate = currentUser && currentUser.role && currentUser.role < 2;
@ -24,15 +25,20 @@ const AppManagement = () => {
{ {
title: '应用名', title: '应用名',
dataIndex: 'name', dataIndex: 'name',
copyable: true,
hideInSearch: true,
}, },
{ {
title: 'code', title: 'code',
dataIndex: 'code', dataIndex: 'code',
copyable: true,
hideInSearch: true,
}, },
{ {
title: '下载地址', title: '下载地址',
dataIndex: 'url', dataIndex: 'url',
width: 200, width: 200,
hideInSearch: true,
renderText: (url: string) => ( renderText: (url: string) => (
<Popover <Popover
overlayInnerStyle={{ padding: 0 }} overlayInnerStyle={{ padding: 0 }}
@ -51,10 +57,12 @@ const AppManagement = () => {
dataIndex: 'secret', dataIndex: 'secret',
ellipsis: true, ellipsis: true,
copyable: true, copyable: true,
hideInSearch: true,
}, },
{ {
title: '菜单栏中', title: '菜单栏中',
dataIndex: 'hide', dataIndex: 'hide',
hideInSearch: true,
renderText: (r: number) => { renderText: (r: number) => {
if (r === 0) { if (r === 0) {
return <Tag color="blue"></Tag>; return <Tag color="blue"></Tag>;
@ -66,6 +74,7 @@ const AppManagement = () => {
{ {
title: '渠道', title: '渠道',
dataIndex: 'channel', dataIndex: 'channel',
hideInSearch: true,
renderText: (r: string) => { renderText: (r: string) => {
switch (r) { switch (r) {
case 'fanmiyou': case 'fanmiyou':
@ -79,6 +88,7 @@ const AppManagement = () => {
{ {
title: '操作', title: '操作',
width: 80, width: 80,
hideInSearch: true,
renderText: (record: API.MatrixApp) => ( renderText: (record: API.MatrixApp) => (
<a key="edit" onClick={() => handleEdit(record)}> <a key="edit" onClick={() => handleEdit(record)}>
@ -99,6 +109,7 @@ const AppManagement = () => {
const res = await appList(); const res = await appList();
if (res.data) { if (res.data) {
setAppArr(res.data); setAppArr(res.data);
setFilteredAppArr(res.data);
} }
}; };
@ -121,6 +132,10 @@ const AppManagement = () => {
setVisible(false); setVisible(false);
fetchApp(); fetchApp();
}; };
const handleSearch = (value: string) => {
const filtered = appArr.filter((item) => item?.name?.includes(value));
setFilteredAppArr(filtered);
};
return ( return (
<PageContainer> <PageContainer>
@ -130,9 +145,22 @@ const AppManagement = () => {
</Button> </Button>
)} )}
<ProTable <ProTable
search={false} search={{
defaultCollapsed: false, // 默认展开搜索框
optionRender: () => [
// 自定义搜索框
<Input
key="name"
placeholder="请输入应用名"
onChange={(e) => handleSearch(e.target.value)}
/>,
],
}}
onReset={() => {
setFilteredAppArr(appArr);
}}
columns={canUpdate ? columnsWithOperation : columns} columns={canUpdate ? columnsWithOperation : columns}
dataSource={appArr} dataSource={filteredAppArr}
/> />
<Modal title="编辑" visible={visible} onOk={handleOk} onCancel={handleCancel}> <Modal title="编辑" visible={visible} onOk={handleOk} onCancel={handleCancel}>

20
src/pages/DeviceOwnerApp.tsx

@ -1,4 +1,5 @@
import { import {
ColumnsState,
PageContainer, PageContainer,
ProColumns, ProColumns,
ProFormDateRangePicker, ProFormDateRangePicker,
@ -37,6 +38,10 @@ const DeviceOwnerApp: React.FC = () => {
const [overview, setOverview] = useState<API.OverviewBo>(); const [overview, setOverview] = useState<API.OverviewBo>();
const [daily, setDaily] = useState<API.DateIncome[]>([]); const [daily, setDaily] = useState<API.DateIncome[]>([]);
const isMobile = () => {
return window.innerWidth <= 768;
};
const fetchDevice = async () => { const fetchDevice = async () => {
const res = await deviceList({ appCode: code ? code : '' }); const res = await deviceList({ appCode: code ? code : '' });
if (res.data) { if (res.data) {
@ -57,6 +62,15 @@ const DeviceOwnerApp: React.FC = () => {
deviceRef.current?.reload(); deviceRef.current?.reload();
}; };
const [columnsState, setColumnsState] = useState<Record<string, ColumnsState>>({
deviceId: { show: !isMobile() },
appName: { show: !isMobile() },
platform: { show: !isMobile() },
deviceBrand: { show: !isMobile() },
deviceName: { show: !isMobile() },
ip: { show: !isMobile() },
});
const columns: ProColumns<API.MatrixAdvRecordBo>[] = [ const columns: ProColumns<API.MatrixAdvRecordBo>[] = [
{ {
title: '设备id', title: '设备id',
@ -305,6 +319,12 @@ const DeviceOwnerApp: React.FC = () => {
}} }}
request={fetchData} request={fetchData}
columns={columns} columns={columns}
columnsState={{
value: columnsState,
onChange: (newState) => {
setColumnsState(newState);
},
}}
/> />
</TabPane> </TabPane>
<TabPane tab="数据总览" key="3"> <TabPane tab="数据总览" key="3">

40
src/pages/SuperAdmin.tsx

@ -6,6 +6,7 @@ import {
scheduleList, scheduleList,
whiteList1, whiteList1,
} from '@/services/matrix/admin'; } from '@/services/matrix/admin';
import { MinusCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components'; import { PageContainer } from '@ant-design/pro-components';
import { import {
Button, Button,
@ -205,11 +206,13 @@ const SuperAdmin: React.FC = () => {
fetchScheduleList(); fetchScheduleList();
}, []); }, []);
const handleSaveMock = async (params: API.AddMockScheduleReq) => { const handleSaveMock = async (params: any) => {
const { scheduleTime, ...otherValues } = params; const { scheduleTime, ...otherValues } = params;
const timestamp = moment(scheduleTime).valueOf(); // 使用 moment.js 将日期转换为时间戳 const timeStamps = scheduleTime.map((x: { time: moment.MomentInput }) => {
return moment(x.time).valueOf();
});
try { try {
await addSchedule({ scheduleTime: timestamp, ...otherValues }); // 将时间戳作为参数传递给后端 await addSchedule({ scheduleTime: timeStamps, ...otherValues }); // 将时间戳作为参数传递给后端
} catch { } catch {
return; return;
} }
@ -307,9 +310,36 @@ const SuperAdmin: React.FC = () => {
<Form.Item name="incomeYuan" label="金额(元)"> <Form.Item name="incomeYuan" label="金额(元)">
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item name="sheduleTime" label="开始时间"> {/* <Form.Item name="sheduleTime" label="">
<DatePicker format="YYYY-MM-DD HH:mm" showTime={{ format: 'HH:mm' }} /> <DatePicker format="YYYY-MM-DD HH:mm" showTime={{ format: 'HH:mm' }} />
</Form.Item> </Form.Item> */}
<Form.List name="scheduleTime">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }) => (
<div key={key}>
<Form.Item
name={[name, 'time']}
label="开始时间"
rules={[{ required: true, message: '请选择开始时间' }]}
>
<DatePicker format="YYYY-MM-DD HH:mm" showTime={{ format: 'HH:mm' }} />
</Form.Item>
<MinusCircleOutlined
onClick={() => remove(name)}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}
/>
</div>
))}
<Form.Item>
<Button type="dashed" onClick={() => add()} block>
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form> </Form>
</Modal> </Modal>
</div> </div>

15
src/services/matrix/admin.ts

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

15
src/services/matrix/device.ts

@ -2,6 +2,21 @@
/* eslint-disable */ /* eslint-disable */
import { request } from '@umijs/max'; import { request } from '@umijs/max';
/** 此处后端没有提供注释 GET /api/admin/device/calc */
export async function calc(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.calcParams,
options?: { [key: string]: any },
) {
return request<API.RVoid>('/api/admin/device/calc', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /api/admin/device/incomeDaily */ /** 此处后端没有提供注释 POST /api/admin/device/incomeDaily */
export async function incomeDaily1(body: API.IncomeQuery, options?: { [key: string]: any }) { export async function incomeDaily1(body: API.IncomeQuery, options?: { [key: string]: any }) {
return request<API.RListDateIncome>('/api/admin/device/incomeDaily', { return request<API.RListDateIncome>('/api/admin/device/incomeDaily', {

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

@ -2,7 +2,7 @@ declare namespace API {
type AddMockScheduleReq = { type AddMockScheduleReq = {
appId?: number; appId?: number;
incomeYuan?: number; incomeYuan?: number;
scheduleTime?: number; scheduleTime?: number[];
}; };
type addWhiteList1Params = { type addWhiteList1Params = {
@ -44,6 +44,10 @@ declare namespace API {
adminName: string; adminName: string;
}; };
type calcParams = {
date: number;
};
type CurrentUser = { type CurrentUser = {
avatarUrl?: string; avatarUrl?: string;
nickName?: string; nickName?: string;
@ -218,12 +222,6 @@ declare namespace API {
createdAt?: string; createdAt?: string;
}; };
type mockDataParams = {
appCode: string;
incomeYuan: number;
channel: string;
};
type offlineParams = { type offlineParams = {
deviceId: string; deviceId: string;
}; };

Loading…
Cancel
Save