正在显示
13 个修改的文件
包含
30 行增加
和
35 行删除
| ... | ... | @@ -35,7 +35,7 @@ const operationTabList = [ |
| 35 | 35 | currentUser: BLOCK_NAME.currentUser, |
| 36 | 36 | currentUserLoading: loading.effects['BLOCK_NAME/fetchCurrent'], |
| 37 | 37 | })) |
| 38 | -class Center extends PureComponent { | |
| 38 | +class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent { | |
| 39 | 39 | static getDerivedStateFromProps(props, state) { |
| 40 | 40 | const { match, location } = props; |
| 41 | 41 | const { tabKey } = state; |
| ... | ... | @@ -188,4 +188,4 @@ class Center extends PureComponent { |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -export default Center; | |
| 191 | +export default PAGE_NAME_UPPER_CAMEL_CASE; | ... | ... |
| ... | ... | @@ -11,7 +11,7 @@ function getCity(req, res) { |
| 11 | 11 | // 代码中会兼容本地 service mock 以及部署站点的静态数据 |
| 12 | 12 | export default { |
| 13 | 13 | // 支持值为 Object 和 Array |
| 14 | - 'GET /api/currentUser': { | |
| 14 | + 'GET /api/BLOCK_NAME/currentUser': { | |
| 15 | 15 | name: 'Serati Ma', |
| 16 | 16 | avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', |
| 17 | 17 | userid: '00000001', |
| ... | ... | @@ -61,6 +61,6 @@ export default { |
| 61 | 61 | address: '西湖区工专路 77 号', |
| 62 | 62 | phone: '0752-268888888', |
| 63 | 63 | }, |
| 64 | - 'GET /api/geographic/province': getProvince, | |
| 65 | - 'GET /api/geographic/city/:province': getCity, | |
| 64 | + 'GET /api/BLOCK_NAME/province': getProvince, | |
| 65 | + 'GET /api/BLOCK_NAME/city/:province': getCity, | |
| 66 | 66 | }; | ... | ... |
| ... | ... | @@ -10,19 +10,19 @@ const nullSlectItem = { |
| 10 | 10 | key: '', |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | -@connect(({ user, loading }) => { | |
| 14 | - const { province, city } = user; | |
| 13 | +@connect(({ BLOCK_NAME, loading }) => { | |
| 14 | + const { province, city } = BLOCK_NAME; | |
| 15 | 15 | return { |
| 16 | 16 | province, |
| 17 | 17 | city, |
| 18 | - loading: loading.models.user, | |
| 18 | + loading: loading.models.BLOCK_NAME, | |
| 19 | 19 | }; |
| 20 | 20 | }) |
| 21 | 21 | class GeographicView extends PureComponent { |
| 22 | 22 | componentDidMount = () => { |
| 23 | 23 | const { dispatch } = this.props; |
| 24 | 24 | dispatch({ |
| 25 | - type: 'user/fetchProvince', | |
| 25 | + type: 'BLOCK_NAME/fetchProvince', | |
| 26 | 26 | }); |
| 27 | 27 | }; |
| 28 | 28 | |
| ... | ... | @@ -31,7 +31,7 @@ class GeographicView extends PureComponent { |
| 31 | 31 | |
| 32 | 32 | if (!props.value && !!value && !!value.province) { |
| 33 | 33 | dispatch({ |
| 34 | - type: 'user/fetchCity', | |
| 34 | + type: 'BLOCK_NAME/fetchCity', | |
| 35 | 35 | payload: value.province.key, |
| 36 | 36 | }); |
| 37 | 37 | } |
| ... | ... | @@ -65,7 +65,7 @@ class GeographicView extends PureComponent { |
| 65 | 65 | selectProvinceItem = item => { |
| 66 | 66 | const { dispatch, onChange } = this.props; |
| 67 | 67 | dispatch({ |
| 68 | - type: 'user/fetchCity', | |
| 68 | + type: 'BLOCK_NAME/fetchCity', | |
| 69 | 69 | payload: item.key, |
| 70 | 70 | }); |
| 71 | 71 | onChange({ | ... | ... |
| ... | ... | @@ -3,9 +3,8 @@ import { formatMessage, FormattedMessage } from 'umi/locale'; |
| 3 | 3 | import { Form, Input, Upload, Select, Button } from 'antd'; |
| 4 | 4 | import { connect } from 'dva'; |
| 5 | 5 | import styles from './BaseView.less'; |
| 6 | -import GeographicView from './components/GeographicView'; | |
| 7 | -import PhoneView from './components/PhoneView'; | |
| 8 | -// import { getTimeDistance } from '@/utils/utils'; | |
| 6 | +import GeographicView from './GeographicView'; | |
| 7 | +import PhoneView from './PhoneView'; | |
| 9 | 8 | |
| 10 | 9 | const FormItem = Form.Item; |
| 11 | 10 | const { Option } = Select; |
| ... | ... | @@ -51,8 +50,8 @@ const validatorPhone = (rule, value, callback) => { |
| 51 | 50 | callback(); |
| 52 | 51 | }; |
| 53 | 52 | |
| 54 | -@connect(({ user }) => ({ | |
| 55 | - currentUser: user.currentUser, | |
| 53 | +@connect(({ BLOCK_NAME }) => ({ | |
| 54 | + currentUser: BLOCK_NAME.currentUser, | |
| 56 | 55 | })) |
| 57 | 56 | @Form.create() |
| 58 | 57 | class BaseView extends Component { | ... | ... |
| ... | ... | @@ -3,18 +3,18 @@ import { connect } from 'dva'; |
| 3 | 3 | import router from 'umi/router'; |
| 4 | 4 | import { FormattedMessage } from 'umi/locale'; |
| 5 | 5 | import { Menu } from 'antd'; |
| 6 | -import styles from './Info.less'; | |
| 7 | -import BaseView from './base'; | |
| 8 | -import SecurityView from './security'; | |
| 9 | -import BindingView from './binding'; | |
| 10 | -import NotificationView from './notification'; | |
| 6 | +import styles from './style.less'; | |
| 7 | +import BaseView from './components/base'; | |
| 8 | +import SecurityView from './components/security'; | |
| 9 | +import BindingView from './components/binding'; | |
| 10 | +import NotificationView from './components/notification'; | |
| 11 | 11 | |
| 12 | 12 | const { Item } = Menu; |
| 13 | 13 | |
| 14 | -@connect(({ user }) => ({ | |
| 15 | - currentUser: user.currentUser, | |
| 14 | +@connect(({ BLOCK_NAME }) => ({ | |
| 15 | + currentUser: BLOCK_NAME.currentUser, | |
| 16 | 16 | })) |
| 17 | -class Info extends Component { | |
| 17 | +class PAGE_NAME_UPPER_CAMEL_CASE extends Component { | |
| 18 | 18 | constructor(props) { |
| 19 | 19 | super(props); |
| 20 | 20 | const { match, location } = props; |
| ... | ... | @@ -54,7 +54,7 @@ class Info extends Component { |
| 54 | 54 | componentDidMount() { |
| 55 | 55 | const { dispatch } = this.props; |
| 56 | 56 | dispatch({ |
| 57 | - type: 'user/fetchCurrent', | |
| 57 | + type: 'BLOCK_NAME/fetchCurrent', | |
| 58 | 58 | }); |
| 59 | 59 | window.addEventListener('resize', this.resize); |
| 60 | 60 | this.resize(); |
| ... | ... | @@ -148,4 +148,4 @@ class Info extends Component { |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | -export default Info; | |
| 151 | +export default PAGE_NAME_UPPER_CAMEL_CASE; | ... | ... |
| 1 | 1 | import request from 'umi-request'; |
| 2 | 2 | |
| 3 | 3 | export async function queryCurrent() { |
| 4 | - return request('/api/currentUser'); | |
| 4 | + return request('/api/BLOCK_NAME/currentUser'); | |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | export async function queryProvince() { |
| 8 | - return request('/api/geographic/province'); | |
| 8 | + return request('/api/BLOCK_NAME/province'); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | export async function queryCity(province) { |
| 12 | - return request(`/api/geographic/city/${province}`); | |
| 12 | + return request(`/api/BLOCK_NAME/city/${province}`); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | export async function query() { |
| 16 | - return request('/api/users'); | |
| 16 | + return request('/api/BLOCK_NAME/users'); | |
| 17 | 17 | } | ... | ... |
请
注册
或
登录
后发表评论