diff --git a/.umirc.js b/.umirc.js index 85f1038f928e8e09395f08268816b551e3e96b19..75ec0fc91214c0f490a31f8e6dd71856d8abe7d1 100644 --- a/.umirc.js +++ b/.umirc.js @@ -3,7 +3,7 @@ export default { [ 'umi-plugin-block-dev', { - layout: 'ant-design-pro', + layout: 'ant-design-pro-user', menu: { name: '主页', icon: 'home', diff --git a/UserLogin/src/components/Login/LoginItem.tsx b/UserLogin/src/components/Login/LoginItem.tsx index 185b66b538eff38e8a2413e403d49ea4ca5afef1..fd0b3d314fe5aaa1566e9df72aee2602ea846872 100644 --- a/UserLogin/src/components/Login/LoginItem.tsx +++ b/UserLogin/src/components/Login/LoginItem.tsx @@ -29,6 +29,7 @@ export interface LoginItemProps { form?: FormComponentProps['form']; customProps?: { [key: string]: any }; onChange?: (e: any) => void; + tabUtil?: any; } interface LoginItemState { @@ -107,7 +108,7 @@ class WrapFormItem extends Component { render() { const { count } = this.state; - // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props + // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props tabUtil const { onChange, customProps, @@ -119,6 +120,7 @@ class WrapFormItem extends Component { updateActive, type, form, + tabUtil, ...restProps } = this.props; if (!name) { @@ -130,10 +132,11 @@ class WrapFormItem extends Component { const { getFieldDecorator } = form; // get getFieldDecorator props const options = this.getFormItemOptions(this.props); - const otherProps = restProps || {}; + if (type === 'Captcha') { const inputProps = omit(otherProps, ['onGetCaptcha', 'countDown']); + return ( diff --git a/UserLogin/src/model.ts b/UserLogin/src/model.ts index 417380c1cd8f900446857305b7b104e847b71573..eb4e1c97a93d02104ddd201041a191a9dbbdcf26 100644 --- a/UserLogin/src/model.ts +++ b/UserLogin/src/model.ts @@ -1,7 +1,6 @@ import { routerRedux } from 'dva/router'; import { getPageQuery, setAuthority } from './utils/utils'; import { fakeAccountLogin, getFakeCaptcha } from './service'; -import { stringify } from 'qs'; import { Reducer } from 'redux'; import { EffectsCommandMap } from 'dva'; import { AnyAction } from 'redux'; @@ -23,7 +22,6 @@ export interface ModelType { effects: { login: Effect; getCaptcha: Effect; - logout: Effect; }; reducers: { changeLoginStatus: Reducer; @@ -68,28 +66,6 @@ const Model: ModelType = { *getCaptcha({ payload }, { call }) { yield call(getFakeCaptcha, payload); }, - - *logout(_, { put }) { - yield put({ - type: 'changeLoginStatus', - payload: { - status: false, - currentAuthority: 'guest', - }, - }); - const { redirect } = getPageQuery(); - // redirect - if (window.location.pathname !== '/user/login' && !redirect) { - yield put( - routerRedux.replace({ - pathname: '/user/login', - search: stringify({ - redirect: window.location.href, - }), - }), - ); - } - }, }, reducers: { diff --git a/UserLogin/src/utils/utils.ts b/UserLogin/src/utils/utils.ts index a63d0f8b89b912ca22542cccca3612c5fec47768..bca43c8c2b99385b22b8bb6f12b981e880a6a3f5 100644 --- a/UserLogin/src/utils/utils.ts +++ b/UserLogin/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { parse } from 'query-string'; +import { parse } from 'qs'; export function getPageQuery() { return parse(window.location.href.split('?')[1]); diff --git a/package.json b/package.json index 3fbbf9016f911d4d56202b379a64cf6eb0b7dc51..24240e46f4f807f909aaa267fcbc6393bda9ea7d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "dev": "cross-env PAGES_PATH='AccountCenter/src' umi dev", + "dev": "cross-env PAGES_PATH='UserLogin/src' umi dev", "lint": "npm run lint:ts && npm run lint:style && npm run lint:prettier", "lint-staged": "lint-staged", "lint-staged:ts": "tslint",