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

Add compilation script

parent 518094b1
...@@ -27,4 +27,4 @@ jsconfig.json ...@@ -27,4 +27,4 @@ jsconfig.json
.history .history
*.log *.log
funtction/mock functions/mock
\ No newline at end of file \ No newline at end of file
...@@ -127,8 +127,7 @@ export function getFakeList(req, res) { ...@@ -127,8 +127,7 @@ export function getFakeList(req, res) {
export function postFakeList(req, res) { export function postFakeList(req, res) {
const { /* url = '', */ body } = req; const { /* url = '', */ body } = req;
// const params = getUrlParams(url); // const params = getUrlParams(url);
const { method, id, ...restParams } = body; const { method, id } = body;
// const count = (params.count * 1) || 20; // const count = (params.count * 1) || 20;
let result = sourceData; let result = sourceData;
...@@ -139,13 +138,13 @@ export function postFakeList(req, res) { ...@@ -139,13 +138,13 @@ export function postFakeList(req, res) {
case 'update': case 'update':
result.forEach((item, i) => { result.forEach((item, i) => {
if (item.id === id) { if (item.id === id) {
result[i] = Object.assign(item, restParams); result[i] = Object.assign(item, body);
} }
}); });
break; break;
case 'post': case 'post':
result.unshift({ result.unshift({
...restParams, body,
id: `fake-list-${result.length}`, id: `fake-list-${result.length}`,
createdAt: new Date().getTime(), createdAt: new Date().getTime(),
}); });
......
...@@ -31,7 +31,7 @@ export function getRule(req, res, u) { ...@@ -31,7 +31,7 @@ export function getRule(req, res, u) {
const params = parse(url, true).query; const params = parse(url, true).query;
let dataSource = [...tableListDataSource]; let dataSource = tableListDataSource;
if (params.sorter) { if (params.sorter) {
const s = params.sorter.split('_'); const s = params.sorter.split('_');
...@@ -48,7 +48,7 @@ export function getRule(req, res, u) { ...@@ -48,7 +48,7 @@ export function getRule(req, res, u) {
let filterDataSource = []; let filterDataSource = [];
status.forEach(s => { status.forEach(s => {
filterDataSource = filterDataSource.concat( 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; dataSource = filterDataSource;
...@@ -116,7 +116,8 @@ export function postRule(req, res, u, b) { ...@@ -116,7 +116,8 @@ export function postRule(req, res, u, b) {
case 'update': case 'update':
tableListDataSource = tableListDataSource.map(item => { tableListDataSource = tableListDataSource.map(item => {
if (item.key === key) { if (item.key === key) {
return { ...item, desc, name }; Object.assign(item, { desc, name });
return item;
} }
return item; return item;
}); });
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"start": "cross-env ESLINT=none roadhog dev", "start": "cross-env ESLINT=none roadhog dev",
"start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev", "start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev",
"build": "cross-env ESLINT=none roadhog build", "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", "analyze": "cross-env ANALYZE=1 roadhog build",
"lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style", "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