Match-id-280f4359fea9fc1d6774525ac2d7a5be36c8feee
This commit is contained in:
parent
fa4d6c695a
commit
fd72d44d45
|
@ -1,6 +1,5 @@
|
|||
import { Constant } from './_utils';
|
||||
import Mock from 'mockjs';
|
||||
import qs from 'qs';
|
||||
import { randomAvatar } from './_utils';
|
||||
import url from 'url';
|
||||
|
||||
|
@ -18,9 +17,6 @@ let usersListData = Mock.mock({
|
|||
isMale: '@boolean',
|
||||
email: '@email',
|
||||
createTime: '@datetime',
|
||||
avatar() {
|
||||
return randomAvatar();
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -111,31 +107,38 @@ export default [
|
|||
response: req => {
|
||||
const { query } = url.parse(req.url, true);
|
||||
let { pageSize, page, ...other } = query;
|
||||
if (other['address[]']) {
|
||||
other['address'] = other['address[]'];
|
||||
delete other['address[]'];
|
||||
}
|
||||
pageSize = pageSize || 10;
|
||||
page = page || 1;
|
||||
|
||||
let newData = database;
|
||||
for (let key in other) {
|
||||
if ({}.hasOwnProperty.call(other, key)) {
|
||||
newData = newData.filter(item => {
|
||||
if ({}.hasOwnProperty.call(item, key)) {
|
||||
if (key === 'address') {
|
||||
return other[key].every(iitem => item[key].indexOf(iitem) > -1);
|
||||
} else if (key === 'createTime') {
|
||||
const start = new Date(other[key][0]).getTime();
|
||||
const end = new Date(other[key][1]).getTime();
|
||||
const now = new Date(item[key]).getTime();
|
||||
|
||||
if (start && end) {
|
||||
return now >= start && now <= end;
|
||||
newData = newData.filter(item => {
|
||||
if ({}.hasOwnProperty.call(item, key)) {
|
||||
if (key === 'address') {
|
||||
for (const addr of other[key]) {
|
||||
if (item[key].indexOf(addr) === -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return String(item[key]).trim().indexOf(decodeURI(other[key]).trim()) > -1;
|
||||
return true;
|
||||
} else if (key === 'createTime') {
|
||||
const start = new Date(other[key][0]).getTime();
|
||||
const end = new Date(other[key][1]).getTime();
|
||||
const now = new Date(item[key]).getTime();
|
||||
|
||||
if (start && end) {
|
||||
return now >= start && now <= end;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return String(item[key]).trim().indexOf(decodeURI(other[key]).trim()) > -1;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
data: newData.slice((page - 1) * pageSize, page * pageSize),
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
|
|||
import { Row, Col, Card } from 'antd';
|
||||
import Color from '../../utils/theme';
|
||||
import { Page, ScrollBar } from '../../components';
|
||||
import { NumberCard, Quote, Sales, Weather, RecentSales, Comments, Completed, Browser, Cpu, User } from './components';
|
||||
import { NumberCard, Quote, Sales, Weather } from './components';
|
||||
import styles from './index.module.less';
|
||||
import store from 'store';
|
||||
import { getStore } from './model';
|
||||
|
@ -28,12 +28,6 @@ function Dashboard() {
|
|||
const sales = st.sales;
|
||||
const quote = st.quote;
|
||||
const numbers = st.numbers;
|
||||
const recentSales = st.recentSales;
|
||||
const comments = st.comments;
|
||||
const completed = st.completed;
|
||||
const browser = st.browser;
|
||||
const cpu = st.cpu;
|
||||
const user = st.user;
|
||||
|
||||
const numberCards = numbers.map((item, key) => (
|
||||
<Col key={key} lg={6} md={12}>
|
||||
|
@ -87,45 +81,6 @@ function Dashboard() {
|
|||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
{/* <Col lg={12} md={24}>
|
||||
<Card bordered={false} {...bodyStyle}>
|
||||
<RecentSales data={recentSales} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col lg={12} md={24}>
|
||||
<Card bordered={false} {...bodyStyle}>
|
||||
<ScrollBar>
|
||||
<Comments data={comments} />
|
||||
</ScrollBar>
|
||||
</Card>
|
||||
</Col> */}
|
||||
{/* <Col lg={24} md={24}>
|
||||
<Card
|
||||
bordered={false}
|
||||
bodyStyle={{
|
||||
padding: '24px 36px 24px 0',
|
||||
}}
|
||||
>
|
||||
<Completed data={completed} />
|
||||
</Card>
|
||||
</Col> */}
|
||||
{/* <Col lg={8} md={24}>
|
||||
<Card bordered={false} {...bodyStyle}>
|
||||
<Browser data={browser} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col lg={8} md={24}>
|
||||
<Card bordered={false} {...bodyStyle}>
|
||||
<ScrollBar>
|
||||
<Cpu {...cpu} />
|
||||
</ScrollBar>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col lg={8} md={24}>
|
||||
<Card bordered={false} bodyStyle={{ ...bodyStyle.bodyStyle, padding: 0 }}>
|
||||
<User {...user} avatar={avatar} username={username} />
|
||||
</Card>
|
||||
</Col> */}
|
||||
</Row>
|
||||
</Page>
|
||||
);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import React from 'react';
|
||||
import { Table, Modal, Avatar } from 'antd';
|
||||
import { Table, Modal } from 'antd';
|
||||
import { DropOption } from 'components';
|
||||
import { t } from 'utils/intl';
|
||||
import { Trans } from 'utils/intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
import styles from './List.module.less';
|
||||
|
||||
const { confirm } = Modal;
|
||||
|
@ -23,14 +22,6 @@ function List({ onDeleteItem, onEditItem, ...tableProps }) {
|
|||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: <Trans>Avatar</Trans>,
|
||||
dataIndex: 'avatar',
|
||||
key: 'avatar',
|
||||
width: '7%',
|
||||
fixed: 'left',
|
||||
render: text => <Avatar style={{ marginLeft: 8 }} src={text} />,
|
||||
},
|
||||
{
|
||||
title: <Trans>Name</Trans>,
|
||||
dataIndex: 'name',
|
||||
|
|
|
@ -163,6 +163,16 @@ export function setLocale(language) {
|
|||
|
||||
export function parseSearch(search) {
|
||||
const searchObj = {};
|
||||
search.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => (searchObj[k] = decodeURI(v)));
|
||||
search.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => {
|
||||
if (k === 'address') {
|
||||
if (searchObj[k]) {
|
||||
searchObj[k].push(decodeURI(v));
|
||||
} else {
|
||||
searchObj[k] = [decodeURI(v)];
|
||||
}
|
||||
} else {
|
||||
searchObj[k] = decodeURI(v);
|
||||
}
|
||||
});
|
||||
return searchObj;
|
||||
}
|
||||
|
|
|
@ -164,14 +164,14 @@ export function setLocale(language) {
|
|||
export function parseSearch(search) {
|
||||
const searchObj = {};
|
||||
search.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => {
|
||||
if (k === "address") {
|
||||
if (k === 'address') {
|
||||
if (searchObj[k]) {
|
||||
searchObj[k].push(decodeURI(v));
|
||||
} else {
|
||||
searchObj[k] = [decodeURI(v)]
|
||||
searchObj[k] = [decodeURI(v)];
|
||||
}
|
||||
} else {
|
||||
searchObj[k] = decodeURI(v)
|
||||
searchObj[k] = decodeURI(v);
|
||||
}
|
||||
});
|
||||
return searchObj;
|
||||
|
|
|
@ -17,8 +17,8 @@ const devServerOptions = {
|
|||
overlay: {
|
||||
errors: true,
|
||||
warnings: false,
|
||||
runtimeErrors: (error) => {
|
||||
if (error.message === "ResizeObserver loop limit exceeded") {
|
||||
runtimeErrors: error => {
|
||||
if (error.message === 'ResizeObserver loop limit exceeded') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue