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