Browse Source
🐛 bug: fix submit bug (#6529)
* 🐛 bug: fix submit bug
* 🔥 clean: use pro-layout typing
* 🔥 clean: use pro-layout typing
* fix ts error
pull/6548/head
陈帅
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
20 additions and
55 deletions
-
config/defaultSettings.ts
-
src/components/GlobalHeader/RightContent.tsx
-
src/global.tsx
-
src/models/connect.d.ts
-
src/pages/ListTableList/components/UpdateForm.tsx
|
|
|
@ -1,55 +1,16 @@ |
|
|
|
import { MenuTheme } from 'antd/es/menu/MenuContext'; |
|
|
|
import { Settings as ProSettings } from '@ant-design/pro-layout'; |
|
|
|
|
|
|
|
export type ContentWidth = 'Fluid' | 'Fixed'; |
|
|
|
|
|
|
|
export interface DefaultSettings { |
|
|
|
/** |
|
|
|
* theme for nav menu |
|
|
|
*/ |
|
|
|
navTheme: MenuTheme; |
|
|
|
/** |
|
|
|
* primary color of ant design |
|
|
|
*/ |
|
|
|
primaryColor: string; |
|
|
|
/** |
|
|
|
* nav menu position: `sidemenu` or `topmenu` |
|
|
|
*/ |
|
|
|
layout: 'sidemenu' | 'topmenu'; |
|
|
|
/** |
|
|
|
* layout of content: `Fluid` or `Fixed`, only works when layout is topmenu |
|
|
|
*/ |
|
|
|
contentWidth: ContentWidth; |
|
|
|
/** |
|
|
|
* sticky header |
|
|
|
*/ |
|
|
|
fixedHeader: boolean; |
|
|
|
/** |
|
|
|
* auto hide header |
|
|
|
*/ |
|
|
|
autoHideHeader: boolean; |
|
|
|
/** |
|
|
|
* sticky siderbar |
|
|
|
*/ |
|
|
|
fixSiderbar: boolean; |
|
|
|
menu: { locale: boolean }; |
|
|
|
title: string; |
|
|
|
type DefaultSettings = ProSettings & { |
|
|
|
pwa: boolean; |
|
|
|
// Your custom iconfont Symbol script Url
|
|
|
|
// eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
|
|
|
|
// 注意:如果需要图标多色,Iconfont 图标项目里要进行批量去色处理
|
|
|
|
// Usage: https://github.com/ant-design/ant-design-pro/pull/3517
|
|
|
|
iconfontUrl: string; |
|
|
|
colorWeak: boolean; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
export default { |
|
|
|
const proSettings: DefaultSettings = { |
|
|
|
navTheme: 'dark', |
|
|
|
// 拂晓蓝
|
|
|
|
primaryColor: '#1890ff', |
|
|
|
layout: 'sidemenu', |
|
|
|
contentWidth: 'Fluid', |
|
|
|
fixedHeader: false, |
|
|
|
autoHideHeader: false, |
|
|
|
fixSiderbar: false, |
|
|
|
colorWeak: false, |
|
|
|
menu: { |
|
|
|
@ -58,4 +19,8 @@ export default { |
|
|
|
title: 'Ant Design Pro', |
|
|
|
pwa: false, |
|
|
|
iconfontUrl: '', |
|
|
|
} as DefaultSettings; |
|
|
|
}; |
|
|
|
|
|
|
|
export type { DefaultSettings }; |
|
|
|
|
|
|
|
export default proSettings; |
|
|
|
|
|
|
|
@ -10,7 +10,7 @@ import styles from './index.less'; |
|
|
|
|
|
|
|
export type SiderTheme = 'light' | 'dark'; |
|
|
|
export interface GlobalHeaderRightProps extends Partial<ConnectProps> { |
|
|
|
theme?: SiderTheme; |
|
|
|
theme?: SiderTheme | 'realDark'; |
|
|
|
layout: 'sidemenu' | 'topmenu'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,15 +1,16 @@ |
|
|
|
import { Button, message, notification } from 'antd'; |
|
|
|
|
|
|
|
import React from 'react'; |
|
|
|
import { formatMessage } from 'umi'; |
|
|
|
import { useIntl } from 'umi'; |
|
|
|
import defaultSettings from '../config/defaultSettings'; |
|
|
|
|
|
|
|
const { pwa } = defaultSettings; |
|
|
|
|
|
|
|
// if pwa is true
|
|
|
|
if (pwa) { |
|
|
|
// Notify user if offline now
|
|
|
|
window.addEventListener('sw.offline', () => { |
|
|
|
message.warning(formatMessage({ id: 'app.pwa.offline' })); |
|
|
|
message.warning(useIntl().formatMessage({ id: 'app.pwa.offline' })); |
|
|
|
}); |
|
|
|
|
|
|
|
// Pop up a prompt on the page asking the user if they want to use the latest version
|
|
|
|
@ -47,12 +48,12 @@ if (pwa) { |
|
|
|
reloadSW(); |
|
|
|
}} |
|
|
|
> |
|
|
|
{formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })} |
|
|
|
{useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })} |
|
|
|
</Button> |
|
|
|
); |
|
|
|
notification.open({ |
|
|
|
message: formatMessage({ id: 'app.pwa.serviceworker.updated' }), |
|
|
|
description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }), |
|
|
|
message: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated' }), |
|
|
|
description: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }), |
|
|
|
btn, |
|
|
|
key, |
|
|
|
onClose: async () => {}, |
|
|
|
|
|
|
|
@ -1,10 +1,9 @@ |
|
|
|
import { MenuDataItem } from '@ant-design/pro-layout'; |
|
|
|
import { MenuDataItem, Settings as ProSettings } from '@ant-design/pro-layout'; |
|
|
|
import { GlobalModelState } from './global'; |
|
|
|
import { DefaultSettings as SettingModelState } from '../../config/defaultSettings'; |
|
|
|
import { UserModelState } from './user'; |
|
|
|
import { StateType } from './login'; |
|
|
|
|
|
|
|
export { GlobalModelState, SettingModelState, UserModelState }; |
|
|
|
export { GlobalModelState, UserModelState }; |
|
|
|
|
|
|
|
export interface Loading { |
|
|
|
global: boolean; |
|
|
|
@ -21,7 +20,7 @@ export interface Loading { |
|
|
|
export interface ConnectState { |
|
|
|
global: GlobalModelState; |
|
|
|
loading: Loading; |
|
|
|
settings: SettingModelState; |
|
|
|
settings: ProSettings; |
|
|
|
user: UserModelState; |
|
|
|
login: StateType; |
|
|
|
} |
|
|
|
|
|
|
|
@ -68,7 +68,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { |
|
|
|
if (currentStep < 2) { |
|
|
|
forward(); |
|
|
|
} else { |
|
|
|
handleUpdate(formVals); |
|
|
|
handleUpdate({ ...formVals, ...fieldsValue }); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|