liting2017 6 years ago
parent
commit
a48c5d9f43

+ 3 - 5
js/component/administration/product/proDetails.jsx

@@ -154,15 +154,13 @@ const NewDetail = Form.create()(React.createClass({
                         <FormItem className="half-item" {...formItemLayout} label="标题">
 							<span>{theData.title}</span>
 						</FormItem>
-                        <FormItem className="half-item" {...formItemLayout} label="专栏类型">
-							<span>{getSpecialType(theData.type)}</span>
-						</FormItem>
+                       
 						<FormItem className="half-item" {...formItemLayout} label="新闻来源">
 							<span>{theData.source}</span>
 						</FormItem>
-                        {theData.type=='1'&&<FormItem className="half-item" {...formItemLayout} label="产品类型">
+                        <FormItem className="half-item" {...formItemLayout} label="产品类型">
 							<span>{getProductType(theData.type)}</span>
-						</FormItem>}
+						</FormItem>
 					</div>
                     <div>
                     	<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="来源链接">

+ 16 - 106
js/component/administration/product/proForm.jsx

@@ -1,82 +1,19 @@
 import React from 'react';
 import $ from 'jquery/src/ajax';
 import {
-	Icon,
-	Modal,
 	message,
 	Spin,
-	Upload,
 	Input,
 	Button,
 	Radio,
 	Form,
-	Checkbox,
-	Cascader,
-	Row,
 	Select,
-    Col
 } from 'antd';
-import {specialType,productType} from '@/dataDic.js';
-import {  splitUrl} from '@/tools.js';
-import {provinceSelect } from '@/NewDicProvinceList';
+import {productType} from '@/dataDic.js';
 import Editors from '@/richTextEditors';
 import Crop from '@/crop/cropBlock';
+import KeyWordTagGroup from '@/crop/keyword';
 
-
-const PicturesWall = React.createClass({
-	getInitialState() {
-		return {
-			previewVisible: false,
-			previewImage: '',
-			fileList: [],
-			tags: []
-		};
-	},
-	handleCancel() {
-		this.setState({ previewVisible: false });
-	},
-	handlePreview(file) {
-		this.setState({
-			previewImage: file.url || file.thumbUrl,
-			previewVisible: true
-		});
-	},
-	handleChange(info) {
-		let fileList = info.fileList;
-		this.setState({ fileList });
-		this.props.fileList(fileList);
-	},
-	componentWillReceiveProps(nextProps) {
-		this.state.fileList = nextProps.pictureUrl;
-	},
-	render() {
-		const { previewVisible, previewImage, fileList } = this.state;
-		const uploadButton = (
-			<div>
-				<Icon type="plus" />
-				<div className="ant-upload-text">点击上传</div>
-			</div>
-		);
-		return (
-			<div className="clearfix">
-				<Upload
-					action={globalConfig.context + '/api/user/demand/uploadPicture'}
-					data={{ sign: 'demand_picture'}}
-					listType="picture-card"
-					fileList={fileList}
-					onPreview={this.handlePreview}
-					onChange={this.handleChange}
-				>
-					{fileList.length >= 2 ? null : uploadButton}
-				</Upload>
-				<Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
-					<img alt="example" style={{ width: '100%' }} src={previewImage} />
-				</Modal>
-			</div>
-		);
-	}
-});
- 
 const NewDetailForm = Form.create()(React.createClass({
     getInitialState() {
         return {
@@ -115,6 +52,7 @@ const NewDetailForm = Form.create()(React.createClass({
 					type:thisData.type,
 					id:thisData.id,
 					data: thisData,
+					tags:thisData.keywords||[],
 					auditStatus:thisData.auditStatus,
 					edit:thisData.content,
                     pictureUrl: thisData.coverUrl ? thisData.coverUrl.split(',') : []
@@ -148,7 +86,6 @@ const NewDetailForm = Form.create()(React.createClass({
                     url: this.props.data.id ? globalConfig.context + '/api/admin/news/updateNews' : globalConfig.context + '/api/admin/news/apply',
                     data: {
 						id: this.props.data.id,
-						type:this.state.type,
 						title: values.title,
                         author: values.author,
                         titleImg: this.state.pictureUrl.join(','),
@@ -158,6 +95,8 @@ const NewDetailForm = Form.create()(React.createClass({
 						sourceUrl:values.sourceUrl,
 						keyword:values.keyword,
 						auditStatus:index,
+						keyword: this.state.tags ? this.state.tags.join(",") : '',
+						keywords: this.state.tags,
                         summary: values.summary,
                     }
                 }).done(function (data) {
@@ -187,7 +126,7 @@ const NewDetailForm = Form.create()(React.createClass({
         } else {
 			this.state.visible=true;
 			this.state.data = {};
-			this.state.type=undefined;
+			this.state.tags=[];
 			this.state.edit='<p><br></p>';
 			this.state.pictureUrl = [];
         };
@@ -201,7 +140,7 @@ const NewDetailForm = Form.create()(React.createClass({
             } else {
 				this.state.visible=true;
 				this.state.data = {};
-				this.state.type=undefined;
+				this.state.tags=[];
 				this.state.edit='<p><br></p>';
 				this.state.pictureUrl = [];
 				this.state.theData={};
@@ -228,22 +167,7 @@ const NewDetailForm = Form.create()(React.createClass({
 								initialValue: theData.title
 							})(<Input placeholder="请输入您的专栏标题" />)}
 						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="专栏类型">
-							{getFieldDecorator('type', {
-								rules: [ { required: true, message: '此项为必填项!' } ],
-							})(
-								<Select placeholder="专栏类型" onChange={(e)=>{this.setState({type:e})}} value={this.state.type}>
-								{
-									specialType.map(item=>{
-										return <Select.Option value={item.value}>{item.key}</Select.Option>
-									})
-								}
-                    			</Select>
-							)}
-						</FormItem>
-					</div>
-					<div className="clearfix">
-						{this.state.type=='1'?<FormItem className="half-item" {...formItemLayout} label="产品类型">
+						<FormItem className="half-item" {...formItemLayout} label="产品类型">
 							{getFieldDecorator('productType', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
 								initialValue: theData.productType!=undefined?String(theData.type):theData.type
@@ -256,7 +180,7 @@ const NewDetailForm = Form.create()(React.createClass({
 								}
                     			</Select>
 							)}
-						</FormItem>:''}
+						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="专栏来源">
 							{getFieldDecorator('source', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
@@ -268,10 +192,15 @@ const NewDetailForm = Form.create()(React.createClass({
 								initialValue: theData.sourceUrl
 							})(<Input placeholder="请输入来源链接" />)}
 						</FormItem>
-						<FormItem  className="half-item" {...formItemLayout} label="关键字">
+					</div>
+					<div className="clearfix">
+						<FormItem  labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
 							{getFieldDecorator('keyword', {
 								initialValue: theData.keyword
-							})(<Input placeholder="请输入关键字" />)}
+							})(<KeyWordTagGroup
+								keyWordArr={this.state.tags}
+								tagsArr={(e)=>{this.setState({tags:e})}}
+								/>)}
 						</FormItem>
 					</div>
 					<div className="clearfix">
@@ -330,25 +259,6 @@ const NewDetailForm = Form.create()(React.createClass({
 							)}
 						</FormItem>
 					</div>
-					{/* <div className="clearfix">
-						<FormItem className="full-item" 
-							labelCol={{ span: 3 }}
-							wrapperCol={{ span: 18 }} label="发布位置">
-							{getFieldDecorator('publishPages', {
-								rules: [ { required: false } ],
-								initialValue: this.state.publishPages
-							})(
-								<Checkbox.Group>
-									<Row>
-										<Col span={6}><Checkbox value="web_index" disabled>网站新闻首页</Checkbox></Col>
-										<Col span={6}><Checkbox value="web_tech_service_index">网站申请首页</Checkbox></Col>
-										<Col span={6}><Checkbox value="app_policy_index" disabled>app新闻首页</Checkbox></Col>
-										<Col span={6}><Checkbox value="app_tech_service_index">APP科技服务首页</Checkbox></Col>
-									</Row>
-								</Checkbox.Group>
-							)}
-						</FormItem>
-					</div> */}
 					<div className="clearfix">
 						<FormItem wrapperCol={{ span: 12, offset: 3 }}>
 						    <Button className="set-submit" type="primary" htmlType="submit">

+ 3 - 17
js/component/administration/product/proList.jsx

@@ -5,8 +5,8 @@ import moment from 'moment';
 import '@/account/demand/techDemand.less';
 import NewDesc from '@/administration/product/proDesc';
 import '@/administration/news/news.less';
-import {releaseStateList,specialType,productType } from '@/dataDic.js';
-import {getReleaseStateList,getSpecialType,getProductType } from '@/tools.js';
+import {releaseStateList,productType } from '@/dataDic.js';
+import {getReleaseStateList,getProductType } from '@/tools.js';
 
 const DemandList = React.createClass({
     loadData(pageNo) {
@@ -92,12 +92,7 @@ const DemandList = React.createClass({
                     title: '专栏名称',
                     dataIndex: 'title',
                     key: 'title',
-                },  {
-                    title: '专栏类型',
-                    dataIndex: 'author',
-                    key: 'author',
-                    render:text=>{return getSpecialType(text)}
-                },
+                }, 
                 {
                     title: '产品类型',
                     dataIndex: 'author1',
@@ -317,15 +312,6 @@ const DemandList = React.createClass({
                             })
                         }
                     </Select>
-                    <Select placeholder="产品专栏" style={{ width: 120 }}
-                        value={this.state.typeSearch}
-                        onChange={(e) => { this.setState({ typeSearch: e }) }}>
-                         {
-                            specialType.map(item=>{
-                                return <Select.Option value={item.value}  >{item.key}</Select.Option>
-                            })
-                        }
-                    </Select>
                     <Select placeholder="产品类型" style={{ width: 120 }}
                         value={this.state.typeSearch}
                         onChange={(e) => { this.setState({ typeSearch: e }) }}>

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

@@ -41,7 +41,7 @@ const NewDetail = Form.create()(React.createClass({
                     };
                     thisData = {};
                 };
-                let videoUrl =thisData.url ? splitUrl(thisData.url, ',', 'http://118.190.205.7:8000' ) : [];
+                let videoUrl =thisData.url ? splitUrl(thisData.url, ',', globalConfig.videoServer) : [];
                     videoUrl[0].name=thisData.url.split('/').pop();
                     videoUrl[0].thumbUrl=globalConfig.avatarHost + '/upload'+thisData.coverUrl;
                 this.setState({

+ 2 - 2
js/component/administration/video/videoForm.jsx

@@ -49,8 +49,8 @@ const NewDetailForm = Form.create()(React.createClass({
                     };
                     thisData = {};
 				};
-				let fileList =thisData.url ? splitUrl(thisData.url, ',','http://118.190.205.7:8000') : [];
-					fileList[0].url=thisData.transcoding==1?'javascript:;':'http://118.190.205.7:8000'+thisData.url;
+				let fileList =thisData.url ? splitUrl(thisData.url, ',',globalConfig.videoServer) : [];
+					fileList[0].url=thisData.transcoding==1?'javascript:;':globalConfig.videoServer+thisData.url;
 					fileList[0].name=(thisData.url).split('/').pop();
 					fileList[0].thumbUrl=globalConfig.avatarHost + '/upload'+thisData.coverUrl;
                 this.setState({

+ 1 - 1
js/component/administration/video/videoList.jsx

@@ -39,7 +39,7 @@ const PolicyList = React.createClass({
                             key: i,
                             id: thisdata.id,
                             name: thisdata.name,
-                            url:'http://118.190.205.7:8000'+thisdata.url,
+                            url:globalConfig.videoServer+thisdata.url,
                             type: thisdata.type,
                             owner: thisdata.owner, //审核状态
                             status:thisdata.status,

+ 74 - 0
js/component/crop/keyword.jsx

@@ -0,0 +1,74 @@
+
+import React from 'react';
+import {Tag,Input,Button,Tooltip} from 'antd';
+const KeyWordTagGroup = React.createClass({
+    getInitialState() {
+        return {
+            tags: [],
+            inputVisible: false,
+            inputValue: ''
+        };
+    },
+    handleClose(removedTag) {
+        const tags = this.state.tags.filter(tag => tag !== removedTag);
+        this.props.tagsArr(tags);
+        this.setState({ tags });
+    },
+    showInput() {
+        this.setState({ inputVisible: true }, () => this.input.focus());
+    },
+    handleInputChange(e) {
+        this.setState({ inputValue: e.target.value });
+    },
+    handleInputConfirm() {
+        const state = this.state;
+        const inputValue = state.inputValue;
+        let tags = state.tags;
+        if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
+            tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
+        }
+        this.props.tagsArr(tags);
+        this.setState({
+            tags,
+            inputVisible: false,
+            inputValue: '',
+        });
+    },
+    componentWillMount() {
+        this.state.tags = this.props.keyWordArr;
+    },
+    componentWillReceiveProps(nextProps) {
+        if (this.props.keyWordArr != nextProps.keyWordArr) {
+            this.state.tags = nextProps.keyWordArr;
+        };
+    },
+    render() {
+        const { tags, inputVisible, inputValue } = this.state;
+        return (
+            <div className="keyWord-tips">
+                {tags.map((tag, index) => {
+                    const isLongTag = tag.length > 10;
+                    const tagElem = (
+                        <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
+                            {isLongTag ? `${tag.slice(0, 10)}...` : tag}
+                        </Tag>
+                    );
+                    return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
+                })}
+                {inputVisible && (
+                    <Input
+                        ref={input => this.input = input}
+                        type="text"
+                        style={{ width: 78 }}
+                        value={inputValue}
+                        onChange={this.handleInputChange}
+                        onBlur={this.handleInputConfirm}
+                        onPressEnter={this.handleInputConfirm}
+                    />
+                )}
+                {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
+            </div>
+        );
+    }
+});
+ export default KeyWordTagGroup;

+ 1 - 1
package.json

@@ -12,7 +12,7 @@
     "buildtest": "node bin/clean.js && webpack --progress --colors --env.deploy test",
     "buildstage": "node bin/clean.js && webpack --progress --colors --env.deploy stage",
     "pro": "node bin/clean.js && webpack --progress --colors --env.deploy prod",
-    "dev": "webpack-dev-server --port 80 --devtool eval --progress --colors --hot --content-base build --env.deploy dev --env.watch watch"
+    "dev": "webpack-dev-server --port 8088 --devtool eval --progress --colors --hot --content-base build --env.deploy dev --env.watch watch"
   },
   "repository": {
     "type": "git",

+ 1 - 1
webpack-dll.config.js

@@ -10,7 +10,7 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-	let staticHost = 'http://192.168.0.188:80';   
+	let staticHost = 'http://192.168.0.188:8088';   
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';

+ 2 - 2
webpack.config.js

@@ -121,7 +121,7 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://192.168.0.188:80';    
+    let staticHost = 'http://192.168.0.188:8088';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
@@ -157,7 +157,7 @@ module.exports = (function () {
         devServer: {
             disableHostCheck: true,
             host: '192.168.0.188',
-            port: 80,
+            port: 8088,
             allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
             headers: {
                 "Access-Control-Allow-Origin": "*"