Commit 635e3620 authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

Add compilation script

parent 518094b1
......@@ -27,4 +27,4 @@ jsconfig.json
.history
*.log
funtction/mock
\ No newline at end of file
functions/mock
\ No newline at end of file
......@@ -127,8 +127,7 @@ export function getFakeList(req, res) {
export function postFakeList(req, res) {
const { /* url = '', */ body } = req;
// const params = getUrlParams(url);
const { method, id, ...restParams } = body;
const { method, id } = body;
// const count = (params.count * 1) || 20;
let result = sourceData;
......@@ -139,13 +138,13 @@ export function postFakeList(req, res) {
case 'update':
result.forEach((item, i) => {
if (item.id === id) {
result[i] = Object.assign(item, restParams);
result[i] = Object.assign(item, body);
}
});
break;
case 'post':
result.unshift({
...restParams,
body,
id: `fake-list-${result.length}`,
createdAt: new Date().getTime(),
});
......
......@@ -31,7 +31,7 @@ export function getRule(req, res, u) {
const params = parse(url, true).query;
let dataSource = [...tableListDataSource];
let dataSource = tableListDataSource;
if (params.sorter) {
const s = params.sorter.split('_');
......@@ -48,7 +48,7 @@ export function getRule(req, res, u) {
let filterDataSource = [];
status.forEach(s => {
filterDataSource = filterDataSource.concat(
[...dataSource].filter(data => parseInt(data.status, 10) === parseInt(s[0], 10))
dataSource.filter(data => parseInt(data.status, 10) === parseInt(s[0], 10))
);
});
dataSource = filterDataSource;
......@@ -116,7 +116,8 @@ export function postRule(req, res, u, b) {
case 'update':
tableListDataSource = tableListDataSource.map(item => {
if (item.key === key) {
return { ...item, desc, name };
Object.assign(item, { desc, name });
return item;
}
return item;
});
......
......@@ -9,7 +9,7 @@
"start": "cross-env ESLINT=none roadhog dev",
"start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev",
"build": "cross-env ESLINT=none roadhog build",
"site": "npm run build && firebase deploy",
"site": "rollup -c && npm run build && firebase deploy",
"analyze": "cross-env ANALYZE=1 roadhog build",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment