修复 Page loading 不显示问题

This commit is contained in:
liaoxuezhi 2019-06-10 14:50:23 +08:00
parent f1c5c36fca
commit 900e570a22
4 changed files with 43 additions and 54 deletions

View File

@ -256,6 +256,7 @@ body {
&:before { &:before {
position: fixed; position: fixed;
z-index: 15;
} }
} }

View File

@ -43,7 +43,7 @@ export interface PageProps extends RendererProps {
} }
export default class Page extends React.Component<PageProps> { export default class Page extends React.Component<PageProps> {
timer: NodeJS.Timer; timer: number;
mounted: boolean; mounted: boolean;
static defaultProps = { static defaultProps = {
@ -406,13 +406,11 @@ export default class Page extends React.Component<PageProps> {
<div className={cx('Page-main')}> <div className={cx('Page-main')}>
{this.renderHeader()} {this.renderHeader()}
<div className={cx(`Page-body`, bodyClassName)}> <div className={cx(`Page-body`, bodyClassName)}>
{store.loading {store.loading ? render('spinner', {
? render('spinner', { type: 'spinner',
type: 'spinner', overlay: true,
overlay: true, size: 'lg',
size: 'lg', }) : null}
})
: null}
{store.error ? ( {store.error ? (
<Alert level="danger" showCloseButton onClose={store.clearMessage}> <Alert level="danger" showCloseButton onClose={store.clearMessage}>
@ -425,37 +423,29 @@ export default class Page extends React.Component<PageProps> {
</div> </div>
</div> </div>
{render( {render('dialog', {
'dialog', ...((store.action as Action) && ((store.action as Action).dialog as object)),
{ type: 'dialog',
...((store.action as Action) && ((store.action as Action).dialog as object)), }, {
type: 'dialog', key: 'dialog',
}, data: store.dialogData,
{ onConfirm: this.handleDialogConfirm,
key: 'dialog', onClose: this.handleDialogClose,
data: store.dialogData, show: store.dialogOpen,
onConfirm: this.handleDialogConfirm, onAction: this.handleAction,
onClose: this.handleDialogClose, })}
show: store.dialogOpen,
onAction: this.handleAction,
}
)}
{render( {render('drawer', {
'drawer', ...((store.action as Action) && ((store.action as Action).drawer as object)),
{ type: 'drawer',
...((store.action as Action) && ((store.action as Action).drawer as object)), }, {
type: 'drawer', key: 'drawer',
}, data: store.drawerData,
{ onConfirm: this.handleDrawerConfirm,
key: 'drawer', onClose: this.handleDrawerClose,
data: store.drawerData, show: store.drawerOpen,
onConfirm: this.handleDrawerConfirm, onAction: this.handleAction,
onClose: this.handleDrawerClose, })}
show: store.drawerOpen,
onAction: this.handleAction,
}
)}
</div> </div>
); );
} }

View File

@ -25,7 +25,7 @@ export interface ServiceProps extends RendererProps {
}; };
} }
export default class Service extends React.Component<ServiceProps> { export default class Service extends React.Component<ServiceProps> {
timer: NodeJS.Timeout; timer: number;
mounted: boolean; mounted: boolean;
static defaultProps: Partial<ServiceProps> = { static defaultProps: Partial<ServiceProps> = {
@ -206,19 +206,17 @@ export default class Service extends React.Component<ServiceProps> {
{this.renderBody()} {this.renderBody()}
{store.loading {store.loading ? render(
? render( 'info',
'info', {
{ type: 'spinner',
type: 'spinner', overlay: true,
overlay: true, },
}, {
{ key: 'info',
key: 'info', size: 'lg',
size: 'lg', }
} ) : null}
)
: null}
</div> </div>
); );
} }

View File

@ -124,11 +124,11 @@ export const ServiceStore = iRendererStore
return; return;
} }
markFetching(false);
if (root.isCancel(e)) { if (root.isCancel(e)) {
return; return;
} }
markFetching(false);
e.stack && console.error(e.stack); e.stack && console.error(e.stack);
root.notify('error', e.message || e); root.notify('error', e.message || e);
} }
@ -185,11 +185,11 @@ export const ServiceStore = iRendererStore
return; return;
} }
markFetching(false);
if (root.isCancel(e)) { if (root.isCancel(e)) {
return; return;
} }
markFetching(false);
e.stack && console.error(e.stack); e.stack && console.error(e.stack);
root.notify('error', e.message || e); root.notify('error', e.message || e);
} }