正在显示
5 个修改的文件
包含
9 行增加
和
99 行删除
@@ -13,11 +13,6 @@ | @@ -13,11 +13,6 @@ | ||
13 | "dependencies": { | 13 | "dependencies": { |
14 | "antd": "^3.10.9", | 14 | "antd": "^3.10.9", |
15 | "dva": "^2.4.0", | 15 | "dva": "^2.4.0", |
16 | - "hash.js": "^1.1.5", | ||
17 | - "mockjs": "*", | ||
18 | - "moment": "^2.22.2", | ||
19 | - "nzh": "^1.0.3", | ||
20 | - "qs": "^6.6.0", | ||
21 | "react": "^16.6.3", | 16 | "react": "^16.6.3", |
22 | "umi-request": "^1.0.0" | 17 | "umi-request": "^1.0.0" |
23 | }, | 18 | }, |
@@ -84,7 +84,7 @@ const getNotice = [ | @@ -84,7 +84,7 @@ const getNotice = [ | ||
84 | 84 | ||
85 | export default { | 85 | export default { |
86 | // 支持值为 Object 和 Array | 86 | // 支持值为 Object 和 Array |
87 | - 'GET /api/currentUser': { | 87 | + 'GET /api/BLOCK_NAME/currentUser': { |
88 | name: 'Serati Ma', | 88 | name: 'Serati Ma', |
89 | avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', | 89 | avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', |
90 | userid: '00000001', | 90 | userid: '00000001', |
@@ -135,88 +135,4 @@ export default { | @@ -135,88 +135,4 @@ export default { | ||
135 | address: '西湖区工专路 77 号', | 135 | address: '西湖区工专路 77 号', |
136 | phone: '0752-268888888', | 136 | phone: '0752-268888888', |
137 | }, | 137 | }, |
138 | - // GET POST 可省略 | ||
139 | - 'GET /api/users': [ | ||
140 | - { | ||
141 | - key: '1', | ||
142 | - name: 'John Brown', | ||
143 | - age: 32, | ||
144 | - address: 'New York No. 1 Lake Park', | ||
145 | - }, | ||
146 | - { | ||
147 | - key: '2', | ||
148 | - name: 'Jim Green', | ||
149 | - age: 42, | ||
150 | - address: 'London No. 1 Lake Park', | ||
151 | - }, | ||
152 | - { | ||
153 | - key: '3', | ||
154 | - name: 'Joe Black', | ||
155 | - age: 32, | ||
156 | - address: 'Sidney No. 1 Lake Park', | ||
157 | - }, | ||
158 | - ], | ||
159 | - 'POST /api/login/account': (req, res) => { | ||
160 | - const { password, userName, type } = req.body; | ||
161 | - if (password === 'ant.design' && userName === 'admin') { | ||
162 | - res.send({ | ||
163 | - status: 'ok', | ||
164 | - type, | ||
165 | - currentAuthority: 'admin', | ||
166 | - }); | ||
167 | - return; | ||
168 | - } | ||
169 | - if (password === 'ant.design' && userName === 'user') { | ||
170 | - res.send({ | ||
171 | - status: 'ok', | ||
172 | - type, | ||
173 | - currentAuthority: 'user', | ||
174 | - }); | ||
175 | - return; | ||
176 | - } | ||
177 | - res.send({ | ||
178 | - status: 'error', | ||
179 | - type, | ||
180 | - currentAuthority: 'guest', | ||
181 | - }); | ||
182 | - }, | ||
183 | - 'POST /api/register': (req, res) => { | ||
184 | - res.send({ status: 'ok', currentAuthority: 'user' }); | ||
185 | - }, | ||
186 | - 'GET /api/500': (req, res) => { | ||
187 | - res.status(500).send({ | ||
188 | - timestamp: 1513932555104, | ||
189 | - status: 500, | ||
190 | - error: 'error', | ||
191 | - message: 'error', | ||
192 | - path: '/base/category/list', | ||
193 | - }); | ||
194 | - }, | ||
195 | - 'GET /api/404': (req, res) => { | ||
196 | - res.status(404).send({ | ||
197 | - timestamp: 1513932643431, | ||
198 | - status: 404, | ||
199 | - error: 'Not Found', | ||
200 | - message: 'No message available', | ||
201 | - path: '/base/category/list/2121212', | ||
202 | - }); | ||
203 | - }, | ||
204 | - 'GET /api/403': (req, res) => { | ||
205 | - res.status(403).send({ | ||
206 | - timestamp: 1513932555104, | ||
207 | - status: 403, | ||
208 | - error: 'Unauthorized', | ||
209 | - message: 'Unauthorized', | ||
210 | - path: '/base/category/list', | ||
211 | - }); | ||
212 | - }, | ||
213 | - 'GET /api/401': (req, res) => { | ||
214 | - res.status(401).send({ | ||
215 | - timestamp: 1513932555104, | ||
216 | - status: 401, | ||
217 | - error: 'Unauthorized', | ||
218 | - message: 'Unauthorized', | ||
219 | - path: '/base/category/list', | ||
220 | - }); | ||
221 | - }, | ||
222 | }; | 138 | }; |
@@ -3,7 +3,6 @@ import { connect } from 'dva'; | @@ -3,7 +3,6 @@ import { connect } from 'dva'; | ||
3 | import Link from 'umi/link'; | 3 | import Link from 'umi/link'; |
4 | import { Card, Row, Col, Icon, Avatar, Tag, Divider, Input } from 'antd'; | 4 | import { Card, Row, Col, Icon, Avatar, Tag, Divider, Input } from 'antd'; |
5 | import styles from './Center.less'; | 5 | import styles from './Center.less'; |
6 | -// import router from 'umi/router'; | ||
7 | 6 | ||
8 | const operationTabList = [ | 7 | const operationTabList = [ |
9 | { | 8 | { |
@@ -32,9 +31,9 @@ const operationTabList = [ | @@ -32,9 +31,9 @@ const operationTabList = [ | ||
32 | }, | 31 | }, |
33 | ]; | 32 | ]; |
34 | 33 | ||
35 | -@connect(({ loading, user }) => ({ | ||
36 | - currentUser: user.currentUser, | ||
37 | - currentUserLoading: loading.effects['user/fetchCurrent'], | 34 | +@connect(({ loading, BLOCK_NAME }) => ({ |
35 | + currentUser: BLOCK_NAME.currentUser, | ||
36 | + currentUserLoading: loading.effects['BLOCK_NAME/fetchCurrent'], | ||
38 | })) | 37 | })) |
39 | class Center extends PureComponent { | 38 | class Center extends PureComponent { |
40 | static getDerivedStateFromProps(props, state) { | 39 | static getDerivedStateFromProps(props, state) { |
@@ -59,7 +58,7 @@ class Center extends PureComponent { | @@ -59,7 +58,7 @@ class Center extends PureComponent { | ||
59 | componentDidMount() { | 58 | componentDidMount() { |
60 | const { dispatch } = this.props; | 59 | const { dispatch } = this.props; |
61 | dispatch({ | 60 | dispatch({ |
62 | - type: 'user/fetchCurrent', | 61 | + type: 'BLOCK_NAME/fetchCurrent', |
63 | }); | 62 | }); |
64 | } | 63 | } |
65 | 64 |
1 | import request from 'umi-request'; | 1 | import request from 'umi-request'; |
2 | 2 | ||
3 | export async function query() { | 3 | export async function query() { |
4 | - return request('/api/users'); | 4 | + return request('/api/BLOCK_NAME/users'); |
5 | } | 5 | } |
6 | 6 | ||
7 | export async function queryCurrent() { | 7 | export async function queryCurrent() { |
8 | - return request('/api/currentUser'); | 8 | + return request('/api/BLOCK_NAME/currentUser'); |
9 | } | 9 | } |
请
注册
或
登录
后发表评论