Browse Source

视频优化

liting2017 6 years ago
parent
commit
a15ddc089d

+ 8 - 6
js/component/administration/video/videoDetails.jsx

@@ -41,10 +41,13 @@ const NewDetail = Form.create()(React.createClass({
                     };
                     thisData = {};
                 };
+                let videoUrl =thisData.url ? splitUrl(thisData.url, ',', 'http://118.190.205.7:8000' ) : [];
+                    videoUrl[0].name=thisData.url.split('/').pop();
+                    videoUrl[0].thumbUrl=globalConfig.avatarHost + '/upload'+thisData.coverUrl;
                 this.setState({
                     id:thisData.id,
                     data: thisData,
-                    videoUrl: thisData.url ? splitUrl(thisData.url, ',', 'http://118.190.205.7:8000' ) : [],
+                    videoUrl: videoUrl,
                     pictureUrl: thisData.coverUrl ? splitUrl(thisData.coverUrl, ',', globalConfig.avatarHost + '/upload') : []
                 });
             }.bind(this),
@@ -124,15 +127,14 @@ const NewDetail = Form.create()(React.createClass({
 							<span>{getVideoType(theData.type)}</span>
 						</FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="视频文件">
-                            <span>{theData.url?(theData.url).split('/').pop():''}</span>
-                           {/*  <div className="clearfix">
+                            <div className="clearfix">
                                 <Upload className="demandDetailShow-upload"
                                     listType="picture-card"
                                     fileList={this.state.videoUrl}                               
                                     onPreview={(file) => {
                                         this.setState({
                                             previewImage: file.url || file.thumbUrl,
-                                            previewVisible: false,
+                                            previewVisible: true,
                                         });
                                     }} >
                                 </Upload>
@@ -141,7 +143,7 @@ const NewDetail = Form.create()(React.createClass({
                                     onCancel={() => { this.setState({ previewVisible: false }) }}>
                                     <video alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} controls></video>
                                 </Modal>
-                            </div>  */}
+                            </div> 
 					    </FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="视频封面">
                             <div className="clearfix">
@@ -170,7 +172,7 @@ const NewDetail = Form.create()(React.createClass({
 					</div>
                     <div className="clearfix">
 						<FormItem className="half-item" {...formItemLayout} label="发布人">
-							<span>{theData.owner}</span>
+							<span>{theData.owner=='1'?'管理员':theData.owner}</span>
 						</FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="发布状态">
 							<span>{getVideoStatus(theData.status)}</span>

+ 36 - 6
js/component/administration/video/videoForm.jsx

@@ -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" 

+ 3 - 0
js/component/administration/video/videoList.jsx

@@ -108,6 +108,9 @@ const PolicyList = React.createClass({
                     title: '上传者',
                     dataIndex: 'owner',
                     key: 'owner',
+                    render:text=>{
+                        return text==1?'管理员':text
+                    }
                 },
                 {
                     title: '转码状态',