|
@@ -36,24 +36,28 @@ export default class extends Page {
|
|
|
return System.getServiceQxCat().then(result => {
|
|
|
this.setState({ qx_cat: result || {} });
|
|
|
const { form } = this.props;
|
|
|
- form.setFieldsValue(flattenObject(result, 'sentence'));
|
|
|
+ form.setFieldsValue(flattenObject(result, 'qx_cat'));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
refreshTextbook() {
|
|
|
return System.getServiceTextbook().then(result => {
|
|
|
this.setState({ textbook: result || {} });
|
|
|
+ const { form } = this.props;
|
|
|
+ form.setFieldsValue(flattenObject(result, 'textbook'));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
refreshVip() {
|
|
|
return System.getServiceVip().then(result => {
|
|
|
this.setState({ vip: result || {} });
|
|
|
+ const { form } = this.props;
|
|
|
+ form.setFieldsValue(flattenObject(result, 'vip'));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- changeMapValue(field, index, key, value) {
|
|
|
- const data = this.state[field] || {};
|
|
|
+ changeMapValue(field, second, index, key, value) {
|
|
|
+ const data = this.state[field] ? this.state[field][second] || {} : {};
|
|
|
data[index] = data[index] || {};
|
|
|
data[index][key] = value;
|
|
|
this.setState({ [field]: data });
|
|
@@ -98,78 +102,78 @@ export default class extends Page {
|
|
|
|
|
|
renderQxCat() {
|
|
|
const { getFieldDecorator, setFieldsValue, getFieldValue } = this.props.form;
|
|
|
- const image = getFieldValue('qx_cat_image') || null;
|
|
|
+ const image = getFieldValue('qx_cat.image') || null;
|
|
|
return <Form>
|
|
|
<Row>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='商品价格'>
|
|
|
- {getFieldDecorator('qx_cat[0].price', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].price', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat价格' },
|
|
|
],
|
|
|
})(
|
|
|
<InputNumber placeholder='请输入千行Cat价格' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'price', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'price', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='服务名称'>
|
|
|
- {getFieldDecorator('qx_cat[0].title', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].title', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat名称' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入千行Cat名称' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'title', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'title', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='服务简介'>
|
|
|
- {getFieldDecorator('qx_cat[0].description', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].description', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat服务简介' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入千行Cat服务简介' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'description', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'description', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='有效期说明'>
|
|
|
- {getFieldDecorator('qx_cat[0].expire_info', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].expire_info', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat有效期说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入千行Cat有效期说明' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'expire_info', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'expire_info', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='退款政策'>
|
|
|
- {getFieldDecorator('qx_cat[0].refund_policy', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].refund_policy', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat退款政策' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入千行Cat退款政策' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'refund_policy', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'refund_policy', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='版权说明'>
|
|
|
- {getFieldDecorator('qx_cat[0].copyright_notes', {
|
|
|
+ {getFieldDecorator('qx_cat.package[0].copyright_notes', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入千行Cat版权说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入千行Cat版权说明' onChange={(value) => {
|
|
|
- this.changeMapValue('qx_cat', 0, 'copyright_notes', value);
|
|
|
+ this.changeMapValue('qx_cat', 'package', 0, 'copyright_notes', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='商品图片'>
|
|
|
- {getFieldDecorator('qx_cat_image', {
|
|
|
+ {getFieldDecorator('qx_cat.image', {
|
|
|
rules: [
|
|
|
{ required: true, message: '上传图片' },
|
|
|
],
|
|
@@ -178,7 +182,7 @@ export default class extends Page {
|
|
|
listType="picture-card"
|
|
|
showUploadList={false}
|
|
|
beforeUpload={(file) => System.uploadImage(file).then((result) => {
|
|
|
- setFieldsValue({ qx_cat_image: result.url });
|
|
|
+ setFieldsValue({ 'qx_cat.image': result.url });
|
|
|
return Promise.reject();
|
|
|
})}
|
|
|
>
|
|
@@ -195,11 +199,11 @@ export default class extends Page {
|
|
|
|
|
|
renderTextbook() {
|
|
|
const { getFieldDecorator, setFieldsValue, getFieldValue } = this.props.form;
|
|
|
- const image = getFieldValue('textbook_image') || null;
|
|
|
+ const image = getFieldValue('textbook.image') || null;
|
|
|
return <Form>
|
|
|
<Row>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='商品图片'>
|
|
|
- {getFieldDecorator('textbook_image', {
|
|
|
+ {getFieldDecorator('textbook.image', {
|
|
|
rules: [
|
|
|
{ required: true, message: '上传图片' },
|
|
|
],
|
|
@@ -208,7 +212,7 @@ export default class extends Page {
|
|
|
listType="picture-card"
|
|
|
showUploadList={false}
|
|
|
beforeUpload={(file) => System.uploadImage(file).then((result) => {
|
|
|
- setFieldsValue({ textbook_image: result.url });
|
|
|
+ setFieldsValue({ 'textbook.image': result.url });
|
|
|
return Promise.reject();
|
|
|
})}
|
|
|
>
|
|
@@ -220,68 +224,68 @@ export default class extends Page {
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='商品价格'>
|
|
|
- {getFieldDecorator('textbook[0].price', {
|
|
|
+ {getFieldDecorator('textbook.package[0].price', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经价格' },
|
|
|
],
|
|
|
})(
|
|
|
<InputNumber placeholder='请输入数学机经价格' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'price', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'price', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='服务名称'>
|
|
|
- {getFieldDecorator('textbook[0].title', {
|
|
|
+ {getFieldDecorator('textbook.package[0].title', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经名称' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入数学机经名称' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'title', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'title', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='服务简介'>
|
|
|
- {getFieldDecorator('textbook[0].description', {
|
|
|
+ {getFieldDecorator('textbook.package[0].description', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经服务简介' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入数学机经服务简介' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'description', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'description', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='有效期说明'>
|
|
|
- {getFieldDecorator('textbook[0].expire_info', {
|
|
|
+ {getFieldDecorator('textbook.package[0].expire_info', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经有效期说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入数学机经有效期说明' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'expire_info', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'expire_info', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='退款政策'>
|
|
|
- {getFieldDecorator('textbook[0].refund_policy', {
|
|
|
+ {getFieldDecorator('textbook.package[0].refund_policy', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经退款政策' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入数学机经退款政策' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'refund_policy', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'refund_policy', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} label='版权说明'>
|
|
|
- {getFieldDecorator('textbook[0].copyright_notes', {
|
|
|
+ {getFieldDecorator('textbook.package[0].copyright_notes', {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入数学机经版权说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入数学机经版权说明' onChange={(value) => {
|
|
|
- this.changeMapValue('textbook', 0, 'copyright_notes', value);
|
|
|
+ this.changeMapValue('textbook', 'package', 0, 'copyright_notes', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
@@ -291,10 +295,10 @@ export default class extends Page {
|
|
|
|
|
|
renderVip() {
|
|
|
const { getFieldDecorator, setFieldsValue, getFieldValue } = this.props.form;
|
|
|
- const image = getFieldValue('vip_image') || null;
|
|
|
+ const image = getFieldValue('vip.image') || null;
|
|
|
return <Form>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='商品图片'>
|
|
|
- {getFieldDecorator('vip_image', {
|
|
|
+ {getFieldDecorator('vip.image', {
|
|
|
rules: [
|
|
|
{ required: true, message: '上传图片' },
|
|
|
],
|
|
@@ -303,7 +307,7 @@ export default class extends Page {
|
|
|
listType="picture-card"
|
|
|
showUploadList={false}
|
|
|
beforeUpload={(file) => System.uploadImage(file).then((result) => {
|
|
|
- setFieldsValue({ vip_image: result.url });
|
|
|
+ setFieldsValue({ 'vip.image': result.url });
|
|
|
return Promise.reject();
|
|
|
})}
|
|
|
>
|
|
@@ -319,68 +323,68 @@ export default class extends Page {
|
|
|
return <Col span={12}>
|
|
|
<h1>{row.label}</h1>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='商品价格'>
|
|
|
- {getFieldDecorator(`vip[${index}].price`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].price`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入价格' },
|
|
|
],
|
|
|
})(
|
|
|
<InputNumber placeholder={'输入价格'} onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'price', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'price', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='服务名称'>
|
|
|
- {getFieldDecorator(`vip[${index}].title`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].title`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入名称' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder={'输入名称'} onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'title', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'title', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='服务简介'>
|
|
|
- {getFieldDecorator(`vip[${index}].description`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].description`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入服务简介' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入服务简介' onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'description', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'description', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='有效期说明'>
|
|
|
- {getFieldDecorator(`vip[${index}].expire_info`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].expire_info`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入有效期说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入有效期说明' onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'expire_info', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'expire_info', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='退款政策'>
|
|
|
- {getFieldDecorator(`vip[${index}].refund_policy`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].refund_policy`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入退款政策' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入退款政策' onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'refund_policy', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'refund_policy', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} label='版权说明'>
|
|
|
- {getFieldDecorator(`vip[${index}].copyright_notes`, {
|
|
|
+ {getFieldDecorator(`vip.package[${index}].copyright_notes`, {
|
|
|
rules: [
|
|
|
{ required: true, message: '输入版权说明' },
|
|
|
],
|
|
|
})(
|
|
|
<Input placeholder='请输入版权说明' onChange={(value) => {
|
|
|
- this.changeMapValue('vip', index, 'copyright_notes', value);
|
|
|
+ this.changeMapValue('vip', 'package', index, 'copyright_notes', value);
|
|
|
}} style={{ width: '200px' }} />,
|
|
|
)}
|
|
|
</Form.Item>
|