|
@@ -1,6 +1,6 @@
|
|
|
import { connect } from 'dva/index';
|
|
|
import React, { Component } from 'react';
|
|
|
-import { Form } from 'antd';
|
|
|
+import { Form, Spin, Button } from 'antd';
|
|
|
import {
|
|
|
sldLlineRtextAddGoods,
|
|
|
failTip,
|
|
@@ -25,6 +25,8 @@ export default class Edit extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
+ initDataLoading: false, // 整体加载loading
|
|
|
+ submitLoading: false,
|
|
|
initEditorFlag: false,//加载百度编辑器
|
|
|
getEditorContentFlag: false,//获取百度编辑器内容标识
|
|
|
initEditorContent: '',//百度编辑器内容
|
|
@@ -60,6 +62,7 @@ export default class Edit extends Component {
|
|
|
get_detail = () => {
|
|
|
const { dispatch } = this.props;
|
|
|
let { operate_data, query } = this.state;
|
|
|
+ this.setState({initDataLoading: true})
|
|
|
dispatch({
|
|
|
type: 'agreement/get_agreement_detail',
|
|
|
payload: { agreementCode: query.agreementCode },
|
|
@@ -69,7 +72,7 @@ export default class Edit extends Component {
|
|
|
operate_data[i].initialValue = res.data.title;
|
|
|
}
|
|
|
}
|
|
|
- this.setState({ operate_data, initEditorContent: quillEscapeToHtml(res.data.content), initEditorFlag: true });
|
|
|
+ this.setState({ initDataLoading: false, operate_data, initEditorContent: quillEscapeToHtml(res.data.content), initEditorFlag: true });
|
|
|
},
|
|
|
});
|
|
|
};
|
|
@@ -88,6 +91,7 @@ export default class Edit extends Component {
|
|
|
const { query } = this.state;
|
|
|
values.agreementCode = query.agreementCode;
|
|
|
let dis_type = 'agreement/update_agreement';
|
|
|
+ this.setState({submitLoading: true})
|
|
|
dispatch({
|
|
|
type: dis_type,
|
|
|
payload: values,
|
|
@@ -98,6 +102,7 @@ export default class Edit extends Component {
|
|
|
} else {
|
|
|
failTip(res.msg);
|
|
|
}
|
|
|
+ this.setState({submitLoading: false})
|
|
|
},
|
|
|
});
|
|
|
}
|
|
@@ -111,53 +116,62 @@ export default class Edit extends Component {
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
- const { operate_data, initEditorFlag, getEditorContentFlag, initEditorContent } = this.state;
|
|
|
+ const { submitLoading, operate_data, initDataLoading, initEditorFlag, getEditorContentFlag, initEditorContent } = this.state;
|
|
|
|
|
|
return (
|
|
|
<div className={global.common_page_20}
|
|
|
style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-start' }}>
|
|
|
+ <Spin spinning={initDataLoading}>
|
|
|
<Scrollbars
|
|
|
- autoHeight
|
|
|
- autoHeightMin={100}
|
|
|
- autoHeightMax={document.body.clientHeight - 120}
|
|
|
- >
|
|
|
- <div className={global.flex_row_start_start}>
|
|
|
- <div className={global.flex_column_start_start} style={{ flex: 1 }}>
|
|
|
- {sldLlineRtextAddGoods(defaultSettings.primaryColor, `${sldComLanguage('基本信息')}`)}
|
|
|
- <div style={{ marginTop: 20 }} className={global.tableListFormAdd}>
|
|
|
- <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
- <Form onSubmit={() => this.handleSaveAllData()} layout="inline">
|
|
|
- <SldEditFormCom form={this.props.form} search_data={operate_data}/>
|
|
|
- {getSldEmptyH(15)}
|
|
|
- {sldLlineRtextAddGoods(defaultSettings.primaryColor, `${sldComLanguage('内容编辑')}`)}
|
|
|
- <div className={`${global.goods_sku_tab} ${global.flex_column_start_start}`} style={{
|
|
|
- marginTop: 20,
|
|
|
- width: document.body.clientWidth - (this.props.global.collapsed ? 90 : 160) - 60,
|
|
|
- }}>
|
|
|
- {initEditorFlag &&
|
|
|
- <SldUEditor id={'agreement'} getContentFlag={getEditorContentFlag}
|
|
|
- getEditorContent={this.getEditorContent} initEditorContent={initEditorContent}/>
|
|
|
- }
|
|
|
- {getSldEmptyH(30)}
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className={global.m_diy_bottom_wrap}
|
|
|
- style={{ position: 'fixed', left: this.props.global.collapsed ? 90 : 160 }}>
|
|
|
- <div onClick={() => this.props.history.goBack()} className={global.add_goods_bottom_btn}>
|
|
|
- {sldComLanguage('返回')}
|
|
|
+ autoHeight
|
|
|
+ autoHeightMin={100}
|
|
|
+ autoHeightMax={document.body.clientHeight - 120}
|
|
|
+ >
|
|
|
+ <div className={global.flex_row_start_start}>
|
|
|
+ <div className={global.flex_column_start_start} style={{ flex: 1 }}>
|
|
|
+ {sldLlineRtextAddGoods(defaultSettings.primaryColor, `${sldComLanguage('基本信息')}`)}
|
|
|
+ <div style={{ marginTop: 20 }} className={global.tableListFormAdd}>
|
|
|
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
+ <Form onSubmit={() => this.handleSaveAllData()} layout="inline">
|
|
|
+ <SldEditFormCom form={this.props.form} search_data={operate_data}/>
|
|
|
+ {getSldEmptyH(15)}
|
|
|
+ {sldLlineRtextAddGoods(defaultSettings.primaryColor, `${sldComLanguage('内容编辑')}`)}
|
|
|
+ <div className={`${global.goods_sku_tab} ${global.flex_column_start_start}`} style={{
|
|
|
+ marginTop: 20,
|
|
|
+ width: document.body.clientWidth - (this.props.global.collapsed ? 90 : 160) - 60,
|
|
|
+ }}>
|
|
|
+ {initEditorFlag &&
|
|
|
+ <SldUEditor id={'agreement'} getContentFlag={getEditorContentFlag}
|
|
|
+ getEditorContent={this.getEditorContent} initEditorContent={initEditorContent}/>
|
|
|
+ }
|
|
|
+ {getSldEmptyH(30)}
|
|
|
</div>
|
|
|
- <div onClick={() => this.handleSaveAllData()}
|
|
|
- className={`${global.add_goods_bottom_btn} ${global.add_goods_bottom_btn_sel}`}>
|
|
|
- {sldComLanguage('保存并返回')}
|
|
|
+
|
|
|
+ <div className={global.m_diy_bottom_wrap}
|
|
|
+ style={{ position: 'fixed', left: this.props.global.collapsed ? 90 : 160 }}>
|
|
|
+ <Button
|
|
|
+ onClick={() => this.props.history.goBack()}
|
|
|
+ style={{ width: '100px', borderRadius: '0', marginRight: '20px' }}
|
|
|
+ >
|
|
|
+ {sldComLanguage('返回')}
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ type='primary'
|
|
|
+ loading={submitLoading}
|
|
|
+ style={{ minWidth: '100px', borderRadius: '0' }}
|
|
|
+ onClick={() => this.handleSaveAllData()}
|
|
|
+ >
|
|
|
+ {sldComLanguage('保存并返回')}
|
|
|
+ </Button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </Form>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div style={{ height: 100, width: 6, flexShrink: 0 }}/>
|
|
|
</div>
|
|
|
- <div style={{ height: 100, width: 6, flexShrink: 0 }}/>
|
|
|
- </div>
|
|
|
- </Scrollbars>
|
|
|
+ </Scrollbars>
|
|
|
+ </Spin>
|
|
|
</div>
|
|
|
);
|
|
|
}
|