Browse Source

添加视频上传到首页

liting2017 6 years ago
parent
commit
0e313b6460

+ 4 - 1
js/component/administration/video/videoDetails.jsx

@@ -8,7 +8,7 @@ import {
 	Button,
 	Form,
 } from 'antd';
-import {getVideoStatus,splitUrl,getVideoType} from '@/tools';
+import {getVideoStatus,splitUrl,getVideoType,getVideoPosition} from '@/tools';
 const NewDetail = Form.create()(React.createClass({
     getInitialState() {
         return {
@@ -175,6 +175,9 @@ const NewDetail = Form.create()(React.createClass({
 						</FormItem>
 					</div>
                     <div className="clearfix">
+                         <FormItem className="half-item" {...formItemLayout} label="发布位置">
+							<span>{getVideoPosition(theData.position)}</span>
+						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="发布人">
 							<span>{theData.owner=='1'?'管理员':theData.owner}</span>
 						</FormItem>

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

@@ -11,7 +11,7 @@ import {
 	Form,
 	Select
 } from 'antd';
-import { videoType } from '@/dataDic.js';
+import { videoType,videoPosition } from '@/dataDic.js';
 import { splitUrl,getVideoStatus} from '@/tools.js';	
 import Crop from '@/crop/cropBlock';
 
@@ -105,6 +105,7 @@ const NewDetailForm = Form.create()(React.createClass({
 						id: this.props.data.id,
 						type:values.type,
 						name: values.name,
+						position:values.position||0,
                         url: theVideoUrl.length?theVideoUrl:'',
 						summary:values.summary,
 						coverUrl:this.state.videoImg.join(','),
@@ -209,7 +210,6 @@ const NewDetailForm = Form.create()(React.createClass({
 			  loading:false,
 			};
 		  });
-		  
 	},
     render() {
         const theData = this.state.data || {};
@@ -305,14 +305,21 @@ const NewDetailForm = Form.create()(React.createClass({
 						</FormItem>
 					</div>
 					<div className="clearfix">
-						<FormItem className="half-item" {...formItemLayout} label="发布人">
-							<span>{theData.owner=='1'?'管理员':theData.owner}</span>
+						<FormItem className="half-item" {...formItemLayout} label="视频发布位置">
+							{getFieldDecorator('position', {
+								initialValue: theData.position||theData.position=='0'?String(theData.position):undefined
+							})(<Select placeholder="请选择发布位置">
+								{videoPosition.map(item=>{
+										return <Select.Option value={item.value}>{item.key}</Select.Option>
+									})}
+							</Select>)}
 						</FormItem>
+						{theData.releaseTime&&<FormItem className="half-item" {...formItemLayout} label="发布人">
+							<span>{theData.owner=='1'?'管理员':theData.owner}</span>
+						</FormItem>}
 						{theData.createTime&&<FormItem className="half-item" {...formItemLayout} label="发布状态">
 							<span>{getVideoStatus(theData.status)}</span>
 						</FormItem>}
-					</div>
-					<div className="clearfix">
 						{this.props.data.id&&<FormItem className="half-item" {...formItemLayout} label="视频状态">
 							<span>{theData.transcoding=='2'?'已转码':'正在转码'}</span>
 						</FormItem>}

+ 10 - 0
js/component/dataDic.js

@@ -2532,4 +2532,14 @@ module.exports = {
 	        key: "已删除"
 	    } 
     ],
+     //视频状态
+     videoPosition:[
+        {
+	        value: "0",
+	        key: "默认"
+	    },{
+	        value: "1",
+	        key: "首页"
+	    }
+    ],
 };

+ 15 - 2
js/component/tools.js

@@ -91,7 +91,8 @@ import {
     couponAuthStates,
     couponCome,
     videoType,
-    videoStatus
+    videoStatus,
+    videoPosition
 } from './dataDic.js';
 
 import { provinceList} from './NewDicProvinceList.js';
@@ -1659,5 +1660,17 @@ module.exports = {
             });
             return theType;
         }
-    }
+    },
+    //视频状态
+    getVideoPosition: function (e) {
+        if (e||e=='0') {
+            let theType = '';
+            videoPosition.map(function (item) {
+                if (item.value == e) {
+                    theType = item.key;
+                };
+            });
+            return theType;
+        }
+    },
 }