tuonina 5 жил өмнө
parent
commit
6597d3a2d4

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 # Logs
 logs
+.idea/
 *.log
 npm-debug.log*
 yarn-debug.log*

+ 0 - 28
.idea/codeStyles/Project.xml

@@ -1,28 +0,0 @@
-<component name="ProjectCodeStyleConfiguration">
-  <code_scheme name="Project" version="173">
-    <JSCodeStyleSettings version="0">
-      <option name="FORCE_SEMICOLON_STYLE" value="true" />
-      <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
-      <option name="USE_DOUBLE_QUOTES" value="false" />
-      <option name="FORCE_QUOTE_STYlE" value="true" />
-      <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
-      <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
-      <option name="SPACES_WITHIN_IMPORTS" value="true" />
-    </JSCodeStyleSettings>
-    <TypeScriptCodeStyleSettings version="0">
-      <option name="FORCE_SEMICOLON_STYLE" value="true" />
-      <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
-      <option name="USE_DOUBLE_QUOTES" value="false" />
-      <option name="FORCE_QUOTE_STYlE" value="true" />
-      <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
-      <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
-      <option name="SPACES_WITHIN_IMPORTS" value="true" />
-    </TypeScriptCodeStyleSettings>
-    <codeStyleSettings language="JavaScript">
-      <option name="SOFT_MARGINS" value="100" />
-    </codeStyleSettings>
-    <codeStyleSettings language="TypeScript">
-      <option name="SOFT_MARGINS" value="100" />
-    </codeStyleSettings>
-  </code_scheme>
-</component>

+ 0 - 5
.idea/codeStyles/codeStyleConfig.xml

@@ -1,5 +0,0 @@
-<component name="ProjectCodeStyleConfiguration">
-  <state>
-    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
-  </state>
-</component>

+ 2 - 2
.idea/inspectionProfiles/Project_Default.xml

@@ -1,8 +1,8 @@
 <component name="InspectionProjectProfileManager">
   <profile version="1.0">
     <option name="myName" value="Project Default" />
-    <inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
-      <option name="myAdditionalRequiredHtmlAttributes" value="htmlType,htmlType" />
+    <inspection_tool class="RequiredAttributes" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="myAdditionalRequiredHtmlAttributes" value="align,htmlType" />
     </inspection_tool>
   </profile>
 </component>

+ 0 - 6
.idea/misc.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="JavaScriptSettings">
-    <option name="languageLevel" value="JSX" />
-  </component>
-</project>

+ 0 - 8
.idea/modules.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/tuonq-admin.iml" filepath="$PROJECT_DIR$/.idea/tuonq-admin.iml" />
-    </modules>
-  </component>
-</project>

+ 0 - 12
.idea/tuonq-admin.iml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="WEB_MODULE" version="4">
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
-      <excludeFolder url="file://$MODULE_DIR$/temp" />
-      <excludeFolder url="file://$MODULE_DIR$/tmp" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-</module>

+ 0 - 6
.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>

+ 9 - 33
.idea/workspace.xml

@@ -1,10 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
-    <list default="true" id="6f4a0bf1-27c2-4804-af97-a0a1bdd98e1d" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/const/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/const/index.js" afterDir="false" />
-    </list>
+    <list default="true" id="6f4a0bf1-27c2-4804-af97-a0a1bdd98e1d" name="Default Changelist" comment="" />
     <ignored path="$PROJECT_DIR$/.tmp/" />
     <ignored path="$PROJECT_DIR$/temp/" />
     <ignored path="$PROJECT_DIR$/tmp/" />
@@ -92,7 +89,7 @@
         <entry file="file://$PROJECT_DIR$/src/axios/index.js">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="150">
-              <caret line="6" column="34" lean-forward="true" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
+              <caret line="6" column="34" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
             </state>
           </provider>
         </entry>
@@ -141,34 +138,13 @@
     </navigator>
     <panes>
       <pane id="Scope" />
-      <pane id="ProjectPane">
-        <subPane>
-          <expand>
-            <path>
-              <item name="tuonq-admin" type="b2602c69:ProjectViewProjectNode" />
-              <item name="tuonq-admin" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="tuonq-admin" type="b2602c69:ProjectViewProjectNode" />
-              <item name="tuonq-admin" type="462c0819:PsiDirectoryNode" />
-              <item name="src" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="tuonq-admin" type="b2602c69:ProjectViewProjectNode" />
-              <item name="tuonq-admin" type="462c0819:PsiDirectoryNode" />
-              <item name="src" type="462c0819:PsiDirectoryNode" />
-              <item name="const" type="462c0819:PsiDirectoryNode" />
-            </path>
-          </expand>
-          <select />
-        </subPane>
-      </pane>
+      <pane id="ProjectPane" />
     </panes>
   </component>
   <component name="PropertiesComponent">
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../redux-alita" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
     <property name="list.type.of.created.stylesheet" value="Less" />
     <property name="node.js.detected.package.eslint" value="true" />
     <property name="node.js.detected.package.standard" value="true" />
@@ -206,17 +182,17 @@
       <workItem from="1565328743940" duration="480000" />
       <workItem from="1565412727241" duration="14134000" />
       <workItem from="1565485978005" duration="12032000" />
-      <workItem from="1565783970634" duration="291000" />
+      <workItem from="1565783970634" duration="530000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="26937000" />
+    <option name="totallyTimeSpent" value="27176000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
     <layout>
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24920969" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24920969" />
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info id="npm" order="2" side_tool="true" />
       <window_info id="Favorites" order="3" side_tool="true" />
@@ -231,7 +207,7 @@
       <window_info anchor="bottom" id="Version Control" order="8" />
       <window_info anchor="bottom" id="RNConsole" order="9" />
       <window_info anchor="bottom" id="Event Log" order="10" sideWeight="0.50105375" side_tool="true" weight="0.32936078" />
-      <window_info active="true" anchor="bottom" id="Terminal" order="11" sideWeight="0.49894625" visible="true" weight="0.329718" />
+      <window_info anchor="bottom" id="Terminal" order="11" sideWeight="0.49894625" visible="true" weight="0.32936078" />
       <window_info anchor="bottom" id="TypeScript" order="12" />
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
@@ -510,7 +486,7 @@
     <entry file="file://$PROJECT_DIR$/src/axios/index.js">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="150">
-          <caret line="6" column="34" lean-forward="true" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
+          <caret line="6" column="34" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
         </state>
       </provider>
     </entry>

+ 3 - 2
package.json

@@ -80,7 +80,8 @@
     "webpack": "4.19.1",
     "webpack-dev-server": ">=3.1.11",
     "webpack-manifest-plugin": "2.0.4",
-    "workbox-webpack-plugin": "3.6.2"
+    "workbox-webpack-plugin": "3.6.2",
+    "prop-types": "latest"
   },
   "scripts": {
     "start": "node scripts/start.js",
@@ -143,4 +144,4 @@
     "eslint-plugin-react-hooks": "^1.6.0"
   },
   "description": "项目的管理后台"
-}
+}

+ 1 - 1
src/App.js

@@ -95,7 +95,7 @@ class App extends Component {
                             <Routes auth={auth} />
                         </Content>
                         <Footer style={{ textAlign: 'center' }}>
-                            React-Admin ©{new Date().getFullYear()} Created by 865470087@qq.com
+                            React-Admin ©{new Date().getFullYear()} Created by 976056042@qq.com
                         </Footer>
                     </Layout>
                 </Layout>

+ 14 - 0
src/pages/config/CommonConfig.js

@@ -0,0 +1,14 @@
+
+import React from 'react'
+
+class CommonConfig extends React.Component{
+
+
+    render() {
+        return (<div>通用的配置</div>)
+    }
+
+}
+
+
+export default CommonConfig

+ 3 - 3
src/pages/config/ConfigLabel.js

@@ -61,11 +61,11 @@ class ConfigLabel extends React.Component {
     }
 
     render() {
-        const { data: labelList = {} } = this.props.findPLabel || {};
+        const { data: labelList = {} ,isFetching} = this.props.findPLabel || {};
         const { currentLabel, loading, addModalTitle } = this.state;
         return (<div>
             <div className='prop-label-header'>
-                <Button type='primary' icon='sync' onClick={this._fetchLabels.bind(this)}/>
+                <Button type='primary' icon='sync' loading={isFetching} onClick={this._fetchLabels.bind(this)}/>
                 <Button type='primary' icon='plus' onClick={()=>this.setState({currentLabel:{}})}/>
             </div>
 
@@ -99,4 +99,4 @@ class ConfigLabel extends React.Component {
 
 }
 
-export default withRouter(connectAlita(['findPLabel'])(ConfigLabel));
+export default withRouter(connectAlita(['findPLabel'])(ConfigLabel));

+ 17 - 0
src/pages/config/PropertiesLabel.jsx

@@ -0,0 +1,17 @@
+import React from 'react';
+
+class PropertiesLabel extends React.Component {
+
+    constructor(props){
+        super(props);
+    }
+
+
+    render() {
+        return (<div>什么鬼</div>);
+    }
+
+}
+
+
+export default PropertiesLabel;

+ 23 - 0
src/pages/config/SystemProperties.js

@@ -0,0 +1,23 @@
+import React from 'react'
+import { Button } from 'antd';
+import SystemPropertiesForm from './widget/SystemPropertiesForm';
+
+
+export default class SystemProperties extends React.Component{
+    constructor(props){
+        super(props);
+        this.state={
+            addModalVisible:false
+        }
+    }
+
+    render() {
+        return (<div>
+            <Button htmlType='button' type='primary' onClick={()=>this.setState({addModalVisible:true})} icon='plus'/>
+            <SystemPropertiesForm visible={this.state.addModalVisible}
+                                  onHide={()=>this.setState({addModalVisible:false})}/>
+            系统的基本属性配置
+        </div>)
+    }
+
+}

+ 9 - 15
src/pages/config/widget/AddLabelForm.js

@@ -27,15 +27,16 @@ class AddLabelForm extends React.Component {
     handleSubmit = e => {
         e.preventDefault();
         const _this = this;
+        let params = { id: _this.state.label.id, pid: _this.state.label.pid };
         this.props.form.validateFieldsAndScroll((err, values) => {
             if (!err) {
                 if (_this.state.label.id) {
-                    _this.props.setAlitaState({ funcName: 'labelEdit', params: values })
-                        .then((resp)=>{
-                            console.log(' resp ',resp)
-                        })
+                    _this.props.setAlitaState({ funcName: 'labelEdit', params: { ...values, ...params } })
+                        .then((resp) => {
+                            console.log(' resp ', resp);
+                        });
                 } else {
-                    _this.props.setAlitaState({ funcName: 'labelAdd', params: values });
+                    _this.props.setAlitaState({ funcName: 'labelAdd', params: { ...values, ...params } });
                 }
             }
         });
@@ -57,13 +58,12 @@ class AddLabelForm extends React.Component {
     }
 
     render() {
-        console.log('props=>',this.props)
         const { getFieldDecorator } = this.props.form;
         let { label } = this.props;
         if (!label) return null;
         const { data: dataSource, isFetching } = this.props.searchLabel || { data: {} };
-        const { isFetching: isSubmitLoading } = this.props.labelAdd||{};
-        const { isFetching: isEditLoading } = this.props.labelEdit||{};
+        const { isFetching: isSubmitLoading } = this.props.labelAdd || {};
+        const { isFetching: isEditLoading } = this.props.labelEdit || {};
 
         if (!dataSource.records) dataSource.records = [];
         return (<Form onSubmit={this.handleSubmit}>
@@ -74,12 +74,6 @@ class AddLabelForm extends React.Component {
                                                          onSelect={this.onSelect.bind(this, dataSource.records)}
                                                          placeholder='输入关键词查询上级标签'/>)}
             </Form.Item>)}
-            <Form.Item style={{ display: 'none' }}>
-                {getFieldDecorator('id', { initialValue: label.id })}(<Input/>
-            </Form.Item>
-            <Form.Item style={{ display: 'none' }}>
-                {getFieldDecorator('pid', { initialValue: label.pid })}(<Input/>
-            </Form.Item>
             <Form.Item>
                 {getFieldDecorator('label', {
                     rules: [{ required: true, message: '请输入标签' }],
@@ -103,4 +97,4 @@ class AddLabelForm extends React.Component {
 
 }
 
-export default connectAlita(['searchLabel', 'labelAdd','labelEdit'])(Form.create({ name: 'AddLabelForm' })(AddLabelForm));
+export default connectAlita(['searchLabel', 'labelAdd', 'labelEdit'])(Form.create({ name: 'AddLabelForm' })(AddLabelForm));

+ 37 - 0
src/pages/config/widget/SystemPropertiesForm.js

@@ -0,0 +1,37 @@
+import React from 'react';
+import { Modal, Form, Input } from 'antd';
+import { connectAlita } from 'redux-alita';
+import * as PropTypes from 'prop-types'
+
+class SystemPropertiesForm extends React.Component {
+
+
+    static defaultProps = {
+        visible: false,
+        config:{},
+        onHide:()=>{}
+    };
+
+    static propTypes={
+        visible:PropTypes.bool,
+        config:PropTypes.object,
+        onHide:PropTypes.func
+    };
+
+    render() {
+        const { getFieldDecorator } = this.props.form;
+        let {config,visible,onHide} = this.props;
+        return (<Modal  title={config.id?'编辑配置':'添加配置'} visible={visible} onCancel={onHide}>
+            <Form>
+                <Form.Item>
+                    {getFieldDecorator('title')(<Input/>)}
+                </Form.Item>
+            </Form>
+        </Modal>);
+
+
+    }
+
+}
+
+export default connectAlita([])(Form.create()(SystemPropertiesForm));

+ 6 - 0
src/pages/index.js

@@ -0,0 +1,6 @@
+import SystemProperties from './config/SystemProperties';
+
+
+export default {
+    SystemProperties,
+};

+ 7 - 1
src/routes/config.js

@@ -1,4 +1,5 @@
 import ConfigLabel from '../pages/config/ConfigLabel';
+import CommonConfig from '../pages/config/CommonConfig';
 
 export default {
     menus: [
@@ -6,7 +7,12 @@ export default {
         { key: '/app/dashboard/index', title: '首页', icon: 'mobile', component: 'Dashboard' },
         {
             key: '/app/config', title: '配置中心', icon: 'mobile',
-            subs: [{ key: '/app/config/label', title: '属性标签', component: ConfigLabel}],
+            subs: [
+                { key: '/app/config/label', title: '属性标签', component: ConfigLabel },
+                { key: '/app/config/properties', title: '微服务配置', component: 'SystemProperties' },
+                { key: '/app/config/common', title: '通用配置', component: CommonConfig },
+            ],
+
         },
         {
             key: '/app/ui',

+ 4 - 2
src/routes/index.js

@@ -2,12 +2,14 @@
  * Created by 叶子 on 2017/8/13.
  */
 import React, { Component } from 'react';
-import { Route, Redirect, Switch } from 'react-router-dom';
+import { Redirect, Route, Switch } from 'react-router-dom';
 import DocumentTitle from 'react-document-title';
-import AllComponents from '../components';
+import Components from '../components';
+import AllPages from '../pages';
 import routesConfig from './config';
 import queryString from 'query-string';
 
+let AllComponents = { ...Components, ...AllPages };
 export default class CRouter extends Component {
     requireAuth = (permission, component) => {
         const { auth } = this.props;

+ 9 - 0
yarn.lock

@@ -7188,6 +7188,15 @@ prop-types@^15.6.1, prop-types@~15.6.0:
     loose-envify "^1.3.1"
     object-assign "^4.1.1"
 
+prop-types@latest:
+  version "15.7.2"
+  resolved "https://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
+  integrity sha1-UsQedbjIfnK52TYOAga5ncv/psU=
+  dependencies:
+    loose-envify "^1.4.0"
+    object-assign "^4.1.1"
+    react-is "^16.8.1"
+
 proxy-addr@~2.0.3:
   version "2.0.4"
   resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93"