|
@@ -1,12 +1,10 @@
|
|
import React, { PureComponent } from 'react';
|
|
import React, { PureComponent } from 'react';
|
|
import pathToRegexp from 'path-to-regexp';
|
|
import pathToRegexp from 'path-to-regexp';
|
|
-import { Card, Form, Radio, Input, Button, Switch } from 'antd';
|
|
|
|
|
|
+import { Card, Form, Radio, Input, Button } from 'antd';
|
|
import { connect } from 'dva';
|
|
import { connect } from 'dva';
|
|
import { routerRedux } from 'dva/router';
|
|
import { routerRedux } from 'dva/router';
|
|
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
|
|
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
|
|
-import {
|
|
|
|
- resourceTypes, resourceQuality, boolToStatus, statusToBool,
|
|
|
|
-} from '../../../utils/utils';
|
|
|
|
|
|
+import { resourceTypes, resourceQuality } from '../../../utils/utils';
|
|
import { Hotax } from '../../../utils/config';
|
|
import { Hotax } from '../../../utils/config';
|
|
|
|
|
|
const formItemLayout = {
|
|
const formItemLayout = {
|
|
@@ -54,19 +52,18 @@ export default class VideoCreatePage extends PureComponent {
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
if (!err) {
|
|
if (!err) {
|
|
const { UIParams, Queryers } = this.props.location.state || {};
|
|
const { UIParams, Queryers } = this.props.location.state || {};
|
|
- const { status, ...params } = values;
|
|
|
|
const matchId = this.isEdit();
|
|
const matchId = this.isEdit();
|
|
if (matchId) {
|
|
if (matchId) {
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'resource/updateVideo',
|
|
type: 'resource/updateVideo',
|
|
- payload: { id: matchId, status: boolToStatus(status), ...params },
|
|
|
|
|
|
+ payload: { id: matchId, status: Hotax.STATUS_NORMAL, ...values },
|
|
states: { UIParams, Queryers },
|
|
states: { UIParams, Queryers },
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'resource/createVideo',
|
|
type: 'resource/createVideo',
|
|
- payload: { status: boolToStatus(status), ...params },
|
|
|
|
|
|
+ payload: { status: Hotax.STATUS_NORMAL, ...values },
|
|
states: { UIParams, Queryers },
|
|
states: { UIParams, Queryers },
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -76,7 +73,7 @@ export default class VideoCreatePage extends PureComponent {
|
|
const { form, submitting, location } = this.props;
|
|
const { form, submitting, location } = this.props;
|
|
const { getFieldDecorator } = form;
|
|
const { getFieldDecorator } = form;
|
|
const { state = {} } = location;
|
|
const { state = {} } = location;
|
|
- const { code, name, size, type, path, rate, quality, status, format } = state;
|
|
|
|
|
|
+ const { code, name, size, type, path, rate, quality, format } = state;
|
|
|
|
|
|
return (
|
|
return (
|
|
<PageHeaderLayout>
|
|
<PageHeaderLayout>
|
|
@@ -117,7 +114,7 @@ export default class VideoCreatePage extends PureComponent {
|
|
rules: [{ required: true, message: '资源类型不能为空' }],
|
|
rules: [{ required: true, message: '资源类型不能为空' }],
|
|
initialValue: type || Hotax.RESOURCE_VIDEO,
|
|
initialValue: type || Hotax.RESOURCE_VIDEO,
|
|
})(
|
|
})(
|
|
- <Radio.Group>
|
|
|
|
|
|
+ <Radio.Group disabled>
|
|
{
|
|
{
|
|
Object.keys(resourceTypes).map(key =>
|
|
Object.keys(resourceTypes).map(key =>
|
|
(
|
|
(
|
|
@@ -137,7 +134,7 @@ export default class VideoCreatePage extends PureComponent {
|
|
rules: [{ required: true, message: '清晰度为必选项' }],
|
|
rules: [{ required: true, message: '清晰度为必选项' }],
|
|
initialValue: quality || Hotax.QUALITY_HIGH,
|
|
initialValue: quality || Hotax.QUALITY_HIGH,
|
|
})(
|
|
})(
|
|
- <Radio.Group>
|
|
|
|
|
|
+ <Radio.Group disabled>
|
|
{
|
|
{
|
|
Object.keys(resourceQuality).map(key =>
|
|
Object.keys(resourceQuality).map(key =>
|
|
(
|
|
(
|
|
@@ -157,7 +154,7 @@ export default class VideoCreatePage extends PureComponent {
|
|
rules: [{ required: true, message: '视频格式不能为空' }],
|
|
rules: [{ required: true, message: '视频格式不能为空' }],
|
|
initialValue: format || 'm3u8',
|
|
initialValue: format || 'm3u8',
|
|
})(
|
|
})(
|
|
- <Input placeholder="请填写" />
|
|
|
|
|
|
+ <Input disabled placeholder="请填写" />
|
|
)}
|
|
)}
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item label="视频码流" {...formItemLayout}>
|
|
<Form.Item label="视频码流" {...formItemLayout}>
|
|
@@ -174,17 +171,6 @@ export default class VideoCreatePage extends PureComponent {
|
|
<Input placeholder="请填写" addonAfter="字节" />
|
|
<Input placeholder="请填写" addonAfter="字节" />
|
|
)}
|
|
)}
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="视频状态" {...formItemLayout}>
|
|
|
|
- {getFieldDecorator('status', {
|
|
|
|
- valuePropName: 'checked',
|
|
|
|
- initialValue: statusToBool(status),
|
|
|
|
- })(
|
|
|
|
- <Switch
|
|
|
|
- checkedChildren="正常"
|
|
|
|
- unCheckedChildren="删除"
|
|
|
|
- />
|
|
|
|
- )}
|
|
|
|
- </Form.Item>
|
|
|
|
<Form.Item {...submitFormLayout} style={{ marginTop: 32 }}>
|
|
<Form.Item {...submitFormLayout} style={{ marginTop: 32 }}>
|
|
<Button onClick={this.handlePageBack}>取消</Button>
|
|
<Button onClick={this.handlePageBack}>取消</Button>
|
|
<Button
|
|
<Button
|