From 33b1bd03c723cb1534086138072dc9163791d3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 24 May 2019 01:11:01 +0800 Subject: [PATCH] fix some warning --- .umirc.js | 2 +- UserLogin/src/components/Login/LoginItem.tsx | 7 ++++-- UserLogin/src/model.ts | 24 -------------------- UserLogin/src/utils/utils.ts | 2 +- package.json | 2 +- 5 files changed, 8 insertions(+), 29 deletions(-) diff --git a/.umirc.js b/.umirc.js index 85f1038f..75ec0fc9 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 185b66b5..fd0b3d31 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 417380c1..eb4e1c97 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 a63d0f8b..bca43c8c 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 3fbbf901..24240e46 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", -- GitLab