diff --git a/.gitignore b/.gitignore index afd3e2c6f367369cc8fc814654a3c9582564a794..e7fefb849e8764dce178a8651921d4cec77ccb57 100755 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ jsconfig.json .history *.log -funtction/mock \ No newline at end of file +functions/mock \ No newline at end of file diff --git a/mock/api.js b/mock/api.js index 494505569f9d3944b70326e7d40e86b4ac0c6d7c..a20170943cde9e9aa617fd4eb695f619278689d8 100644 --- a/mock/api.js +++ b/mock/api.js @@ -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(), }); diff --git a/mock/rule.js b/mock/rule.js index ec3deeb9ca4c9cdfdcd75e57f66dc512fa969ef7..6245b82c9fac4f658f6abc43477efaa4379ab542 100644 --- a/mock/rule.js +++ b/mock/rule.js @@ -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; }); diff --git a/package.json b/package.json index cb2fa9a8c575f0cb6c3f0a10f977df9d6c30c65e..5bd0a6c6c3a12509517cdfb149976c5f344502cb 100755 --- a/package.json +++ b/package.json @@ -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",