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. 38
      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>
<body>
<div id="root"></div>
<script src="/umi.317bccfe.js"></script>
<script src="/umi.23ba36fb.js"></script>
</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 {
ColumnsState,
PageContainer,
ProColumns,
ProFormDateRangePicker,
@ -30,6 +31,20 @@ const AdvRecordList: React.FC = () => {
* */
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>[] = [
{
title: '设备id',
@ -233,6 +248,12 @@ const AdvRecordList: React.FC = () => {
}}
request={fetchData}
columns={columns}
columnsState={{
value: columnsState,
onChange: (newState) => {
setColumnsState(newState);
},
}}
/>
</TabPane>
<TabPane tab="数据总览" key="2">

32
src/pages/AppManagement.tsx

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

20
src/pages/DeviceOwnerApp.tsx

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

38
src/pages/SuperAdmin.tsx

@ -6,6 +6,7 @@ import {
scheduleList,
whiteList1,
} from '@/services/matrix/admin';
import { MinusCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import {
Button,
@ -205,11 +206,13 @@ const SuperAdmin: React.FC = () => {
fetchScheduleList();
}, []);
const handleSaveMock = async (params: API.AddMockScheduleReq) => {
const handleSaveMock = async (params: any) => {
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 {
await addSchedule({ scheduleTime: timestamp, ...otherValues }); // 将时间戳作为参数传递给后端
await addSchedule({ scheduleTime: timeStamps, ...otherValues }); // 将时间戳作为参数传递给后端
} catch {
return;
}
@ -307,9 +310,36 @@ const SuperAdmin: React.FC = () => {
<Form.Item name="incomeYuan" label="金额(元)">
<Input />
</Form.Item>
<Form.Item name="sheduleTime" label="开始时间">
{/* <Form.Item name="sheduleTime" label="">
<DatePicker format="YYYY-MM-DD HH:mm" showTime={{ format: 'HH:mm' }} />
</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>
</Modal>
</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 */
export async function saveAdmin(body: API.MatrixAdminBo, options?: { [key: string]: any }) {
return request<API.RVoid>('/api/admin/saveAdmin', {

15
src/services/matrix/device.ts

@ -2,6 +2,21 @@
/* eslint-disable */
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 */
export async function incomeDaily1(body: API.IncomeQuery, options?: { [key: string]: any }) {
return request<API.RListDateIncome>('/api/admin/device/incomeDaily', {

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

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

Loading…
Cancel
Save