Skip to content

Commit 1ae936d

Browse files
committed
change routes, menus
1 parent 53f4664 commit 1ae936d

25 files changed

+144
-257
lines changed

package.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.1.0",
44
"description": "A Project with React/Typescript",
55
"main": "index.js",
6-
"author": "xpionner",
6+
"author": "xpioneer",
77
"license": "MIT",
88
"repository": {
99
"type": "git",
@@ -77,5 +77,16 @@
7777
"webpack-dev-server": "^3.11.0",
7878
"webpack-merge": "^5.7.2",
7979
"workbox-webpack-plugin": "^6.0.2"
80+
},
81+
"husky": {
82+
"hooks": {
83+
"pre-commit": "lint-staged"
84+
}
85+
},
86+
"lint-staged": {
87+
"src/**/*.{js,jsx,ts,tsx}": [
88+
"npm run lint:fix",
89+
"git add"
90+
]
8091
}
8192
}

src/index.html

+15-15
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
99
<link rel="manifest" href="/manifest.json">
1010
<script>
11-
var _html = document.documentElement;
12-
function getSize() {
13-
var w = _html.clientWidth;
14-
if(w <= 320) {
15-
_html.style.fontSize = '17.06666666px';
16-
} else {
17-
_html.style.fontSize = w/750*40 + 'px';
18-
}
19-
}
20-
getSize();
11+
// var _html = document.documentElement;
12+
// function getSize() {
13+
// var w = _html.clientWidth;
14+
// if(w <= 320) {
15+
// _html.style.fontSize = '17.06666666px';
16+
// } else {
17+
// _html.style.fontSize = w/750*40 + 'px';
18+
// }
19+
// }
20+
// getSize();
2121

22-
var timer = null;
23-
window.addEventListener('resize', function(e) {
24-
clearTimeout(timer);
25-
timer = setTimeout(function(){getSize()}, 300);
26-
})
22+
// var timer = null;
23+
// window.addEventListener('resize', function(e) {
24+
// clearTimeout(timer);
25+
// timer = setTimeout(function(){getSize()}, 300);
26+
// })
2727
</script>
2828
</head>
2929
<body>

src/index.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import './scss/app.scss'
55
import 'antd/dist/antd.css'
66
import 'quill/dist/quill.snow.css'
77
import serviceWorker from './serviceWorker'
8+
import { setRem } from 'utils/tools'
9+
10+
// setRem();
811

912
ReactDOM.render(
1013
<App/>,

src/pages/app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const App: React.FC = () => {
1515
<Router>
1616
<Suspense fallback={<Loading size="large"/>}>
1717
<Switch>
18-
<Route path="/home" component={(props: any) => <Home {...props}/>}/>
1918
<Route path="/login" exact component={(props: any) => <Login {...props}/>}/>
20-
<Redirect to="/home"/>
19+
<Route path="/" component={(props: any) => <Home {...props}/>}/>
20+
<Redirect to="*"/>
2121
</Switch>
2222
</Suspense>
2323
</Router>

src/pages/article/articleCreate.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class ArticleCreate extends React.Component<ICommonProps> {
2626
}
2727

2828
goDetail = (id: string) => {
29-
this.props.history.push(`/home/blog-article/${id}`)
29+
this.props.history.push(`/blog/article/detail/${id}`)
3030
}
3131

3232
componentDidMount () {

src/pages/article/articleList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ export default class ArticleList extends React.Component<ICommonProps> {
5454
}]
5555

5656
viewDetail (data: IArticle) {
57-
this.props.history.push(`/home/blog/article/detail/${data.id}`)
57+
this.props.history.push(`/blog/article/detail/${data.id}`)
5858
}
5959

6060
create = () => {
61-
this.props.history.push('/home/blog/article/create')
61+
this.props.history.push('/blog/article/create')
6262
}
6363

6464
componentDidMount () {

src/pages/articleType/articleTypeCreate.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class ArticleTypeCreate extends React.Component<ICommonProps> {
1313
}
1414

1515
goDetail = (id: string) => {
16-
this.props.history.push(`/home/blog-type/${id}`)
16+
this.props.history.push(`/blog/type/${id}`)
1717
}
1818

1919
componentDidMount () {

src/pages/articleType/articleTypeList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export default class ArticleTypeList extends React.Component<ICommonProps> {
5252
}]
5353

5454
viewDetail (data: IArticleType) {
55-
this.props.history.push(`/home/blog/type/detail/${data.id}`)
55+
this.props.history.push(`/blog/type/detail/${data.id}`)
5656
}
5757

5858
create = () => {
59-
this.props.history.push('/home/blog/type/create')
59+
this.props.history.push('/blog/type/create')
6060
}
6161

6262
componentDidMount () {

src/pages/comment/commentList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class CommentList extends React.Component<ICommonProps> {
5050
}]
5151

5252
viewDetail (data: IComment) {
53-
this.props.history.push(`/home/blog/comment/${data.id}`)
53+
this.props.history.push(`/blog/comment/${data.id}`)
5454
}
5555

5656
componentDidMount () {

src/pages/demo/demo.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22
import {inject, observer} from 'mobx-react'
33
import { Row, Col, Button, Badge, Form, Input, Select } from 'antd'
4+
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'
45

56
const FormItem = Form.Item
67
const TextArea = Input.TextArea
@@ -46,10 +47,10 @@ export default class Demo extends React.Component<ICommonProps> {
4647
<Badge count={count} showZero={true}>
4748
</Badge>
4849
<Button onClick={desc}>
49-
<Icon type="minus" />
50+
<MinusCircleOutlined />
5051
</Button>
5152
<Button onClick={add}>
52-
<Icon type="plus" />
53+
<PlusCircleOutlined />
5354
</Button>
5455
</Col>
5556
</Row>

src/pages/demo/demoMobx.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react'
22
import { observable, action, autorun, runInAction, computed } from 'mobx'
33
import {inject, observer} from 'mobx-react'
44
import { Row, Col, Button, Badge, Form, Input, Select } from 'antd'
5+
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'
56

67
const FormItem = Form.Item
78
const TextArea = Input.TextArea
@@ -60,11 +61,11 @@ export default class DemoMobx extends React.Component<ICommonProps> {
6061
<Row style={styles.padding}>
6162
<Col span={24}>
6263
<Button onClick={dec}>
63-
<Icon type="minus" />
64+
<MinusCircleOutlined />
6465
</Button>
6566
<Badge count={count} showZero={true}/>
6667
<Button onClick={add}>
67-
<Icon type="plus" />
68+
<PlusCircleOutlined />
6869
</Button>
6970
</Col>
7071
</Row>

src/pages/demo/demoRedux.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react'
22
import { Row, Col, Button, Badge, Form, Input, Select } from 'antd'
33
import { ReduxProvider, connect } from '../../plugins/react-redux'
44
import { store, countActions } from './reducer'
5+
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'
56

67
console.log(store.getState(), '---store')
78

@@ -55,11 +56,11 @@ class DemoRedux extends React.Component<any> {
5556
<Row style={styles.padding}>
5657
<Col span={24}>
5758
<Button onClick={DECREASE}>
58-
<Icon type="minus" />
59+
<MinusCircleOutlined />
5960
</Button>
6061
<Badge count={count} showZero={true}/>
6162
<Button onClick={ADD}>
62-
<Icon type="plus" />
63+
<PlusCircleOutlined />
6364
</Button>
6465
</Col>
6566
</Row>

src/pages/home/components/sider.tsx

-131
This file was deleted.

0 commit comments

Comments
 (0)