Преглед изворни кода

新增保存点击增加loading,避免卡顿重复提交

dev01 пре 2 година
родитељ
комит
bf49b68be0

+ 31 - 28
js/component/administration/business/activity/components/activityOperation.jsx

@@ -1,5 +1,5 @@
-import React,{Component} from 'react';
-import {Form, Input, Modal, Spin, Radio, Button, Icon, Upload, message} from "antd";
+import React, { Component } from 'react';
+import { Form, Input, Modal, Spin, Radio, Button, Icon, Upload, message } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import {
     splitUrl,
@@ -78,10 +78,10 @@ const PicturesWall = React.createClass({
     }
 });
 
-class ActivityOperation extends Component{
+class ActivityOperation extends Component {
     constructor(props) {
         super(props);
-        this.state={
+        this.state = {
             loading: false,
             pictureUrl: [],
             details: {},
@@ -90,11 +90,11 @@ class ActivityOperation extends Component{
         this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
     }
 
-    submit(e){
+    submit(e) {
         e.preventDefault();
         let _this = this;
         this.props.form.validateFields((err, values) => {
-            if(values.title.length > 6){
+            if (values.title.length > 6) {
                 message.warning('标题最多六个字');
                 return;
             }
@@ -104,7 +104,7 @@ class ActivityOperation extends Component{
                 })
                 values.pictureUrl = values.pictureUrl ? values.pictureUrl[0].response.data : undefined;
                 let url = this.props.id ? "/api/admin/activity/update" : "/api/admin/activity/add";
-                if(this.props.id){
+                if (this.props.id) {
                     values.id = this.props.id;
                 }
                 $.ajax({
@@ -113,7 +113,10 @@ class ActivityOperation extends Component{
                     crossDomain: false,
                     url: globalConfig.context + url,
                     data: values,
-                    success: function(data) {
+                    success: function (data) {
+                        this.setState({
+                            loading: false
+                        });
                         if (data.error && data.error.length) {
                             message.warning(data.error[0].message);
                         } else {
@@ -122,7 +125,7 @@ class ActivityOperation extends Component{
                         }
                     }.bind(this)
                 }).always(
-                    function() {
+                    function () {
                         this.setState({
                             loading: false
                         });
@@ -139,26 +142,26 @@ class ActivityOperation extends Component{
         })
     }
 
-    getSelect(){
+    getSelect() {
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
             url: globalConfig.context + "/api/admin/activity/select",
             data: {
-                id:this.props.id,
+                id: this.props.id,
             },
-            success: function(data) {
+            success: function (data) {
                 if (data.error.length) {
                     message.warning(data.error[0].message);
                 } else {
                     this.props.form.setFieldsValue({
-                        title:data.data.title,
-                        publisher:data.data.publisher,
-                        sort:data.data.sort,
-                        releaseStatus:data.data.releaseStatus,
-                        content:data.data.content,
-                        pictureUrl:data.data.pictureUrl
+                        title: data.data.title,
+                        publisher: data.data.publisher,
+                        sort: data.data.sort,
+                        releaseStatus: data.data.releaseStatus,
+                        content: data.data.content,
+                        pictureUrl: data.data.pictureUrl
                             ? splitUrl(
                                 data.data.pictureUrl,
                                 ",",
@@ -167,7 +170,7 @@ class ActivityOperation extends Component{
                             : []
                     });
                     this.setState({
-                        pictureUrl:data.data.pictureUrl
+                        pictureUrl: data.data.pictureUrl
                             ? splitUrl(
                                 data.data.pictureUrl,
                                 ",",
@@ -178,7 +181,7 @@ class ActivityOperation extends Component{
                 }
             }.bind(this)
         }).always(
-            function() {
+            function () {
                 this.setState({
                     loading: false
                 });
@@ -187,7 +190,7 @@ class ActivityOperation extends Component{
     }
 
     componentDidMount() {
-        if(this.props.id){
+        if (this.props.id) {
             this.getSelect();
         }
     }
@@ -239,7 +242,7 @@ class ActivityOperation extends Component{
                             {getFieldDecorator('sort', {
                                 rules: [{ required: true, message: '请输入排序!' }],
                             })(
-                                <Input placeholder="请输入排序" type={'number'}/>
+                                <Input placeholder="请输入排序" type={'number'} />
                             )}
                         </FormItem>
                         <FormItem
@@ -247,7 +250,7 @@ class ActivityOperation extends Component{
                             wrapperCol={{ span: 8 }}
                             label="是否发布"
                         >
-                            {getFieldDecorator('releaseStatus',{
+                            {getFieldDecorator('releaseStatus', {
                                 rules: [{ required: true, message: '请选择是否显示!' }],
                             })(
                                 <RadioGroup>
@@ -264,7 +267,7 @@ class ActivityOperation extends Component{
                             {getFieldDecorator('content', {
                                 rules: [{ required: true, message: '请输入活动简介!' }],
                             })(
-                                <TextArea placeholder="请输入活动简介" type={'number'}/>
+                                <TextArea placeholder="请输入活动简介" type={'number'} />
                             )}
                         </FormItem>
                         <FormItem
@@ -283,10 +286,10 @@ class ActivityOperation extends Component{
                             )}
                         </FormItem>
                         <FormItem
-                           style={{
-                               display: 'flex',
-                               justifyContent: 'center',
-                           }}
+                            style={{
+                                display: 'flex',
+                                justifyContent: 'center',
+                            }}
                         >
                             <Button
                                 loading={this.state.loading}

+ 42 - 36
js/component/administration/business/advertisementList.jsx

@@ -119,7 +119,7 @@ const AdvertisementList = Form.create()(
           pageSize: this.state.pagination.pageSize,
           position: this.state.positionSearch
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (!data.data || !data.data.list) {
             if (data.error && data.error.length) {
@@ -148,7 +148,7 @@ const AdvertisementList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -169,13 +169,13 @@ const AdvertisementList = Form.create()(
           defaultPageSize: 10,
           showQuickJumper: true,
           pageSize: 10,
-          onChange: function(page) {
+          onChange: function (page) {
             this.loadData(page);
             this.setState({
               selectedRowKeys: []
             });
           }.bind(this),
-          showTotal: function(total) {
+          showTotal: function (total) {
             return "共" + total + "条数据";
           }
         },
@@ -193,19 +193,19 @@ const AdvertisementList = Form.create()(
             render: text => {
               if (text == 0) {
                 return <span>首页</span>;
-              }else if(text == 1) {
+              } else if (text == 1) {
                 return <span>产品中心</span>;
-              }else if(text == 2) {
+              } else if (text == 2) {
                 return <span>战略合作</span>;
-              }else if(text == 3) {
+              } else if (text == 3) {
                 return <span>服务客户</span>;
-              }else if(text == 4) {
+              } else if (text == 4) {
                 return <span>新闻动态</span>;
-              }else if(text == 5) {
+              } else if (text == 5) {
                 return <span>关于科德</span>;
-              }else if(text == 6) {
+              } else if (text == 6) {
                 return <span>联系我们</span>;
-              }else {
+              } else {
                 return "未知"
               }
             }
@@ -240,13 +240,13 @@ const AdvertisementList = Form.create()(
             width: 200,
             render: r => {
               return (
-                  <span style={{
-                    width:200,
-                    overflow: 'hidden',
-                    whiteSpace: 'nowrap',
-                    display: 'block',
-                    textOverflow: 'ellipsis',
-                  }}>{r === 'javascript:;' ? '' : r}</span>
+                <span style={{
+                  width: 200,
+                  overflow: 'hidden',
+                  whiteSpace: 'nowrap',
+                  display: 'block',
+                  textOverflow: 'ellipsis',
+                }}>{r === 'javascript:;' ? '' : r}</span>
               )
             }
           },
@@ -353,7 +353,7 @@ const AdvertisementList = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           let thisdata = data.data;
           this.setState({
             id: thisdata.id,
@@ -368,7 +368,7 @@ const AdvertisementList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -392,11 +392,11 @@ const AdvertisementList = Form.create()(
         data: {
           id
         },
-        success: function(data) {
+        success: function (data) {
           this.loadData();
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -484,7 +484,7 @@ const AdvertisementList = Form.create()(
           title: this.state.title,
           jumpUrl: this.state.jumpUrl || 'javascript:;',
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (data.error.length || data.data.list == "") {
             if (data.error && data.error.length) {
@@ -495,7 +495,7 @@ const AdvertisementList = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -511,6 +511,9 @@ const AdvertisementList = Form.create()(
         message.warning("请填写广告标题");
         return;
       }
+      this.setState({
+        loading: true
+      });
       $.ajax({
         method: "post",
         dataType: "json",
@@ -525,7 +528,10 @@ const AdvertisementList = Form.create()(
           title: this.state.title,
           jumpUrl: this.state.jumpUrl || 'javascript:;',
         },
-        success: function(data) {
+        success: function (data) {
+          this.setState({
+            loading: false
+          });
           let theArr = [];
           if (data.error.length || data.data.list == "") {
             if (data.error && data.error.length) {
@@ -537,7 +543,7 @@ const AdvertisementList = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -707,18 +713,18 @@ const AdvertisementList = Form.create()(
                     </div>
                     <div className="clearfix">
                       <FormItem
-                          className="half-item"
-                          labelCol={{ span: 8 }}
-                          wrapperCol={{ span: 12 }}
-                          label="跳转链接"
+                        className="half-item"
+                        labelCol={{ span: 8 }}
+                        wrapperCol={{ span: 12 }}
+                        label="跳转链接"
                       >
                         <Input
-                            placeholder="请输入跳转链接"
-                            value={this.state.jumpUrl}
-                            onChange={e => {
-                              this.setState({ jumpUrl: e.target.value });
-                            }}
-                            style={{ width: "240px" }}
+                          placeholder="请输入跳转链接"
+                          value={this.state.jumpUrl}
+                          onChange={e => {
+                            this.setState({ jumpUrl: e.target.value });
+                          }}
+                          style={{ width: "240px" }}
                         />
                       </FormItem>
                     </div>

+ 33 - 24
js/component/administration/business/buyList.jsx

@@ -127,7 +127,7 @@ const BuyList = Form.create()(
           pageSize: this.state.pagination.pageSize,
           name: this.state.nameSearch
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (!data.data || !data.data.list) {
             if (data.error && data.error.length) {
@@ -159,7 +159,7 @@ const BuyList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -180,13 +180,13 @@ const BuyList = Form.create()(
           defaultPageSize: 10,
           showQuickJumper: true,
           pageSize: 10,
-          onChange: function(page) {
+          onChange: function (page) {
             this.loadData(page);
             this.setState({
               selectedRowKeys: []
             });
           }.bind(this),
-          showTotal: function(total) {
+          showTotal: function (total) {
             return "共" + total + "条数据";
           }
         },
@@ -341,7 +341,7 @@ const BuyList = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           let thisdata = data.data;
           if (!data.data || !data.data.list) {
@@ -352,10 +352,10 @@ const BuyList = Form.create()(
           this.setState({
             purchaseImg: thisdata.purchaseImg
               ? splitUrl(
-                  thisdata.purchaseImg,
-                  ",",
-                  globalConfig.avatarUploadHost + "/upload"
-                )
+                thisdata.purchaseImg,
+                ",",
+                globalConfig.avatarUploadHost + "/upload"
+              )
               : []
           });
           Object.assign(
@@ -370,7 +370,7 @@ const BuyList = Form.create()(
           );
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -393,7 +393,7 @@ const BuyList = Form.create()(
         data: {
           id
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
@@ -402,7 +402,7 @@ const BuyList = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -454,7 +454,7 @@ const BuyList = Form.create()(
           id: record.id,
           status: num
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
@@ -463,7 +463,7 @@ const BuyList = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -471,6 +471,9 @@ const BuyList = Form.create()(
       );
     },
     addNew(flag) {
+      this.setState({
+        loading: true
+      });
       if (this.state.flag) {
         $.ajax({
           method: "post",
@@ -490,7 +493,10 @@ const BuyList = Form.create()(
             region: this.state.region,
             sort: this.state.sort
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -500,7 +506,7 @@ const BuyList = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });
@@ -523,7 +529,10 @@ const BuyList = Form.create()(
             region: this.state.region,
             sort: this.state.sort
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -533,7 +542,7 @@ const BuyList = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });
@@ -565,7 +574,7 @@ const BuyList = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           let thisdata = data.data;
           let str = "";
           if (data.error && data.error.length) {
@@ -581,10 +590,10 @@ const BuyList = Form.create()(
             name: thisdata.name,
             pictureUrl: thisdata.pictureUrl
               ? splitUrl(
-                  thisdata.pictureUrl,
-                  ",",
-                  globalConfig.avatarUploadHost
-                )
+                thisdata.pictureUrl,
+                ",",
+                globalConfig.avatarUploadHost
+              )
               : [],
             status: thisdata.status,
             releaseStatus: thisdata.releaseStatus,
@@ -597,7 +606,7 @@ const BuyList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });

+ 50 - 25
js/component/administration/business/firmList.jsx

@@ -171,6 +171,7 @@ const FirmList = Form.create()(
     //声明状态
     getInitialState() {
       return {
+        pictureUrl: [],
         loading: false,
         flag: true,
         editorState: null,
@@ -417,10 +418,10 @@ const FirmList = Form.create()(
               type: thisdata.type,
               pictureUrl: thisdata.pictureUrl
                 ? splitUrl(
-                    thisdata.pictureUrl,
-                    ",",
-                    globalConfig.avatarUploadHost
-                  )
+                  thisdata.pictureUrl,
+                  ",",
+                  globalConfig.avatarUploadHost
+                )
                 : [],
               sort: thisdata.sort,
               keywords: thisdata.keywords,
@@ -430,9 +431,9 @@ const FirmList = Form.create()(
                 ? thisdata.releaseTimeConvert
                 : thisdata.createTimeConvert,
             });
-            window.setTimeout(() => {
-              console.log(this.state);
-            }, 100);
+            // window.setTimeout(() => {
+            //   console.log(this.state);
+            // }, 100);
           }
         }.bind(this),
       }).always(
@@ -448,6 +449,26 @@ const FirmList = Form.create()(
     },
     // 新增新闻
     addNew(flag) {
+      let theorgCodeUrl = [];
+      if (this.state.pictureUrl.length) {
+        let picArr = [];
+        this.state.pictureUrl.map(function (item) {
+          if (
+            item.response &&
+            item.response.data &&
+            item.response.data.length
+          ) {
+            picArr.push(item.response.data);
+          }
+        });
+        theorgCodeUrl = picArr.join(",");
+      } else {
+        message.warn("请上传新闻大图")
+        return
+      }
+      this.setState({
+        loading: true,
+      });
       if (this.state.flag) {
         $.ajax({
           method: "post",
@@ -459,9 +480,7 @@ const FirmList = Form.create()(
             title: this.state.title,
             publisher: this.state.publisher,
             type: this.state.type,
-            pictureUrl: this.state.pictureUrl
-              ? this.state.pictureUrl[0].response.data
-              : undefined,
+            pictureUrl: theorgCodeUrl,
             sort: this.state.sort,
             content: this.state.editorcontext,
             status: this.state.status,
@@ -470,6 +489,9 @@ const FirmList = Form.create()(
             keywords: this.state.keywords,
           },
           success: function (data) {
+            this.setState({
+              loading: false,
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -495,7 +517,7 @@ const FirmList = Form.create()(
             title: this.state.title,
             publisher: this.state.publisher,
             type: this.state.type,
-            pictureUrl: this.state.pictureUrl[0].response.data,
+            pictureUrl: theorgCodeUrl,
             sort: this.state.sort,
             content: this.state.editorcontext,
             releaseStatus: flag,
@@ -504,6 +526,9 @@ const FirmList = Form.create()(
             keywords: this.state.keywords,
           },
           success: function (data) {
+            this.setState({
+              loading: false,
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -613,7 +638,7 @@ const FirmList = Form.create()(
     reset() {
       this.state.titleSearch = undefined;
       this.state.typeSearch = undefined;
-      this.loadData();
+      this.loadData(1);
     },
 
     render() {
@@ -656,12 +681,12 @@ const FirmList = Form.create()(
                   this.state.typeSearch == 1
                     ? "行业新闻"
                     : this.state.typeSearch == 0
-                    ? "公司新闻"
-                    : this.state.typeSearch == 2
-                    ? "高新技术企业"
-                    : this.state.typeSearch == 3
-                    ? "军工三证"
-                    : []
+                      ? "公司新闻"
+                      : this.state.typeSearch == 2
+                        ? "高新技术企业"
+                        : this.state.typeSearch == 3
+                          ? "军工三证"
+                          : []
                 }
                 onChange={(e) => {
                   this.setState({
@@ -677,7 +702,7 @@ const FirmList = Form.create()(
               <Button
                 type="primary"
                 onClick={(e) => {
-                  this.loadData();
+                  this.loadData(1);
                 }}
                 style={{ marginRight: "10px" }}
               >
@@ -757,12 +782,12 @@ const FirmList = Form.create()(
                             this.state.type == 1
                               ? "行业新闻"
                               : this.state.type == 0
-                              ? "公司新闻"
-                              : this.state.type == 2
-                              ? "高新技术企业"
-                              : this.state.type == 3
-                              ? "军工三证"
-                              : []
+                                ? "公司新闻"
+                                : this.state.type == 2
+                                  ? "高新技术企业"
+                                  : this.state.type == 3
+                                    ? "军工三证"
+                                    : []
                           }
                           onChange={(e) => {
                             this.setState({

+ 29 - 20
js/component/administration/business/proservlist.jsx

@@ -124,7 +124,7 @@ const Proservlist = Form.create()(
           pageSize: this.state.pagination.pageSize,
           name: this.state.nameSearch
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (!data.data || !data.data.list) {
             if (data.error && data.error.length) {
@@ -153,7 +153,7 @@ const Proservlist = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -174,13 +174,13 @@ const Proservlist = Form.create()(
           defaultPageSize: 10,
           showQuickJumper: true,
           pageSize: 10,
-          onChange: function(page) {
+          onChange: function (page) {
             this.loadData(page);
             this.setState({
               selectedRowKeys: []
             });
           }.bind(this),
-          showTotal: function(total) {
+          showTotal: function (total) {
             return "共" + total + "条数据";
           }
         },
@@ -356,7 +356,7 @@ const Proservlist = Form.create()(
         data: {
           id
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
@@ -365,7 +365,7 @@ const Proservlist = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -415,7 +415,7 @@ const Proservlist = Form.create()(
           id: record.id,
           releaseStatus: flag
         },
-        success: function(data) {
+        success: function (data) {
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
           } else {
@@ -423,7 +423,7 @@ const Proservlist = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -431,6 +431,9 @@ const Proservlist = Form.create()(
       );
     },
     addNew(flag) {
+      this.setState({
+        loading: true
+      });
       if (this.state.flag) {
         $.ajax({
           method: "post",
@@ -447,7 +450,10 @@ const Proservlist = Form.create()(
               ? this.state.pictureUrl[0].response.data
               : undefined
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             if (data.error.length || data.data.list == "") {
               if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
@@ -457,7 +463,7 @@ const Proservlist = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });
@@ -477,7 +483,10 @@ const Proservlist = Form.create()(
               ? this.state.pictureUrl[0].response.data
               : undefined
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             if (data.error.length || data.data.list == "") {
               if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
@@ -487,7 +496,7 @@ const Proservlist = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });
@@ -522,7 +531,7 @@ const Proservlist = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
           } else {
@@ -532,10 +541,10 @@ const Proservlist = Form.create()(
               name: thisdata.name,
               pictureUrl: thisdata.pictureUrl
                 ? splitUrl(
-                    thisdata.pictureUrl,
-                    ",",
-                    globalConfig.avatarUploadHost
-                  )
+                  thisdata.pictureUrl,
+                  ",",
+                  globalConfig.avatarUploadHost
+                )
                 : [],
               releaseStatus: thisdata.releaseStatus,
               sort: thisdata.sort,
@@ -545,7 +554,7 @@ const Proservlist = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -596,7 +605,7 @@ const Proservlist = Form.create()(
           id: record.id,
           status: num
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (data.error && data.error.length) {
             message.warning(data.error[0].message);
@@ -605,7 +614,7 @@ const Proservlist = Form.create()(
           }
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });

+ 47 - 38
js/component/administration/business/talentsList.jsx

@@ -126,7 +126,7 @@ const TalentsList = Form.create()(
           pageSize: this.state.pagination.pageSize,
           name: this.state.nameSearch
         },
-        success: function(data) {
+        success: function (data) {
           let theArr = [];
           if (!data.data || !data.data.list) {
             if (data.error && data.error.length) {
@@ -156,7 +156,7 @@ const TalentsList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -177,13 +177,13 @@ const TalentsList = Form.create()(
           defaultPageSize: 10,
           showQuickJumper: true,
           pageSize: 10,
-          onChange: function(page) {
+          onChange: function (page) {
             this.loadData(page);
             this.setState({
               selectedRowKeys: []
             });
           }.bind(this),
-          showTotal: function(total) {
+          showTotal: function (total) {
             return "共" + total + "条数据";
           }
         },
@@ -311,7 +311,7 @@ const TalentsList = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           let thisdata = data.data;
           this.setState({
             id: thisdata.id,
@@ -325,7 +325,7 @@ const TalentsList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -349,11 +349,11 @@ const TalentsList = Form.create()(
         data: {
           id
         },
-        success: function(data) {
+        success: function (data) {
           this.loadData();
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -415,30 +415,30 @@ const TalentsList = Form.create()(
       this.loadData();
     },
     //撤下
-    remove(record,flag) {
-       $.ajax({
-         method: "post",
-         dataType: "json",
-         crossDomain: false,
-         url: globalConfig.context + "/api/admin/recruitment/updateRecruitment",
-         data: {
-           id: record.id,
-           releaseStatus: flag
-         },
-         success: function(data) {
-           if (data.error && data.error.length) {
-             message.warning(data.error[0].message);
-           } else {
-             this.loadData();
-           }
-         }.bind(this)
-       }).always(
-         function() {
-           this.setState({
-             loading: false
-           });
-         }.bind(this)
-       );
+    remove(record, flag) {
+      $.ajax({
+        method: "post",
+        dataType: "json",
+        crossDomain: false,
+        url: globalConfig.context + "/api/admin/recruitment/updateRecruitment",
+        data: {
+          id: record.id,
+          releaseStatus: flag
+        },
+        success: function (data) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          } else {
+            this.loadData();
+          }
+        }.bind(this)
+      }).always(
+        function () {
+          this.setState({
+            loading: false
+          });
+        }.bind(this)
+      );
     },
     //编辑按钮操作
     edit(record) {
@@ -457,7 +457,7 @@ const TalentsList = Form.create()(
         data: {
           id: record.id
         },
-        success: function(data) {
+        success: function (data) {
           let thisdata = data.data;
           let str = "";
           placeList.forEach(item => {
@@ -479,7 +479,7 @@ const TalentsList = Form.create()(
           });
         }.bind(this)
       }).always(
-        function() {
+        function () {
           this.setState({
             loading: false
           });
@@ -487,6 +487,9 @@ const TalentsList = Form.create()(
       );
     },
     addNew(flag) {
+      this.setState({
+        loading: true
+      });
       if (this.state.flag) {
         $.ajax({
           method: "post",
@@ -504,7 +507,10 @@ const TalentsList = Form.create()(
             releaseStatus: flag,
             releaseTimes: this.state.time
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -513,7 +519,7 @@ const TalentsList = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });
@@ -534,7 +540,10 @@ const TalentsList = Form.create()(
             releaseStatus: flag,
             releaseTimes: this.state.time
           },
-          success: function(data) {
+          success: function (data) {
+            this.setState({
+              loading: false
+            });
             let theArr = [];
             if (data.error && data.error.length) {
               message.warning(data.error[0].message);
@@ -543,7 +552,7 @@ const TalentsList = Form.create()(
             }
           }.bind(this)
         }).always(
-          function() {
+          function () {
             this.setState({
               loading: false
             });

+ 80 - 74
js/component/administration/linkCity/Cities.jsx

@@ -33,7 +33,7 @@ class Cities extends Component {
       PublicView: null,
       contentView: "",
       remarksView: "",
-      hid:'none',
+      hid: 'none',
       contentViewLength: 0,
       contentViewLength1: 0,
       pagination: {
@@ -41,13 +41,13 @@ class Cities extends Component {
         defaultPageSize: 10,
         showQuickJumper: true,
         pageSize: 10,
-        onChange: function(page) {
+        onChange: function (page) {
           this.linkList(page);
           this.setState({
             selectedRowKeys: []
           });
         }.bind(this),
-        showTotal: function(total) {
+        showTotal: function (total) {
           return "共" + total + "条数据";
         }
       },
@@ -105,9 +105,9 @@ class Cities extends Component {
           render: (text, record) => {
             return (
               <div>
-              {
-                text == 0 ? '正常': '冻结'
-              }
+                {
+                  text == 0 ? '正常' : '冻结'
+                }
               </div>
             );
           },
@@ -122,16 +122,16 @@ class Cities extends Component {
               <div>
                 <Popconfirm
                   title={record.status == 0 ? "确认冻结?" : "确认恢复?"}
-                  onConfirm={()=>this.linksUpdate(record)}
+                  onConfirm={() => this.linksUpdate(record)}
                   okText="确定"
                   cancelText="取消"
                 >
                   <Button
-                    style={{background:record.status ?'#009966':''}}
-                    type={record.status == 0 ? 'primary' :'primary'}
+                    style={{ background: record.status ? '#009966' : '' }}
+                    type={record.status == 0 ? 'primary' : 'primary'}
                     onClick={(e) => {
                       e.stopPropagation();
-                      
+
                       // this.setState({
                       //   addFlag: false,
                       // });
@@ -159,10 +159,10 @@ class Cities extends Component {
     this.formRef = {};
     this.submitOrder = this.submitOrder.bind(this);
     this.linkList = this.linkList.bind(this);
-    this.linksUpdate =  this.linksUpdate.bind(this)
-    this.reset =  this.reset.bind(this)
+    this.linksUpdate = this.linksUpdate.bind(this)
+    this.reset = this.reset.bind(this)
     this.tableRowClick = this.tableRowClick.bind(this)
-    this.cleanAllpopularCities= this.cleanAllpopularCities.bind(this)
+    this.cleanAllpopularCities = this.cleanAllpopularCities.bind(this)
   }
   componentDidMount() {
     this.linkList(1)
@@ -192,14 +192,17 @@ class Cities extends Component {
     );
   }
   // 修改链接状态
-  linksUpdate(record){
+  linksUpdate(record) {
     if (!this.state.sort && !record.sort) {
       message.warning("请填写排序");
       return;
-    }else if(!this.state.name && !record.name) {
+    } else if (!this.state.name && !record.name) {
       message.warning("请输入城市名");
       return;
     }
+    this.setState({
+      loading: true,
+    });
     $.ajax({
       method: "post",
       dataType: "json",
@@ -207,7 +210,7 @@ class Cities extends Component {
       url: globalConfig.context + "/api/admin/popularCities/update",
       data: {
         sort: record.sort || this.state.sort,
-        status: record.status == 0 ? '1' :'0' || this.state.status,
+        status: record.status == 0 ? '1' : '0' || this.state.status,
         // mutualChain: record.mutualChain || this.state.mutualChain,
         name: record.name || this.state.name,
         url: record.url || this.state.url,
@@ -215,6 +218,9 @@ class Cities extends Component {
         id: record.id || this.state.id,
       },
       success: function (data) {
+        this.setState({
+          loading: false,
+        });
         if (data.error.length) {
           this.setState({
             loading: false,
@@ -222,8 +228,8 @@ class Cities extends Component {
           message.warning(data.error[0].message);
         } else {
           this.setState({
-            visible:false,
-            hid:'none'
+            visible: false,
+            hid: 'none'
           })
           this.linkList(1)
           message.success("修改成功");
@@ -239,11 +245,11 @@ class Cities extends Component {
   }
   reset() {
     this.setState({
-      sortType1:undefined,
-      name1:undefined,
-      mutualChain1:undefined,
-      status1:undefined
-    },()=>{
+      sortType1: undefined,
+      name1: undefined,
+      mutualChain1: undefined,
+      status1: undefined
+    }, () => {
       this.linkList();
     });
   }
@@ -252,7 +258,7 @@ class Cities extends Component {
     if (!this.state.sort) {
       message.warning("请填写排序");
       return;
-    } else if(!this.state.name) {
+    } else if (!this.state.name) {
       message.warning("请输入城市名");
       return;
     }
@@ -268,9 +274,9 @@ class Cities extends Component {
         sort: this.state.sort,
         status: 0,
         // mutualChain:this.state.mutualChain,
-        name:this.state.name,
-        url:this.state.url,
-        remarks:this.state.remarks
+        name: this.state.name,
+        url: this.state.url,
+        remarks: this.state.remarks
       },
       success: function (data) {
         if (data.error.length) {
@@ -281,13 +287,13 @@ class Cities extends Component {
         } else {
           this.setState({
             loading: false,
-            visible:false,
+            visible: false,
             viewKey: this.state.viewKey + 1,
             sort: "",
             // mutualChain: "",
             name: '',
             url: '',
-            remarks:''
+            remarks: ''
           });
           this.linkList(1)
           // this.assistList();
@@ -302,19 +308,19 @@ class Cities extends Component {
       }.bind(this)
     );
   }
-  linkList(page){
+  linkList(page) {
     $.ajax({
       method: "get",
       dataType: "json",
       crossDomain: false,
       url: globalConfig.context + "/api/admin/popularCities/list",
       data: {
-        sortType:this.state.sortType1 || undefined,
+        sortType: this.state.sortType1 || undefined,
         name: this.state.name1 || undefined,
         // mutualChain:this.state.mutualChain || undefined,
-        status:this.state.status1 || undefined,
-        pageNo:page || 1,
-        pageSize:10
+        status: this.state.status1 || undefined,
+        pageNo: page || 1,
+        pageSize: 10
       },
       success: function (data) {
         if (data.error.length) {
@@ -329,10 +335,10 @@ class Cities extends Component {
           });
           this.state.pagination.total = data.data.totalCount;
           this.state.pagination.current = data.data.pageNo;
-          }
-          if (data.data && data.data.list && !data.data.list.length) {
-            this.state.pagination.total = 0;
-          }  
+        }
+        if (data.data && data.data.list && !data.data.list.length) {
+          this.state.pagination.total = 0;
+        }
       }.bind(this),
     }).always(
       function () {
@@ -342,20 +348,20 @@ class Cities extends Component {
       }.bind(this)
     );
   }
-    // 双击表格弹出修改
+  // 双击表格弹出修改
   tableRowClick(record) {
-      this.setState({
-        visible:true,
-        sort: record.sort,
-        status: record.status,
-        // mutualChain: record.mutualChain,
-        name: record.name,
-        url: record.url,
-        remarks: record.remarks,
-        id:record.id,
-        hid:'block'
-      })
-    }
+    this.setState({
+      visible: true,
+      sort: record.sort,
+      status: record.status,
+      // mutualChain: record.mutualChain,
+      name: record.name,
+      url: record.url,
+      remarks: record.remarks,
+      id: record.id,
+      hid: 'block'
+    })
+  }
   render() {
     const formItemLayout = {
       labelCol: { span: 8 },
@@ -385,7 +391,7 @@ class Cities extends Component {
             </Select>
             {/* 显示名称关键字 */}
             <Input
-              style={{bottom:'6px'}}
+              style={{ bottom: '6px' }}
               placeholder="请输入显示名称关键字"
               value={this.state.name1}
               onChange={(e) => {
@@ -426,7 +432,7 @@ class Cities extends Component {
             </Select>
             <Button
               type="primary"
-              onClick={()=>this.linkList(1)}
+              onClick={() => this.linkList(1)}
               style={{ marginLeft: "10px" }}
             >
               搜索
@@ -435,13 +441,13 @@ class Cities extends Component {
             <Button
               type="primary"
               onClick={() => {
-                this.setState({ 
-                  visible: true ,
+                this.setState({
+                  visible: true,
                   sort: "",
                   mutualChain: "",
                   name: '',
                   url: '',
-                  remarks:''
+                  remarks: ''
                 });
               }}
               style={{ marginLeft: "100px" }}
@@ -467,17 +473,17 @@ class Cities extends Component {
             </SpinContainer>
           </div>
           <Modal
-          width={'600px'}
+            width={'600px'}
             visible={this.state.visible}
             key={this.state.viewKey}
             title="新增/编辑热门"
             onCancel={() => {
               this.setState({
                 visible: false,
-                viewKey:this.state.viewKey+1
+                viewKey: this.state.viewKey + 1
               });
             }}
-            onOk={() => {}}
+            onOk={() => { }}
             footer={false}
           >
             <Form
@@ -495,7 +501,7 @@ class Cities extends Component {
                   value={this.state.sort}
                   min={1}
                   onChange={(e) => {
-                    if(isNaN(e)) {
+                    if (isNaN(e)) {
                       message.info("请输入数字")
                     }
                     this.setState({ sort: e });
@@ -510,14 +516,14 @@ class Cities extends Component {
                 hasFeedback
               >
                 <Input
-                style={{width:'140px'}}
-                value={this.state.url}
+                  style={{ width: '140px' }}
+                  value={this.state.url}
                   placeholder="请输入http://地址"
                   onChange={(e) => {
                     this.setState({ url: e.target.value });
                   }}
                 />
-                <span style={{ color: "red",marginLeft:'10px' }}>请输入http://地址</span>
+                <span style={{ color: "red", marginLeft: '10px' }}>请输入http://地址</span>
               </Form.Item>
               <Form.Item
                 {...formItemLayout}
@@ -526,7 +532,7 @@ class Cities extends Component {
                 hasFeedback
               >
                 <Input
-                value={this.state.name}
+                  value={this.state.name}
                   placeholder="请输入显示在页面的热门城市"
                   onChange={(e) => {
                     this.setState({ name: e.target.value });
@@ -552,17 +558,17 @@ class Cities extends Component {
                 name="remarks"
                 hasFeedback
               >
-               <TextArea
-                value={this.state.remarks}
-                maxLength={500}
-                placeholder="请输入备注..."
-                rows={4}
-                onChange={(e) => {
+                <TextArea
+                  value={this.state.remarks}
+                  maxLength={500}
+                  placeholder="请输入备注..."
+                  rows={4}
+                  onChange={(e) => {
                     this.setState({
                       remarks: e.target.value,
                     })
                   }}
-               />
+                />
               </Form.Item>
             </Form>
             <div
@@ -572,7 +578,7 @@ class Cities extends Component {
               }}
             >
               <Button
-              style={{display:this.state.hid == 'none' ? 'block' :'none'}}
+                style={{ display: this.state.hid == 'none' ? 'block' : 'none' }}
                 onClick={this.submitOrder}
                 type="primary"
                 loading={this.state.loading}
@@ -580,7 +586,7 @@ class Cities extends Component {
                 保存并发布
               </Button>
               <Button
-                style={{display:this.state.hid}}
+                style={{ display: this.state.hid }}
                 onClick={this.linksUpdate}
                 type="primary"
                 loading={this.state.loading}
@@ -598,7 +604,7 @@ class Cities extends Component {
                     // mutualChain: "",
                     name: '',
                     url: '',
-                    remarks:''
+                    remarks: ''
                   });
                 }}
               >

+ 35 - 34
js/component/administration/linkCity/Links.jsx

@@ -35,7 +35,7 @@ class Links extends Component {
       remarksView: "",
       contentViewLength: 0,
       contentViewLength1: 0,
-      hid:'none',
+      hid: 'none',
       pagination: {
         defaultCurrent: 1,
         defaultPageSize: 10,
@@ -110,16 +110,16 @@ class Links extends Component {
               <div>
                 <Popconfirm
                   title={record.status == 0 ? "确认冻结?" : "确认恢复?"}
-                  onConfirm={()=>this.linksUpdate(record)}
+                  onConfirm={() => this.linksUpdate(record)}
                   okText="确定"
                   cancelText="取消"
                 >
                   <Button
-                     style={{background:record.status ?'#009966':''}}
-                     type={record.status == 0 ? 'primary' :'primary'}
+                    style={{ background: record.status ? '#009966' : '' }}
+                    type={record.status == 0 ? 'primary' : 'primary'}
                     onClick={(e) => {
                       e.stopPropagation();
-                      
+
                       // this.setState({
                       //   addFlag: false,
                       // });
@@ -191,9 +191,10 @@ class Links extends Component {
     } else if (!this.state.name && !record.name) {
       message.warning("请输入链接名");
       return;
-    } 
-    // console.log(record);
-    // console.log(this.state.status);
+    }
+    this.setState({
+      loading: true,
+    });
     $.ajax({
       method: "post",
       dataType: "json",
@@ -201,7 +202,7 @@ class Links extends Component {
       url: globalConfig.context + "/api/admin/links/update",
       data: {
         sort: record.sort || this.state.sort,
-        status: record.status == 0 ? '1' :'0' || this.state.status,
+        status: record.status == 0 ? '1' : '0' || this.state.status,
         mutualChain: record.mutualChain || this.state.mutualChain,
         name: record.name || this.state.name,
         url: record.url || this.state.url,
@@ -209,15 +210,15 @@ class Links extends Component {
         id: record.id || this.state.id,
       },
       success: function (data) {
+        this.setState({
+          loading: false,
+        });
         if (data.error.length) {
-          this.setState({
-            loading: false,
-          });
           message.warning(data.error[0].message);
         } else {
           this.setState({
-            visible:false,
-            hid:'none'
+            visible: false,
+            hid: 'none'
           })
           this.linkList(1);
           message.success("修改成功");
@@ -237,10 +238,10 @@ class Links extends Component {
       name1: undefined,
       mutualChain1: undefined,
       status1: undefined,
-    },()=>{
+    }, () => {
       this.linkList();
     });
-    
+
   }
   // 新增友情链接
   submitOrder() {
@@ -253,7 +254,7 @@ class Links extends Component {
     } else if (!this.state.name) {
       message.warning("请输入链接名");
       return;
-    } 
+    }
     this.setState({
       loading: true,
     });
@@ -326,11 +327,11 @@ class Links extends Component {
             pagination: this.state.pagination
           });
           this.state.pagination.total = data.data.totalCount;
-            this.state.pagination.current = data.data.pageNo;
-          }
-          if (data.data && data.data.list && !data.data.list.length) {
-            this.state.pagination.total = 0;
-          }  
+          this.state.pagination.current = data.data.pageNo;
+        }
+        if (data.data && data.data.list && !data.data.list.length) {
+          this.state.pagination.total = 0;
+        }
       }.bind(this),
     }).always(
       function () {
@@ -343,15 +344,15 @@ class Links extends Component {
   // 双击表格弹出修改
   tableRowClick(record) {
     this.setState({
-      visible:true,
+      visible: true,
       sort: record.sort,
       status: record.status,
       mutualChain: record.mutualChain,
       name: record.name,
       url: record.url,
       remarks: record.remarks,
-      id:record.id,
-      hid:'block'
+      id: record.id,
+      hid: 'block'
     })
   }
   render() {
@@ -381,7 +382,7 @@ class Links extends Component {
             </Select>
             {/* 显示名称关键字 */}
             <Input
-              style={{bottom:'6px'}}
+              style={{ bottom: '6px' }}
               placeholder="请输入显示名称关键字"
               value={this.state.name1}
               onChange={(e) => {
@@ -434,7 +435,7 @@ class Links extends Component {
                   name: "",
                   url: "",
                   remarks: "",
-                  hid:"none"
+                  hid: "none"
                 });
               }}
               style={{ marginLeft: "100px" }}
@@ -470,7 +471,7 @@ class Links extends Component {
                 viewKey: this.state.viewKey + 1,
               });
             }}
-            onOk={() => {}}
+            onOk={() => { }}
             footer={false}
           >
             <Form
@@ -488,7 +489,7 @@ class Links extends Component {
                   min={1}
                   value={this.state.sort}
                   onChange={(e) => {
-                    if(isNaN(e)) {
+                    if (isNaN(e)) {
                       message.info("请输入数字")
                     }
                     this.setState({ sort: e });
@@ -503,14 +504,14 @@ class Links extends Component {
                 hasFeedback
               >
                 <Input
-                  style={{width:"140px"}}
+                  style={{ width: "140px" }}
                   value={this.state.url}
                   placeholder="请输入http://地址"
                   onChange={(e) => {
                     this.setState({ url: e.target.value });
                   }}
                 />
-                <span style={{ color: "red",marginLeft:'10px' }}>请输入http://地址</span>
+                <span style={{ color: "red", marginLeft: '10px' }}>请输入http://地址</span>
               </Form.Item>
               <Form.Item
                 {...formItemLayout}
@@ -551,7 +552,7 @@ class Links extends Component {
                 hasFeedback
               >
                 <TextArea
-                value={this.state.remarks}
+                  value={this.state.remarks}
                   maxLength={500}
                   placeholder="请输入备注..."
                   rows={4}
@@ -570,7 +571,7 @@ class Links extends Component {
               }}
             >
               <Button
-                style={{display:this.state.hid == 'none' ? 'block' :'none'}}
+                style={{ display: this.state.hid == 'none' ? 'block' : 'none' }}
                 onClick={this.submitOrder}
                 type="primary"
                 loading={this.state.loading}
@@ -578,7 +579,7 @@ class Links extends Component {
                 提交
               </Button>
               <Button
-                style={{display:this.state.hid}}
+                style={{ display: this.state.hid }}
                 onClick={this.linksUpdate}
                 type="primary"
                 loading={this.state.loading}

+ 39 - 33
js/component/administration/weapp/productSort/index.jsx

@@ -1,19 +1,19 @@
-import React,{Component}from 'react';
-import {Button, DatePicker, Form, Icon, Input, message, Modal, Popconfirm, Select, Table} from "antd";
+import React, { Component } from 'react';
+import { Button, DatePicker, Form, Icon, Input, message, Modal, Popconfirm, Select, Table } from "antd";
 import SpinContainer from "../../../SpinContainer";
 import $ from "jquery/src/ajax";
 import moment from "moment";
 
 const FormItem = Form.Item;
 
-class ProductSort extends Component{
+class ProductSort extends Component {
     constructor(props) {
         super(props);
-        this.state={
+        this.state = {
             loading: false,
-            id:'',
-            name:'',
-            columns:[
+            id: '',
+            name: '',
+            columns: [
                 {
                     title: '序号',
                     dataIndex: 'key',
@@ -41,7 +41,7 @@ class ProductSort extends Component{
                         >
                             <Button
                                 type="primary"
-                                style={{marginLeft: 10,borderColor:'#f00', background: '#f00'}}
+                                style={{ marginLeft: 10, borderColor: '#f00', background: '#f00' }}
                                 onClick={(e) => {
                                     e.stopPropagation();
                                 }}
@@ -52,7 +52,7 @@ class ProductSort extends Component{
                     )
                 }
             ],
-            dataSource:[],
+            dataSource: [],
             pagination: {
                 defaultCurrent: 1,
                 defaultPageSize: 10,
@@ -65,7 +65,7 @@ class ProductSort extends Component{
                     return '共' + total + '条数据';
                 }
             },
-            visible:false,
+            visible: false,
         }
         this.tableRowClick = this.tableRowClick.bind(this);
         this.loadData = this.loadData.bind(this);
@@ -74,15 +74,15 @@ class ProductSort extends Component{
         this.delete = this.delete.bind(this);
     }
 
-    tableRowClick(value){
+    tableRowClick(value) {
         this.setState({
             visible: true,
-            id:value.id,
-            name:value.name,
+            id: value.id,
+            name: value.name,
         })
     }
 
-    delete(id){
+    delete(id) {
         $.ajax({
             method: "post",
             dataType: "json",
@@ -91,7 +91,7 @@ class ProductSort extends Component{
             data: {
                 id: id
             },
-            success: function(data) {
+            success: function (data) {
                 if (data.error && data.error.length) {
                     message.warning(data.error[0].message);
                 } else {
@@ -100,7 +100,7 @@ class ProductSort extends Component{
                 }
             }.bind(this)
         }).always(
-            function() {
+            function () {
                 this.setState({
                     loading: false
                 });
@@ -127,7 +127,7 @@ class ProductSort extends Component{
                 message.warning(data1.error[0].message);
             } else {
                 for (let i = 0; i < data1.data.length; i++) {
-                    data1.data[i].key = i+1;
+                    data1.data[i].key = i + 1;
                 }
                 this.state.pagination.current = data1.data.pageNo;
                 this.state.pagination.total = data1.data.totalCount;
@@ -147,11 +147,14 @@ class ProductSort extends Component{
         this.loadData();
     }
 
-    onOk(){
-        if(!this.state.name){
+    onOk() {
+        if (!this.state.name) {
             message.warning('请填写产品类型')
             return;
         }
+        this.setState({
+            loading: true
+        });
         $.ajax({
             method: "post",
             dataType: "json",
@@ -161,22 +164,25 @@ class ProductSort extends Component{
                 id: this.state.id || undefined,
                 name: this.state.name,
             },
-            success: function(data) {
+            success: function (data) {
+                this.setState({
+                    loading: false
+                });
                 if (data.error && data.error.length) {
                     message.warning(data.error[0].message);
                 } else {
                     message.success(this.state.id ? '修改成功' : '添加成功');
                     this.setState({
                         visible: false,
-                        id:'',
-                        name:'',
-                    },()=>{
+                        id: '',
+                        name: '',
+                    }, () => {
                         this.loadData();
                     })
                 }
             }.bind(this)
         }).always(
-            function() {
+            function () {
                 this.setState({
                     loading: false
                 });
@@ -184,11 +190,11 @@ class ProductSort extends Component{
         );
     }
 
-    onCancel(){
+    onCancel() {
         this.setState({
             visible: false,
-            id:'',
-            name:'',
+            id: '',
+            name: '',
         })
     }
 
@@ -196,11 +202,11 @@ class ProductSort extends Component{
         return (
             <div className="user-content" >
                 <div className="content-title">
-                    <span style={{ flex:1 }}>产品类型管理</span>
+                    <span style={{ flex: 1 }}>产品类型管理</span>
                     <Button
                         type="primary"
-                        onClick={()=>{this.setState({visible:true})}}
-                        style={{marginLeft:'30px'}}
+                        onClick={() => { this.setState({ visible: true }) }}
+                        style={{ marginLeft: '30px' }}
                     >
                         新增产品
                     </Button>
@@ -208,9 +214,9 @@ class ProductSort extends Component{
                 <div className="patent-table">
                     <SpinContainer spinning={this.state.loading}>
                         <Table columns={this.state.columns}
-                               dataSource={this.state.dataSource}
-                               pagination={false}
-                               onRowClick={this.tableRowClick} />
+                            dataSource={this.state.dataSource}
+                            pagination={false}
+                            onRowClick={this.tableRowClick} />
                     </SpinContainer>
                 </div>
                 <Modal

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.6",
+  "version": "1.0.7",
   "description": "",
   "main": "index.js",
   "scripts": {