diff --git a/jest.config.js b/jest.config.js index c52ac83..31f546f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,4 @@ module.exports = { testURL: 'http://localhost:8000', + experimentalDecorators: true } diff --git a/mock/post.js b/mock/post.js deleted file mode 100644 index e8e0d7c..0000000 --- a/mock/post.js +++ /dev/null @@ -1,67 +0,0 @@ -import { Mock, Constant } from './_utils' - -const { ApiPrefix } = Constant - -let postId = 0 -const database = Mock.mock({ - 'data|100': [ - { - id() { - postId += 1 - return postId + 10000 - }, - 'status|1-2': 1, - title: '@title', - author: '@last', - categories: '@word', - tags: '@word', - 'views|10-200': 1, - 'comments|10-200': 1, - visibility: () => { - return Mock.mock( - '@pick(["Public",' + '"Password protected", ' + '"Private"])' - ) - }, - date: '@dateTime', - image() { - return Mock.Random.image( - '100x100', - Mock.Random.color(), - '#757575', - 'png', - this.author.substr(0, 1) - ) - }, - }, - ], -}).data - -module.exports = { - [`GET ${ApiPrefix}/posts`](req, res) { - const { query } = req - let { pageSize, page, ...other } = query - 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)) { - return ( - String(item[key]) - .trim() - .indexOf(decodeURI(other[key]).trim()) > -1 - ) - } - return true - }) - } - } - - res.status(200).json({ - data: newData.slice((page - 1) * pageSize, page * pageSize), - total: newData.length, - }) - }, -} diff --git a/mock/route.js b/mock/route.js index b4f35ee..eec2523 100644 --- a/mock/route.js +++ b/mock/route.js @@ -17,14 +17,6 @@ const database = [ icon: 'user', route: '/user', }, - { - id: '7', - breadcrumbParentId: '1', - name: 'Posts', - zhName: '文章管理', - icon: 'shopping-cart', - route: '/post', - }, { id: '21', menuParentId: '-1', @@ -33,64 +25,14 @@ const database = [ zhName: '用户详情', route: '/user/:id', }, - { - id: '3', - breadcrumbParentId: '1', - name: 'Request', - zhName: 'Request', - icon: 'api', - route: '/request', - }, - { - id: '4', - breadcrumbParentId: '1', - name: 'UI Element', - zhName: 'UI组件', - icon: 'camera-o', - }, - { - id: '45', - breadcrumbParentId: '4', - menuParentId: '4', - name: 'Editor', - zhName: 'Editor', - icon: 'edit', - route: '/UIElement/editor', - }, { id: '5', breadcrumbParentId: '1', - name: 'Charts', - zhName: 'Charts', - icon: 'code-o', - }, - { - id: '51', - breadcrumbParentId: '5', - menuParentId: '5', name: 'ECharts', zhName: 'ECharts', icon: 'line-chart', route: '/chart/ECharts', - }, - { - id: '52', - breadcrumbParentId: '5', - menuParentId: '5', - name: 'HighCharts', - zhName: 'HighCharts', - icon: 'bar-chart', - route: '/chart/highCharts', - }, - { - id: '53', - breadcrumbParentId: '5', - menuParentId: '5', - name: 'Rechartst', - zhName: 'Rechartst', - icon: 'area-chart', - route: '/chart/Recharts', - }, + } ] module.exports = { diff --git a/package.json b/package.json index 995f1ec..a2c8627 100644 --- a/package.json +++ b/package.json @@ -10,17 +10,12 @@ "axios": "^0.18.0", "babel-core": "7.0.0-bridge.0", "classnames": "^2.2.6", - "d3-shape": "^1.2.2", - "draftjs-to-html": "^0.8.4", - "draftjs-to-markdown": "^0.5.1", "dva-model-extend": "^0.1.2", "echarts": "^4.2.0-rc.2", "echarts-for-react": "^2.0.15-beta.0", "echarts-gl": "^1.1.1", "echarts-liquidfill": "^2.0.2", "enquire-js": "^0.2.1", - "highcharts-exporting": "^0.1.7", - "highcharts-more": "^0.1.7", "json-format": "^1.0.1", "lodash": "^4.17.11", "md5": "^2.2.1", @@ -28,14 +23,9 @@ "path-to-regexp": "^2.4.0", "prop-types": "^15.6.2", "qs": "^6.5.2", - "rc-tween-one": "^2.2.17", - "react-adsense": "^0.0.6", "react-countup": "^4.0.0-alpha.6", - "react-draft-wysiwyg": "^1.12.13", "react-helmet": "^5.2.0", - "react-highcharts": "^16.0.2", "react-perfect-scrollbar": "^1.4.2", - "recharts": "^1.3.6", "store": "^2.0.12" }, "devDependencies": { @@ -58,7 +48,6 @@ "less-vars-to-js": "^1.3.0", "lint-staged": "^8.0.4", "mockjs": "^1.0.1-beta3", - "module": "^1.2.5", "prettier": "^1.15.2", "stylelint": "^9.8.0", "stylelint-config-prettier": "^4.0.0", diff --git a/src/pages/UIElement/editor/index.js b/src/pages/UIElement/editor/index.js deleted file mode 100644 index 0fffab1..0000000 --- a/src/pages/UIElement/editor/index.js +++ /dev/null @@ -1,104 +0,0 @@ -import React from 'react' -import { Editor } from 'components' -import { convertToRaw } from 'draft-js' -import { Row, Col, Card } from 'antd' -import draftToHtml from 'draftjs-to-html' -import draftToMarkdown from 'draftjs-to-markdown' - -export default class EditorPage extends React.Component { - constructor(props) { - super(props) - this.state = { - editorContent: null, - } - } - - onEditorStateChange = editorContent => { - this.setState({ - editorContent, - }) - } - - render() { - const { editorContent } = this.state - const colProps = { - lg: 12, - md: 24, - style: { - marginBottom: 32, - }, - } - const textareaStyle = { - minHeight: 496, - width: '100%', - background: '#f7f7f7', - borderColor: '#F1F1F1', - padding: '16px 8px', - } - return ( -
- - - - - - - - -