|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import { Button, Form, Modal, DatePicker, Input, Upload } from 'antd';
|
|
|
+import { Button, Form, Modal, DatePicker, Input, Upload, Checkbox, Switch } from 'antd';
|
|
|
import { Link } from 'react-router-dom';
|
|
|
import moment from 'moment';
|
|
|
import './index.less';
|
|
@@ -13,6 +13,7 @@ import { asyncDelConfirm, asyncSMessage } from '@src/services/AsyncTools';
|
|
|
// import { TextbookType } from '../../../../Constant';
|
|
|
import { Textbook } from '../../../stores/textbook';
|
|
|
import { System } from '../../../stores/system';
|
|
|
+import { formatDate } from '../../../../../src/services/Tools';
|
|
|
// import { Question } from '../../../stores/question';
|
|
|
// import { Slient } from '../../../stores/slient';
|
|
|
|
|
@@ -31,9 +32,15 @@ export default class extends Page {
|
|
|
this.columns = [{
|
|
|
title: '库头',
|
|
|
dataIndex: 'startDate',
|
|
|
+ render: (text) => {
|
|
|
+ return formatDate(text, 'YYYY-MM-DD');
|
|
|
+ },
|
|
|
}, {
|
|
|
title: '库尾',
|
|
|
dataIndex: 'endDate',
|
|
|
+ render: (text) => {
|
|
|
+ return text ? formatDate(text, 'YYYY-MM-DD') : '-';
|
|
|
+ },
|
|
|
}, {
|
|
|
title: '发布次数',
|
|
|
dataIndex: 'historyNumber',
|
|
@@ -43,6 +50,14 @@ export default class extends Page {
|
|
|
}}>{text}</a> : 0;
|
|
|
},
|
|
|
}, {
|
|
|
+ title: '开放问答',
|
|
|
+ dataIndex: 'questionStatus',
|
|
|
+ render: (text, record) => {
|
|
|
+ return <Checkbox checked={text > 0} onChange={(e) => {
|
|
|
+ this.changeLibrary(record.id, { questionStatus: e.target.checked ? 1 : 0 });
|
|
|
+ }} />;
|
|
|
+ },
|
|
|
+ }, {
|
|
|
title: '操作',
|
|
|
dataIndex: 'handler',
|
|
|
render: (text, record) => {
|
|
@@ -106,9 +121,16 @@ export default class extends Page {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ changeLibrary(id, data) {
|
|
|
+ data.id = id;
|
|
|
+ return Textbook.editLibrary(data).then(() => {
|
|
|
+ this.refresh();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
renderView() {
|
|
|
const { getFieldDecorator, setFieldsValue, getFieldValue } = this.props.form;
|
|
|
-
|
|
|
+ const { postSwitch = {} } = this.state;
|
|
|
const quant = getFieldValue('post.quant') || null;
|
|
|
const ir = getFieldValue('post.ir') || null;
|
|
|
const rc = getFieldValue('post.rc') || null;
|
|
@@ -134,28 +156,47 @@ export default class extends Page {
|
|
|
onSelect={(keys, rows) => this.tableSelect(keys, rows)}
|
|
|
selectedKeys={this.state.selectedKeys}
|
|
|
/>
|
|
|
- {this.state.history && <Modal visible closable title='发布历史' onCancel={() => {
|
|
|
+ {this.state.history && <Modal visible closable title='发布历史' okButtonDisabled onCancel={() => {
|
|
|
this.close(false, 'history');
|
|
|
}} onOk={() => {
|
|
|
this.close(false, 'history');
|
|
|
}}>
|
|
|
{this.state.history.map(row => {
|
|
|
- return <p>{row.content}</p>;
|
|
|
+ const list = [];
|
|
|
+ if (row.quant) {
|
|
|
+ list.push(<p>{formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss')} - {row.quantContent}</p>);
|
|
|
+ }
|
|
|
+ if (row.ir) {
|
|
|
+ list.push(<p>{formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss')} - {row.irContent}</p>);
|
|
|
+ }
|
|
|
+ if (row.rc) {
|
|
|
+ list.push(<p>{formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss')} - {row.rcContent}</p>);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
})}
|
|
|
</Modal>}
|
|
|
- {this.state.post && <Modal visible closable title='发布机经' onCancel={() => {
|
|
|
+ {this.state.post && <Modal visible closable title='发布机经:请上传机经文件,并点击发布' onCancel={() => {
|
|
|
this.close(false, 'post');
|
|
|
}} onOk={() => {
|
|
|
this.submitPost();
|
|
|
}}>
|
|
|
<Form>
|
|
|
{getFieldDecorator('post.libraryId')}
|
|
|
- <Form.Item label='请上传机经文件,并点击发布'>
|
|
|
- {getFieldDecorator('post.content')(
|
|
|
+ <Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 15 }} label='数学机经'>
|
|
|
+ 不更新,使用上一版本
|
|
|
+ <Switch checked={!postSwitch.quant} onChange={() => {
|
|
|
+ postSwitch.quant = !postSwitch.quant;
|
|
|
+ this.setState({ postSwitch });
|
|
|
+ }} />
|
|
|
+ <br />
|
|
|
+ {!postSwitch.quant && !!this.state.post.quantVersion && `版本:${this.state.post.quantVersion}`}
|
|
|
+ </Form.Item>
|
|
|
+ {postSwitch.quant && <Form.Item>
|
|
|
+ {getFieldDecorator('post.quantContent')(
|
|
|
<Input.TextArea placeholder='更新日志' />,
|
|
|
)}
|
|
|
- </Form.Item>
|
|
|
- <Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 15 }} label='数学机经'>
|
|
|
+ </Form.Item>}
|
|
|
+ {postSwitch.quant && <Form.Item>
|
|
|
{getFieldDecorator('post.quant')(
|
|
|
<Upload
|
|
|
listType="text"
|
|
@@ -171,8 +212,22 @@ export default class extends Page {
|
|
|
</div>}
|
|
|
</Upload>,
|
|
|
)}
|
|
|
- </Form.Item>
|
|
|
+ </Form.Item>}
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 15 }} label='阅读机经'>
|
|
|
+ 不更新,使用上一版本
|
|
|
+ <Switch checked={!postSwitch.rc} onChange={() => {
|
|
|
+ postSwitch.rc = !postSwitch.rc;
|
|
|
+ this.setState({ postSwitch });
|
|
|
+ }} />
|
|
|
+ <br />
|
|
|
+ {!postSwitch.rc && !!this.state.post.rcVersion && `版本:${this.state.post.rcVersion}`}
|
|
|
+ </Form.Item>
|
|
|
+ {postSwitch.rc && <Form.Item>
|
|
|
+ {getFieldDecorator('post.rcContent')(
|
|
|
+ <Input.TextArea placeholder='更新日志' />,
|
|
|
+ )}
|
|
|
+ </Form.Item>}
|
|
|
+ {postSwitch.rc && <Form.Item>
|
|
|
{getFieldDecorator('post.rc')(
|
|
|
<Upload
|
|
|
listType="text"
|
|
@@ -188,8 +243,22 @@ export default class extends Page {
|
|
|
</div>}
|
|
|
</Upload>,
|
|
|
)}
|
|
|
- </Form.Item>
|
|
|
+ </Form.Item>}
|
|
|
<Form.Item labelCol={{ span: 4 }} wrapperCol={{ span: 15 }} label='逻辑机经'>
|
|
|
+ 不更新,使用上一版本
|
|
|
+ <Switch checked={!postSwitch.ir} onChange={() => {
|
|
|
+ postSwitch.ir = !postSwitch.ir;
|
|
|
+ this.setState({ postSwitch });
|
|
|
+ }} />
|
|
|
+ <br />
|
|
|
+ {!postSwitch.ir && !!this.state.post.irVersion && `版本:${this.state.post.irVersion}`}
|
|
|
+ </Form.Item>
|
|
|
+ {postSwitch.ir && <Form.Item >
|
|
|
+ {getFieldDecorator('post.irContent')(
|
|
|
+ <Input.TextArea placeholder='更新日志' />,
|
|
|
+ )}
|
|
|
+ </Form.Item>}
|
|
|
+ {postSwitch.ir && <Form.Item>
|
|
|
{getFieldDecorator('post.ir')(
|
|
|
<Upload
|
|
|
listType="text"
|
|
@@ -205,7 +274,7 @@ export default class extends Page {
|
|
|
</div>}
|
|
|
</Upload>,
|
|
|
)}
|
|
|
- </Form.Item>
|
|
|
+ </Form.Item>}
|
|
|
</Form>
|
|
|
</Modal>}
|
|
|
</Block>;
|