|
@@ -13,7 +13,6 @@ import {
|
|
|
} from 'antd';
|
|
|
import { videoType } from '@/dataDic.js';
|
|
|
import { getVideoType,getReleaseStateList,splitUrl} from '@/tools.js';
|
|
|
-import VideoComponent from '@/crop/video';
|
|
|
import Crop from '@/crop/cropBlock';
|
|
|
|
|
|
const NewDetailForm = Form.create()(React.createClass({
|
|
@@ -25,7 +24,9 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
fileList:[],
|
|
|
textFileList: [],
|
|
|
videoImg: [],
|
|
|
- vedioUrl:[]
|
|
|
+ vedioUrl:[],
|
|
|
+ previewVisible:false,
|
|
|
+ previewImage:''
|
|
|
};
|
|
|
},
|
|
|
loadData(id) {
|
|
@@ -48,10 +49,10 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
};
|
|
|
thisData = {};
|
|
|
};
|
|
|
- let proArr=[];
|
|
|
let fileList =thisData.url ? splitUrl(thisData.url, ',','http://118.190.205.7:8000') : [];
|
|
|
- fileList[0].url='javascript:;';
|
|
|
+ fileList[0].url=thisData.transcoding==1?'javascript:;':'http://118.190.205.7:8000'+thisData.url;
|
|
|
fileList[0].name=(thisData.url).split('/').pop();
|
|
|
+ fileList[0].thumbUrl=globalConfig.avatarHost + '/upload'+thisData.coverUrl;
|
|
|
this.setState({
|
|
|
id:thisData.id,
|
|
|
data: thisData,
|
|
@@ -186,6 +187,15 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
return false;
|
|
|
};
|
|
|
},
|
|
|
+ handleCancel() {
|
|
|
+ this.setState({ previewVisible: false });
|
|
|
+ },
|
|
|
+ handlePreview(file) {
|
|
|
+ this.setState({
|
|
|
+ previewImage: file.url || file.thumbUrl,
|
|
|
+ previewVisible: true
|
|
|
+ });
|
|
|
+ },
|
|
|
videoRemove(file){
|
|
|
let fileList = this.state.fileList;
|
|
|
this.setState(({ fileList }) => {
|
|
@@ -235,7 +245,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
{...formItemLayout}
|
|
|
label={<span><strong style={{color:'#f00',fontSize:12}}>* </strong>视频文件</span>}
|
|
|
>
|
|
|
- <Upload
|
|
|
+ {theData.transcoding==1?<Upload
|
|
|
action={globalConfig.context +'/api/admin/video/upload' }
|
|
|
data={{ sign:'video' }}
|
|
|
fileList={this.state.fileList}
|
|
@@ -247,7 +257,27 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
{fileList.length >= 1 ? null : <div>
|
|
|
<Button type="primary">点击上传</Button>
|
|
|
</div>}
|
|
|
- </Upload>
|
|
|
+ </Upload>:
|
|
|
+ <div className="clearfix">
|
|
|
+ <Upload
|
|
|
+ action={globalConfig.context + '/api/admin/video/upload'}
|
|
|
+ data={{ sign: 'video'}}
|
|
|
+ listType="picture-card"
|
|
|
+ fileList={this.state.fileList}
|
|
|
+ onPreview={this.handlePreview}
|
|
|
+ onChange={this.handleChange}
|
|
|
+ onRemove ={this.videoRemove}
|
|
|
+ beforeUpload={this.beforeUpload.bind(this)}
|
|
|
+ >
|
|
|
+ {this.state.fileList.length >= 1 ? null : <div>
|
|
|
+ <Icon type="plus" />
|
|
|
+ <div className="ant-upload-text">点击上传</div>
|
|
|
+ </div>}
|
|
|
+ </Upload>
|
|
|
+ <Modal maskClosable={false} visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
|
|
|
+ <video controls alt="example" style={{ width: '100%' }} src={this.state.previewImage}></video>
|
|
|
+ </Modal>
|
|
|
+ </div>}
|
|
|
</FormItem>
|
|
|
<FormItem
|
|
|
className="half-item"
|