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