liting2017 6 jaren geleden
bovenliggende
commit
f0f5c21b9f

+ 4 - 0
js/admin/index/content.jsx

@@ -7,6 +7,7 @@ import AchievementLibrary from '@/administration/achievement/techAchievement';
 import BusinessCategory from '@/administration/business/businessCategory';
 import BusinessLibrary from '@/administration/business/businessLibrary';
 import BusinessProject from '@/administration/business/businessProject';
+import UserLibrary from '@/administration/business/userLibrary';
 import News from '@/administration/news/newsList';
 import Policy from '@/administration/policy/policyList';
 import Order from '@/administration/order/order';
@@ -14,6 +15,7 @@ import SystemMessage from '@/administration/messagePush/systemMessage';
 import Tags from '@/administration/tags/tags';
 import AuthLibrary from '@/administration/authentication/techAuth';
 import AuthExamine from '@/administration/authentication/authExamine';
+import Banner from '@/administration/banner/banner';
 
 import {hashHistory,Route,Router} from 'react-router';
 import {Layout} from 'antd';
@@ -35,12 +37,14 @@ export default class ContentRouter extends React.Component {
             <Route path="/businessCategory" component={BusinessCategory} />
             <Route path="/businessLibrary" component={BusinessLibrary} />
             <Route path="/businessProject" component={BusinessProject} />
+            <Route path="/userLibrary" component={UserLibrary} />
             <Route path="/authLibrary" component={AuthLibrary} />
             <Route path="/authExamine" component={AuthExamine} />
             <Route path="/news" component={News} />
             <Route path="/policy" component={Policy} />
             <Route path="/order" component={Order} />
             <Route path="/systemMessage" component={SystemMessage} />
+            <Route path="/banner" component={Banner} />
         </Router>
       </Content>
     )

+ 1 - 1
js/admin/index/leftMenu.jsx

@@ -12,7 +12,7 @@ const LeftTab = React.createClass({
 			openKeys: [ 'sub1' ],
 			current: 'index',
 			switch: false,
-			rootSubmenuKeys :['sub1', 'sub2','sub3','sub4','sub5','sub6','sub7','sub8','sub9']
+			rootSubmenuKeys :['sub1', 'sub2','sub3','sub4','sub5','sub6','sub7','sub8','sub9','sub10']
 		};
 	},
 	menuClick(e) {

+ 10 - 1
js/admin/menu.jsx

@@ -37,10 +37,11 @@ module.exports = {
         ]
       },
       {
-        name: '专家顾问管理',
+        name: '客户管理',
         url: 'sub9',
         icon: 'user',
         children: [
+          { name: '用户库', url: 'userLibrary' },
           { name: '专家顾问库', url: 'authLibrary' },
           { name: '专家顾问审核', url: 'authExamine' },
         ]
@@ -71,6 +72,14 @@ module.exports = {
         ]
       },
       {
+        name: '轮播图管理',
+        url: 'sub10',
+        icon: 'picture',
+        children: [
+          { name: '轮播图库', url: 'banner' },
+        ]
+      },
+      {
         name: '系统消息管理',
         url: 'sub7',
         icon: 'notification',

+ 1 - 1
js/component/administration/authentication/techDemand.less

@@ -28,7 +28,7 @@
         }
     }
 }
-.ant-form-item-control-wrapper .ant-form-item-control  span {
+ .breakWord  span {
     word-break: break-all;  
     word-wrap: break-word; 
     white-space: pre-wrap;

+ 234 - 0
js/component/administration/banner/banner.jsx

@@ -0,0 +1,234 @@
+import { Component } from 'react';
+import { Input, Select, Spin, Table, message, Button,Icon } from 'antd';
+import BannerFrom from '@/administration/banner/bannerForm.jsx';
+import {  splitUrl} from '@/tools.js';
+
+class Banner extends Component {
+	constructor(props) {
+		super(props);
+		this.state = {
+			loading: false,
+            dataSource: [],
+            showDesc:false,
+            selectedRowKey:[],
+            selectedRowKeys:[],
+			pagination: {
+				defaultCurrent: 1,
+				defaultPageSize: 10,
+				showQuickJumper: true,
+				pageSize: 10,
+				onChange: function(page) {
+					this.loadData(page);
+					this.setState({
+						selectedRowKeys: []
+					});
+				}.bind(this),
+				showTotal: function(total) {
+					return '共' + total + '条数据';
+				}
+			},
+			columns: [
+				{
+					title: '轮播图描述',
+					dataIndex: 'text',
+					key: 'text'
+				},
+				{
+					title: '跳转地址',
+					dataIndex: 'forwardUrl',
+					key: 'forwardUrl'
+                },
+                {
+					title: '位置',
+					dataIndex: 'client',
+                    key: 'client',
+                    render:(text=>{
+                        return text==1?'APP':'网站'
+                    })
+				},
+				{
+					title: '轮播图API',
+					dataIndex: 'apiUrl',
+					key: 'apiUrl'
+				},
+			]
+		};
+	}
+	loadData(pageNo) {
+		this.setState({
+            page:pageNo,
+            loading: true,
+            selectedRowKeys:[],
+		});
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/open/api/admin/banners/list",
+            data: {
+                pageNo: pageNo || 1,
+				pageSize: this.state.pagination.pageSize,
+                apiUrl:this.state.apiSearch,
+                client:this.state.positionSearch,
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data || !data.data.list) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    for (let i = 0; i < data.data.list.length; i++) {
+                        let thisdata = data.data.list[i];
+                        theArr.push({
+                            key:i,
+                            id: thisdata.id, //品类ID
+                            text: thisdata.text, //品类序号
+                            apiUrl:thisdata.apiUrl,
+                            forwardUrl:thisdata.forwardUrl,
+                            client:thisdata.client,
+                            imgUrl: thisdata.imgUrl ? splitUrl(thisdata.imgUrl, ',', globalConfig.avatarHost + '/upload') : [],
+                        });
+                    };
+                }
+                this.state.pagination.current = data.data.pageNo;
+                this.state.pagination.total = data.data.totalCount;
+                if(data.data&&data.data.list&&!data.data.list.length){
+					this.state.pagination.current=0
+					this.state.pagination.total=0
+				}
+                this.setState({
+                    dataSource: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+	}
+	search() {
+		this.loadData();
+	}
+	reset() {
+		this.state.apiSearch = '';
+		this.state.positionSearch = undefined;
+		this.loadData();
+    }
+    closeDesc(e, s) {
+        this.state.showDesc = e;
+        if (s) {
+            this.loadData(this.state.page);
+        };
+    }
+    addClick() {
+        this.state.RowData = {};
+        this.setState({
+            showDesc: true
+        });
+    }
+    tableRowClick(record, index) {
+        this.state.RowData = record;
+        this.setState({
+            showDesc: true,
+        });
+    }
+    delectRow() {
+        this.setState({
+            loading:true
+        })
+        let deletedIds =[];
+        let rowItem = this.state.selectedRowKeys[0];
+        let data = this.state.dataSource ||[];
+        if (data.length) {
+            deletedIds.push(data[rowItem].id);
+        }
+        $.ajax({
+            method: "POST",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/open/api/admin/banners/delete",
+            data: {
+                id: deletedIds[0]
+            }
+        }).done(function (data) {
+            if (!data.error.length) {
+                message.success('删除成功!');
+                this.setState({
+                    loading: false
+                });
+                this.loadData(this.state.page);
+            } else {
+                message.warning(data.error[0].message);
+            };
+        }.bind(this));
+    }
+	componentWillMount() {
+		this.loadData();
+	}
+	render() {
+		const rowSelection = {
+			selectedRowKeys: this.state.selectedRowKeys,
+			onChange: (selectedRowKeys, selectedRows) => {
+				this.setState({
+					selectedRows: selectedRows.slice(-1),
+					selectedRowKeys: selectedRowKeys.slice(-1)
+				});
+			}
+        };
+        const hasSelect = this.state.selectedRowKeys.length;
+		return (
+			<div className="user-content">
+				<div className="content-title">
+					<div className="content-title">
+						<span>轮播图库</span>
+                        <div className="patent-addNew">
+                            <Button type="primary" onClick={this.addClick.bind(this)}>新建轮播图<Icon type="plus" /></Button>
+                        </div>
+					</div>
+					<div className="user-search">
+						<Input
+							style={{ marginRight: 10,width:200 }}
+							value={this.state.apiSearch}
+							placeholder="API"
+							onChange={(e) => {
+								this.setState({ apiSearch: e.target.value });
+							}}
+						/>
+                        <Select  style={{width:150}}
+                            placeholder="轮播图位置"
+                            value={this.state.positionSearch} 
+                            onChange={(e)=>{this.setState({positionSearch:e})}}>
+                            <Select.Option value="0">网站</Select.Option>
+                            <Select.Option value="1">App</Select.Option>
+                        </Select>
+						<Button type="primary" onClick={this.search.bind(this)} style={{ marginRight: 10 }}>
+							搜索
+						</Button>
+						<Button onClick={this.reset.bind(this)} style={{ marginRight: 10 }}>重置</Button>
+                        <Button type="danger" disabled={!hasSelect}  onClick={(e)=>{this.delectRow()}}>删除</Button>
+					</div>
+					<div className="patent-table">
+						<Spin spinning={this.state.loading}>
+							<Table
+                                columns={this.state.columns}
+                                dataSource={this.state.dataSource}
+                                rowSelection={rowSelection}
+                                pagination={this.state.pagination}
+                                onRowClick={this.tableRowClick.bind(this)}
+							/>
+						</Spin>
+					</div>
+				</div>
+                <BannerFrom
+                    data={this.state.RowData}
+                    showDesc={this.state.showDesc}
+                    closeDesc={this.closeDesc.bind(this)}
+                />
+			</div>
+		);
+	}
+}
+
+export default Banner;

+ 287 - 0
js/component/administration/banner/bannerForm.jsx

@@ -0,0 +1,287 @@
+import React from 'react';
+import {
+	Icon,
+	Modal,
+	message,
+	Spin,
+	Upload,
+	Input,
+	Button,
+	Radio,
+	Form
+} from 'antd';
+import {  splitUrl} from '@/tools.js';
+
+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) {
+        if(nextProps.pictureUrl.length){
+            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 + '/open/api/admin/banners/uploadPicture'}
+					data={{ sign: 'banners'}}
+					listType="picture-card"
+					fileList={fileList}
+					onPreview={this.handlePreview}
+					onChange={this.handleChange}
+				>
+					{fileList.length >= 1 ? null : uploadButton}
+				</Upload>
+				<Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
+					<img alt="example" style={{ width: '100%' }} src={previewImage} />
+				</Modal>
+			</div>
+		);
+	}
+});
+
+class BannerForm extends React.Component {
+	constructor(props) {
+        super(props);
+		this.state = {
+			loading: false,
+            imgUrl: [],
+            visible:false
+		};
+	}
+	handleCancel() {
+		this.setState({
+			visible: false,
+		});
+		this.props.closeDesc(false, false);
+    }
+    loadData(id) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context +  '/open/api/admin/banners/details' ,
+            data: {
+                id: id
+            },
+            success: function (data) {
+                let thisData = data.data;
+                if (!thisData) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                    thisData = {};
+                };
+                this.setState({
+                    id: thisData.id, //品类ID
+                    data:thisData,
+                    imgUrl: thisData.imgUrl ? splitUrl(thisData.imgUrl, ',', globalConfig.avatarHost + '/upload') : [],
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    }
+	handOk() {
+		this.setState({
+			visible: false,
+		});
+		this.props.closeDesc(false, true);
+    }
+    handleSubmit(e){
+        e.preventDefault();
+        this.props.form.validateFields((err, values) => {
+            //url转化
+            let thePictureUrl = [];
+            console.log(this.state.imgUrl)
+            if (this.state.imgUrl.length) {
+                let picArr = [];
+                this.state.imgUrl.map(function (item) {
+                    if ( item.response && item.response.data && item.response.data.length ){
+                        picArr.push(item.response.data);
+                    }
+                });
+                thePictureUrl = picArr.join(",");
+            }else{
+                message.warning('请上传图片!');
+                return false;
+            };
+            if (!err) {
+                this.setState({
+                    loading: true
+                });
+                $.ajax({
+                    method: "post",
+					dataType: "json",
+					async:true,
+                    url: this.props.data.id ? globalConfig.context + '/open/api/admin/banners/update' : globalConfig.context + '/open/api/admin/banners/save',
+                    data: {
+                        id:this.props.data.id,
+                        text:values.text,
+                        forwardUrl:values.forwardUrl,
+                        apiUrl:values.apiUrl,
+                        imgUrl:thePictureUrl,
+                        deleteSign:false,
+                        client:values.client
+                    }
+                }).done(function (data) {
+                    this.setState({
+                        loading: false
+					});
+                    if (!data.error.length) {
+                        message.success('操作成功!');
+                        this.setState({
+                            visible: false
+                        });
+                        this.handOk();
+                    } else {
+                        message.warning(data.error[0].message);
+                    }
+                }.bind(this));
+            }
+        })
+    }
+    componentWillMount(){
+        if (this.props.data&&this.props.data.id) {
+            this.loadData(this.props.data.id);
+        } else {
+            this.state.data = {};
+        };
+    }
+	componentWillReceiveProps(nextProps) {
+        this.state.visible = nextProps.showDesc;
+        if(nextProps.data&&nextProps.data.id){
+            this.loadData(nextProps.data.id);
+        }else{
+            this.setState({
+                data:{},
+                imgUrl:[]
+            })
+        }
+        this.props.form.resetFields();
+	}
+	render() {
+        const { getFieldDecorator } = this.props.form;
+        const FormItem = Form.Item;
+        const formItemLayout = {
+            labelCol: { span: 6 },
+            wrapperCol: { span: 12 },
+		};
+        let theData = this.state.data||{};
+		return (
+			<div className="patent-desc">
+				<Modal
+					maskClosable={false}
+					visible={this.state.visible}
+					onOk={this.handOk.bind(this)}
+					onCancel={this.handleCancel.bind(this)}
+					width="600px"
+					title={!theData.id ? '新建轮播图' : '修改轮播图'}
+					footer=""
+					className="admin-desc-content"
+				>
+					<div>
+						<div>
+                            <Form layout="horizontal" onSubmit={this.handleSubmit.bind(this)} id="demand-form">
+                                <Spin spinning={this.state.loading}>
+                                    <div className="clearfix">
+                                        <FormItem  {...formItemLayout} label="轮播图描述">
+                                            {getFieldDecorator('text', {
+                                                rules: [ { required: true, message: '此项为必填项!' } ],
+                                                initialValue: theData.text
+                                            })(<Input placeholder="请输入轮播图名称"/>)}
+                                        </FormItem>
+                                    </div>
+                                    <div className="clearfix">
+                                        <FormItem {...formItemLayout} label="跳转地址">
+                                            {getFieldDecorator('forwardUrl', {
+                                                rules: [ { required: true, message: '此项为必填项!' } ],
+                                                initialValue: theData.forwardUrl
+                                            })(<Input placeholder="请输入跳转地址"/>)}
+                                        </FormItem>
+                                    </div>
+                                    <div className="clearfix">
+                                        <FormItem  {...formItemLayout} label="api">
+                                            {getFieldDecorator('apiUrl', {
+                                                rules: [ { required: true, message: '此项为必填项!' } ],
+                                                initialValue: theData.apiUrl
+                                            })(<Input placeholder="请输入api"/>)}
+                                        </FormItem>
+                                    </div>
+                                    <div className="clearfix">
+                                        <FormItem  {...formItemLayout} label="位置">
+                                            {getFieldDecorator('client', {
+                                                rules: [ { required: true, message: '此项为必填项!' } ],
+                                                initialValue: theData.client 
+                                            })(
+                                                <Radio.Group>
+                                                    <Radio value={0}>网站</Radio>
+                                                    <Radio value={1}>App</Radio>
+                                                </Radio.Group>
+                                                )
+                                            }
+                                        </FormItem>
+                                    </div>
+                                    <div className="clearfix">
+                                        <FormItem labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} label={<span><strong style={{color:"#f00"}}> * </strong>轮播图</span>}>
+                                            <PicturesWall
+                                                fileList={(e)=>{this.setState({imgUrl:e})}}
+                                                pictureUrl={this.state.imgUrl}
+                                                visible={this.props.visible}
+                                            />
+                                        </FormItem>
+                                    </div>
+                                    <div className="clearfix">
+                                        <FormItem wrapperCol={{ span: 12, offset: 6 }}>
+                                            <Button className="set-submit" type="primary" htmlType="submit">
+                                                保存
+                                            </Button>
+                                            <Button className="set-submit" type="ghost" onClick={this.handleCancel.bind(this)}>
+                                                取消
+                                            </Button>
+                                        </FormItem>
+                                    </div>
+                                </Spin>
+                            </Form>    
+						</div>
+					</div>
+				</Modal>
+			</div>
+		);
+	}
+}
+
+export default Form.create()(BannerForm);

+ 3 - 3
js/component/administration/business/businessCategory.jsx

@@ -71,9 +71,9 @@ const BusinessCategory=Form.create()(React.createClass({
             url: globalConfig.context + '/api/admin/jtBusiness/category/list',
             data: {
                 pageNo: pageNo || 1,
-                pageSize: this.state.pagination.pageSize,
-                name:this.state.nameSearch, //品类名称
-                layer:this.state.layerSearch,//组织层级
+				pageSize: this.state.pagination.pageSize,
+				name: this.state.nameSearch, //品类名称
+				layer: this.state.layerSearch //组织层级
             },
             success: function (data) {
                 let theArr = [];

+ 184 - 0
js/component/administration/business/userLibrary.jsx

@@ -0,0 +1,184 @@
+import { Component } from 'react';
+import { Input, Select, Spin, Table, message, Button } from 'antd';
+
+class UserLibrary extends Component {
+	constructor(props) {
+		super(props);
+		this.state = {
+			loading: false,
+			dataSource: [],
+			pagination: {
+				defaultCurrent: 1,
+				defaultPageSize: 10,
+				showQuickJumper: true,
+				pageSize: 10,
+				onChange: function(page) {
+					this.loadData(page);
+					this.setState({
+						selectedRowKeys: []
+					});
+				}.bind(this),
+				showTotal: function(total) {
+					return '共' + total + '条数据';
+				}
+			},
+			columns: [
+				{
+					title: '客户名称',
+					dataIndex: 'name',
+					key: 'name'
+				},
+				{
+					title: '手机号码',
+					dataIndex: 'photo',
+					key: 'photo'
+				},
+				{
+					title: '用户类型',
+					dataIndex: 'userType',
+					key: 'userType',
+					render: (text) => {
+						return text == '1' ? '企业用户' : '个人用户';
+					}
+				},
+				{
+					title: '注册时间',
+					dataIndex: 'createTime',
+					key: 'createTime'
+				}
+			]
+		};
+	}
+	loadData(pageNo) {
+        this.state.data = [];
+        this.setState({
+            page:pageNo,
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/user/achievement/lis",
+            data: {
+                pageNo: pageNo || 1,
+                pageSize: this.state.pagination.pageSize,
+                userType: this.state.userType, //需求名称
+				userName: this.state.userName,
+				photo:this.state.photo
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data || !data.data.list) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    for (let i = 0; i < data.data.list.length; i++) {
+                        let thisdata = data.data.list[i];
+                        theArr.push({
+                            key: i,
+                            id: thisdata.id,
+                            name: thisdata.name, //编号
+                            photo: thisdata.photo,
+                            userType: thisdata.userType,
+                            createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():''
+                        });
+                    };
+                };
+                this.state.pagination.current = data.data.pageNo;
+                this.state.pagination.total = data.data.totalCount;
+                if(data.data&&data.data.list&&!data.data.list.length){
+					this.state.pagination.current=0
+					this.state.pagination.total=0
+				};
+                this.setState({
+                    total:data.data.totalCount,
+                    dataSource: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    }
+	search() {
+		this.loadData();
+	}
+	reset() {
+		this.state.userName = '';
+		this.state.userType = undefined;
+		this.state.photo = '';
+		this.loadData();
+	}
+	componentWillMount() {
+		this.loadData();
+	}
+	render() {
+		const rowSelection = {
+			selectedRowKeys: this.state.selectedRowKeys,
+			onChange: (selectedRowKeys, selectedRows) => {
+				this.setState({
+					selectedRows: selectedRows.slice(-1),
+					selectedRowKeys: selectedRowKeys.slice(-1)
+				});
+			}
+		};
+		return (
+			<div className="user-content">
+				<div className="content-title">
+					<div className="content-title">
+						<span>用户库</span>
+					</div>
+					<div className="user-search">
+						<Input
+							style={{ marginRight: 10 }}
+							value={this.state.userName}
+							placeholder="用户名称"
+							onChange={(e) => {
+								this.setState({ userName: e.target.value });
+							}}
+						/>
+						<Input
+							style={{ marginRight: 10 }}
+							value={this.state.photo}
+							placeholder="手机号码"
+							onChange={(e) => {
+								this.setState({ photo: e.target.value });
+							}}
+						/>
+						<Select
+							value={this.state.userType}
+							style={{ width: 150 }}
+							placeholder="用户类型"
+							onChange={(e) => {
+								this.setState({ userType: e });
+							}}
+						>
+							<Select.Option value="0">个人用户</Select.Option>
+							<Select.Option value="1">企业用户</Select.Option>
+						</Select>
+						<Button type="primary" onClick={this.search.bind(this)} style={{ marginRight: 10 }}>
+							搜索
+						</Button>
+						<Button onClick={this.reset.bind(this)}>重置</Button>
+					</div>
+					<div className="patent-table">
+						<Spin spinning={this.state.loading}>
+							<Table
+								columns={this.state.columns}
+								dataSource={this.state.dataSource}
+								rowSelection={rowSelection}
+								pagination={this.state.pagination}
+							/>
+						</Spin>
+					</div>
+				</div>
+			</div>
+		);
+	}
+}
+
+export default UserLibrary;

+ 0 - 1
js/component/administration/messagePush/systemMessage.jsx

@@ -36,7 +36,6 @@ const DemandList = React.createClass({
                 } else {
                     for (let i = 0; i < data.data.list.length; i++) {
                         let thisdata = data.data.list[i];
-                        
                         theArr.push({
                             key: i,
                             id: thisdata.id,

+ 1 - 1
js/component/administration/news/newDetails.jsx

@@ -221,7 +221,7 @@ const NewDetail = Form.create()(React.createClass({
                                 <span>{getNewPosition(this.state.page)}</span>
 						</FormItem>
                     </div>
-                    <div className="clearfix">
+                    <div className="clearfix breakWord">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="新闻简介">
 							<span>{theData.summary}</span>
 						</FormItem>

+ 1 - 1
js/component/administration/policy/policyDetails.jsx

@@ -209,7 +209,7 @@ const NewDetail = Form.create()(React.createClass({
                                 <span>{getPolicyPosition(this.state.page)}</span>
 						</FormItem>
                     </div>
-                    <div className="clearfix">
+                    <div className="clearfix breakWord">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策简介">
 							<span>{theData.summary}</span>
 						</FormItem>

+ 63 - 44
js/component/axios/axios.js

@@ -1,8 +1,10 @@
+import {message} from 'antd';
+import axios from 'axios';
+message.config({
+  top: 200
+});
 // 配置API接口地址
-var root =`http:${globalConfig.context}`;
-root=''
-// 引用axios
-var axios = require('axios')
+var root = globalConfig.context;
 // 自定义判断元素类型JS
 function toType(obj) {
   return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
@@ -33,52 +35,69 @@ function filterNull(o) {
   另外,不同的项目的处理方法也是不一致的,这里出错就是简单的alert
 */
 
-function apiAxios(method, url, params, success, failure) {
+function apiAxios(method, url, params) {
   if (params) {
     params = filterNull(params)
   }
-  axios({
-      method: method,
-      url: url,
-      data: method === 'POST' || method === 'PUT' ? params : null,
-      params: method === 'GET' || method === 'DELETE' ? params : null,
-      baseURL: root,
-      withCredentials: false
-    })
-    .then(function (res) {
-      console.log(res)
-      if (res.data.success === true) {
-        if (success) {
-          success(res.data)
-        }
-      } else {
-        if (failure) {
-          failure(res.data)
-        } else {
-          return JSON.stringify(res.data)
-        }
-      }
-    })
-    .catch(function (err) {
-      let res = err.response
-      if (err) {
-       console.log('api error, HTTP CODE: ' + res.status)
-      }
-    })
+  return new Promise((resolve, reject) => {
+    axios({
+        method: method,
+        url: url,
+        data: method === 'POST' || method === 'PUT' ? params : null,
+        params: method === 'GET' || method === 'DELETE' ? params : null,
+        baseURL: root,
+        withCredentials: false  //跨域请求 true
+      })
+      .then(function (res) {
+          resolve(res.data);
+      })
+      .catch(function (err) {
+          let res = err.response;
+          message.error(`状态码 : ${res.status} , 请联系管理员 !`);
+          reject(res);
+      })
+  })
 }
 
-// 返回在vue模板中的调用接口
-module.exports= {
-  get: function (url, params, success, failure) {
-    return apiAxios('GET', url, params, success, failure)
+// 返回在模板中的调用接口
+module.exports = {
+  get: function (url, params) {
+    return apiAxios('GET', url, params)
   },
-  post: function (url, params, success, failure) {
-    return apiAxios('POST', url, params, success, failure)
+  post: function (url, params) {
+    return apiAxios('POST', url, params)
   },
-  put: function (url, params, success, failure) {
-    return apiAxios('PUT', url, params, success, failure)
+  put: function (url, params) {
+    return apiAxios('PUT', url, params)
   },
-  delete: function (url, params, success, failure) {
-    return apiAxios('DELETE', url, params, success, failure)
+  delete: function (url, params) {
+    return apiAxios('DELETE', url, params)
   }
-}
+}
+
+
+
+/*  调用  */
+
+/* 
+import * as axios from './axios';
+var url = '/api/admin/list',params={user:'liting'};
+axios.get(url,params)
+      .then(data=>{console.log(data)});
+      .catch(error=>{console.log(data)});
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 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 8088 --devtool eval --progress --colors --hot --content-base build --env.deploy dev --env.watch watch"
+    "dev": "webpack-dev-server --port 80 --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:8088';    
+	let staticHost = 'http://192.168.0.188';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';

+ 2 - 2
webpack.config.js

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

+ 6 - 6
webpack/entry.config.js

@@ -10,28 +10,28 @@ module.exports = {
     'admin/index': './js/admin/index.js',
   },
   watch: {
-    'user/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'user/index': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/index.js'
     ],
-    'user/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'user/login': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/login.js'
     ],
-    'user/signIn': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'user/signIn': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/signIn.js'
     ],
-    'user/account/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'user/account/index': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/index.js'
     ],
     //admin
-    'admin/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'admin/login': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
     'webpack/hot/only-dev-server',
     './js/user/adminLogin.js'
     ],
-    'admin/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
+    'admin/index': ['webpack-dev-server/client?http://192.168.0.188', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/admin/index.js'
     ]