代码优化
This commit is contained in:
parent
afcaddcc0f
commit
d13aab8aa4
|
|
@ -6,7 +6,7 @@ import {
|
||||||
getOldUserData,
|
getOldUserData,
|
||||||
getTodayUserData,
|
getTodayUserData,
|
||||||
getWeekUserData,
|
getWeekUserData,
|
||||||
} from '@/services/DataBorad/activeanalysis';
|
} from '@/services/dataBorad/activeanalysis';
|
||||||
import MoreData from '@/pages/DataBoard/ActiveAnalysis/List/components/MoreData';
|
import MoreData from '@/pages/DataBoard/ActiveAnalysis/List/components/MoreData';
|
||||||
import ReactEcharts from 'echarts-for-react';
|
import ReactEcharts from 'echarts-for-react';
|
||||||
import { Card, Col, Row, Select } from 'antd';
|
import { Card, Col, Row, Select } from 'antd';
|
||||||
|
|
@ -75,7 +75,7 @@ const ActiveAnalysis: React.FC = () => {
|
||||||
<Card style={{ width: '100%' }}>
|
<Card style={{ width: '100%' }}>
|
||||||
<Row gutter={32} style={{ marginBottom: 10 }}>
|
<Row gutter={32} style={{ marginBottom: 10 }}>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<h1>DAU</h1>
|
<h1>登陆人数数据图</h1>
|
||||||
<Select
|
<Select
|
||||||
defaultValue="lucy"
|
defaultValue="lucy"
|
||||||
value={timeType}
|
value={timeType}
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,12 @@ import {
|
||||||
getTodayUserData,
|
getTodayUserData,
|
||||||
getMonthPayData,
|
getMonthPayData,
|
||||||
getNewUserData,
|
getNewUserData,
|
||||||
} from '@/services/DataBorad/coredata';
|
} from '@/services/dataBorad/coredata';
|
||||||
import MoreData from '@/pages/DataBoard/ActiveAnalysis/List/components/MoreData';
|
import MoreData from '@/pages/DataBoard/ActiveAnalysis/List/components/MoreData';
|
||||||
import { Card, Col, Row, DatePicker, Select } from 'antd';
|
import { Card, Col, Row, Select } from 'antd';
|
||||||
const CoreData: React.FC = () => {
|
const CoreData: React.FC = () => {
|
||||||
const tableRef = useRef<ActionType>();
|
const tableRef = useRef<ActionType>();
|
||||||
const [startTimeValue, setStartTimeValue] = useState(Number);
|
|
||||||
const [endTimeValue, setEndTimeValue] = useState(Number);
|
|
||||||
const [timeType, setTimeType] = useState(TimeType.DAY);
|
const [timeType, setTimeType] = useState(TimeType.DAY);
|
||||||
const getTimedata = (data: any) => {
|
|
||||||
setStartTimeValue(moment(data[0]).valueOf());
|
|
||||||
setEndTimeValue(moment(data[1]).valueOf());
|
|
||||||
};
|
|
||||||
|
|
||||||
// const [date, setDate] = useState(getData);
|
// const [date, setDate] = useState(getData);
|
||||||
const [userDate, setUserDate] = useState(getData(getTodayUserData));
|
const [userDate, setUserDate] = useState(getData(getTodayUserData));
|
||||||
|
|
@ -60,18 +54,16 @@ const CoreData: React.FC = () => {
|
||||||
{
|
{
|
||||||
title: '日期',
|
title: '日期',
|
||||||
dataIndex: 'time',
|
dataIndex: 'time',
|
||||||
|
hideInSearch: true,
|
||||||
width: '10%',
|
width: '10%',
|
||||||
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
|
},
|
||||||
return (
|
{
|
||||||
<DatePicker.RangePicker
|
title: '时间',
|
||||||
style={{ width: '300px' }}
|
dataIndex: 'select_time',
|
||||||
format={'YYYY-MM-DD'}
|
valueType: 'dateRange',
|
||||||
onChange={(vaw: any) => {
|
width: '20%',
|
||||||
getTimedata(vaw);
|
hideInTable: true,
|
||||||
}}
|
ellipsis: true,
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '活跃用户数',
|
title: '活跃用户数',
|
||||||
|
|
@ -139,8 +131,10 @@ const CoreData: React.FC = () => {
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
actionRef={tableRef}
|
actionRef={tableRef}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
params.start_time = startTimeValue;
|
if ((params.select_time ?? '') !== '') {
|
||||||
params.end_time = endTimeValue;
|
params.start_time = moment(params.select_time[0]).valueOf() / 1000;
|
||||||
|
params.end_time = moment(params.select_time[1]).valueOf() / 1000;
|
||||||
|
}
|
||||||
return getCoreData(params);
|
return getCoreData(params);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,7 @@ import moment from 'moment';
|
||||||
import TimeType from '@/constants/enum/timeType';
|
import TimeType from '@/constants/enum/timeType';
|
||||||
const Address: React.FC = () => {
|
const Address: React.FC = () => {
|
||||||
const tableRef = useRef<ActionType>();
|
const tableRef = useRef<ActionType>();
|
||||||
const [startTimeValue, setStartTimeValue] = useState(Number);
|
|
||||||
const [endTimeValue, setEndTimeValue] = useState(Number);
|
|
||||||
const [timeType, setTimeType] = useState(TimeType.DAY);
|
const [timeType, setTimeType] = useState(TimeType.DAY);
|
||||||
const getTimedata = (data: any) => {
|
|
||||||
setStartTimeValue(moment(data[0]).valueOf());
|
|
||||||
setEndTimeValue(moment(data[1]).valueOf());
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns: ProColumns<any>[] = [
|
const columns: ProColumns<any>[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -55,17 +49,14 @@ const Address: React.FC = () => {
|
||||||
dataIndex: 'timeData',
|
dataIndex: 'timeData',
|
||||||
hideInTable: true,
|
hideInTable: true,
|
||||||
width: '20%',
|
width: '20%',
|
||||||
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
|
},
|
||||||
return (
|
{
|
||||||
<DatePicker.RangePicker
|
title: '时间',
|
||||||
style={{ width: '300px' }}
|
dataIndex: 'select_time',
|
||||||
format={'YYYY-MM-DD'}
|
valueType: 'dateRange',
|
||||||
onChange={(vaw: any) => {
|
width: '20%',
|
||||||
getTimedata(vaw);
|
hideInTable: true,
|
||||||
}}
|
ellipsis: true,
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '付费次数',
|
title: '付费次数',
|
||||||
|
|
@ -112,12 +103,10 @@ const Address: React.FC = () => {
|
||||||
actionRef={tableRef}
|
actionRef={tableRef}
|
||||||
// search={false}
|
// search={false}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
console.log(params);
|
if ((params.select_time ?? '') !== '') {
|
||||||
|
params.start_time = moment(params.select_time[0]).valueOf() / 1000;
|
||||||
params.start_time = startTimeValue;
|
params.end_time = moment(params.select_time[1]).valueOf() / 1000;
|
||||||
params.end_time = endTimeValue;
|
}
|
||||||
console.log(params.data.timeData);
|
|
||||||
console.log(params.time_type);
|
|
||||||
return getRententionData(params);
|
return getRententionData(params);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import Modal, { ModalProps } from '@/components/Modal';
|
||||||
import { fetchTableData } from '@/utils/table';
|
import { fetchTableData } from '@/utils/table';
|
||||||
import Table, { ProColumns, ActionType } from '@/components/Table';
|
import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||||
import TimeText from '@/components/Typography/TimeText';
|
import TimeText from '@/components/Typography/TimeText';
|
||||||
import { getChannelData } from '@/services/DataBorad/retentionAnalysis';
|
import { getChannelData } from '@/services/dataBorad/retentionAnalysis';
|
||||||
|
|
||||||
interface TableModalPropsType extends ModalProps {
|
interface TableModalPropsType extends ModalProps {
|
||||||
modalData: any;
|
modalData: any;
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,12 @@ import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||||
import { DatePicker } from 'antd';
|
import { DatePicker } from 'antd';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { fetchTableData } from '@/utils/table';
|
import { fetchTableData } from '@/utils/table';
|
||||||
import { getRententionData } from '@/services/DataBorad/retentionAnalysis';
|
import { getRententionData } from '@/services/dataBorad/retentionAnalysis';
|
||||||
import TableModal from '@/pages/DataBoard/RetentionAnalysis/List/components/TableModal';
|
import TableModal from '@/pages/DataBoard/RetentionAnalysis/List/components/TableModal';
|
||||||
|
|
||||||
const RetentionAnalysis = () => {
|
const RetentionAnalysis = () => {
|
||||||
const [startTimeValue, setStartTimeValue] = useState(Number);
|
|
||||||
const [endTimeValue, setEndTimeValue] = useState(Number);
|
|
||||||
|
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [requestData, setRequestData] = useState();
|
const [requestData, setRequestData] = useState();
|
||||||
const getTimedata = (data) => {
|
|
||||||
setStartTimeValue(moment(data[0]).valueOf());
|
|
||||||
setEndTimeValue(moment(data[1]).valueOf());
|
|
||||||
console.log(startTimeValue, endTimeValue);
|
|
||||||
console.log(visible);
|
|
||||||
};
|
|
||||||
const sendData = (row: any) => {
|
const sendData = (row: any) => {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setRequestData(row.time);
|
setRequestData(row.time);
|
||||||
|
|
@ -28,17 +19,14 @@ const RetentionAnalysis = () => {
|
||||||
{
|
{
|
||||||
title: '时间',
|
title: '时间',
|
||||||
dataIndex: 'time',
|
dataIndex: 'time',
|
||||||
// width: '20%',
|
},
|
||||||
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
|
{
|
||||||
return (
|
title: '时间',
|
||||||
<DatePicker.RangePicker
|
dataIndex: 'select_time',
|
||||||
value={requestData}
|
valueType: 'dateRange',
|
||||||
style={{ width: '200px' }}
|
width: '20%',
|
||||||
format={'YYYY-MM-DD'}
|
hideInTable: true,
|
||||||
onChange={getTimedata}
|
ellipsis: true,
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '登录用户数',
|
title: '登录用户数',
|
||||||
|
|
@ -99,8 +87,10 @@ const RetentionAnalysis = () => {
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
actionRef={tableRef}
|
actionRef={tableRef}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
params.start_time = startTimeValue;
|
if ((params.select_time ?? '') !== '') {
|
||||||
params.end_time = endTimeValue;
|
params.start_time = moment(params.select_time[0]).valueOf() / 1000;
|
||||||
|
params.end_time = moment(params.select_time[1]).valueOf() / 1000;
|
||||||
|
}
|
||||||
return await fetchTableData(getRententionData, params);
|
return await fetchTableData(getRententionData, params);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const AddNftContractModal = ({ onOk, onCancel, ...rest }: AddNftContractModalPro
|
||||||
/>
|
/>
|
||||||
<SchemaField.Number
|
<SchemaField.Number
|
||||||
name="description"
|
name="description"
|
||||||
title="gas费"
|
title=""
|
||||||
required
|
required
|
||||||
x-decorator="FormItem"
|
x-decorator="FormItem"
|
||||||
x-component="NumberPicker"
|
x-component="NumberPicker"
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,6 @@ const Address: React.FC = () => {
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
actionRef={tableRef}
|
actionRef={tableRef}
|
||||||
toolBarActions={[
|
toolBarActions={[
|
||||||
{
|
|
||||||
type: 'add',
|
|
||||||
text: '添加NFT',
|
|
||||||
onConfirm: () => {
|
|
||||||
setVisible(true);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'add',
|
type: 'add',
|
||||||
text: '新建NFT合约',
|
text: '新建NFT合约',
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,14 @@ import Table, { ProColumns, ActionType } from '@/components/Table';
|
||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
// import { fetchTableData } from '@/utils/table';
|
// import { fetchTableData } from '@/utils/table';
|
||||||
|
|
||||||
// import AddNftModal from '@/pages/Nft/NftToken/List/components/AddNftModel';
|
import AddNftModal from '@/pages/Nft/NftToken/List/components/AddNftModel';
|
||||||
import PaySelectModal from '@/widget/Work/PaySelectModal';
|
import PaySelectModal from '@/widget/Work/PaySelectModal';
|
||||||
|
|
||||||
const Address: React.FC = () => {
|
const Address: React.FC = () => {
|
||||||
const tableRef = useRef<ActionType>();
|
const tableRef = useRef<ActionType>();
|
||||||
const [NftModal, setNftModal] = useState(false);
|
const [NftModal, setNftModal] = useState(false);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
const [payVisible, setPayVisible] = useState(false);
|
||||||
|
|
||||||
const columns: ProColumns<any>[] = [
|
const columns: ProColumns<any>[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -58,7 +59,7 @@ const Address: React.FC = () => {
|
||||||
// // return fetchTableData(, params);
|
// // return fetchTableData(, params);
|
||||||
// }}
|
// }}
|
||||||
/>
|
/>
|
||||||
{/* <AddNftModal
|
<AddNftModal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onCancel={function () {
|
onCancel={function () {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
@ -74,9 +75,9 @@ const Address: React.FC = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/> */}
|
/>
|
||||||
<PaySelectModal
|
<PaySelectModal
|
||||||
visible={visible}
|
visible={payVisible}
|
||||||
onCancel={function () {
|
onCancel={function () {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ export async function initWeb3() {
|
||||||
const accounts = await provider.request({
|
const accounts = await provider.request({
|
||||||
method: 'eth_requestAccounts',
|
method: 'eth_requestAccounts',
|
||||||
});
|
});
|
||||||
//如果用户同意了登录请求,你就可以拿到用户的账号
|
|
||||||
web3.eth.defaultAccount = accounts[0];
|
web3.eth.defaultAccount = accounts[0];
|
||||||
return true;
|
return true;
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
|
|
|
||||||
|
|
@ -49,18 +49,15 @@ const PaySelectModal = ({ onOk, onCancel, ...rest }: PaySelectModalPropsType) =>
|
||||||
{ label: '小狐狸钱包支付', value: 2 },
|
{ label: '小狐狸钱包支付', value: 2 },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
<SchemaField.String
|
||||||
{send == true && (
|
name="key"
|
||||||
<SchemaField.String
|
title="秘钥"
|
||||||
name="key"
|
x-decorator="FormItem"
|
||||||
title="秘钥"
|
x-component="Input"
|
||||||
x-decorator="FormItem"
|
x-component-props={{
|
||||||
x-component="Input"
|
placeholder: '请输入秘钥,若使用小狐狸支付则不需要输入',
|
||||||
x-component-props={{
|
}}
|
||||||
placeholder: '请输入秘钥,若使用小狐狸支付则不需要输入',
|
/>
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</SchemaField>
|
</SchemaField>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue