xy 7 лет назад
Родитель
Сommit
d3b5e03726

+ 2 - 3
src/app/graphqlService/common/deploy/tencent/APIGroupCard.js

@@ -2,12 +2,11 @@ import React, {Component} from 'react';
 import {Input, Collapse, Button, Radio, Icon} from 'antd';
 import {ADD_APIGROUP, UPDATE_APIGROUP} from "../../../../../gql";
 import {request} from 'graphql-request'
+import {idGen} from "../../../../../func";
 
 const Panel = Collapse.Panel;
 
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+
 
 class APIGroupCard extends Component {
     constructor(props) {

+ 2 - 3
src/app/graphqlService/common/deploy/tencent/APIPathCard.js

@@ -2,12 +2,11 @@ import React, {Component} from 'react';
 import {Input, Radio, Collapse, Button, Icon} from 'antd';
 import {request} from 'graphql-request'
 import {ADD_APIGWPATH, UPDATE_APIGWPATH} from "../../../../../gql";
+import {idGen} from "../../../../../func";
 
 const Panel = Collapse.Panel;
 
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+
 
 class APIPathCard extends Component {
     constructor(props) {

+ 2 - 3
src/app/graphqlService/common/deploy/tencent/DeployCard.js

@@ -2,12 +2,11 @@ import React, {Component} from 'react';
 import {Input, Radio, Collapse, Button, Icon} from 'antd';
 import {ADD_DEPLOY, UPDATE_DEPLOY} from "../../../../../gql";
 import {request} from 'graphql-request'
+import {idGen} from "../../../../../func";
 
 const Panel = Collapse.Panel;
 
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+
 
 class DeployCard extends Component {
     constructor(props) {

+ 1 - 4
src/app/graphqlService/common/schema/Create.js

@@ -8,10 +8,7 @@ import gql from "graphql-tag";
 import {SHOW_SCHEMA, ADD_SCHEMA} from '../../../../gql'
 import './index.css';
 import {getCookie} from "../../../../cookie";
-
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+import {idGen} from "../../../../func";
 
 class Create extends Component {
     constructor(props) {

+ 1 - 3
src/app/graphqlService/common/schema/Schema.jsx

@@ -16,13 +16,11 @@ import {
 import Table from "./Table";
 import {request} from 'graphql-request'
 import {getCookie} from "../../../../cookie";
+import {idGen} from "../../../../func";
 
 const confirm = Modal.confirm;
 const Search = Input.Search;
 
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
 
 class Schema extends Component {
     constructor(props) {

+ 1 - 4
src/app/wechatService/WxConfig.jsx

@@ -1,10 +1,7 @@
 import React, {Component} from 'react';
 import {Input, Radio, Collapse, Button, Icon} from 'antd';
 import './index.css';
-
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+import {idGen} from "../../func";
 
 class WxConfig extends Component {
 

+ 1 - 4
src/app/wechatService/WxCreate.js

@@ -8,10 +8,7 @@ import gql from "graphql-tag";
 import {ADD_WXCONFIG, SHOW_WXCONFIG} from '../../gql'
 import './index.css';
 import {getCookie} from "../../cookie";
-
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+import {idGen} from "../../func";
 
 class WxCreate extends Component {
     constructor(props) {

+ 3 - 0
src/func.js

@@ -0,0 +1,3 @@
+export const idGen = (kind) => {
+    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
+};

+ 1 - 4
src/login/CloudConfig.js

@@ -4,10 +4,7 @@ import {Button, Input, Spin, Icon} from 'antd';
 import {SHOW_CLOUD, ADD_CLOUD, UPDATE_CLOUD} from "../gql";
 import {request} from 'graphql-request'
 import {getCookie} from '../cookie';
-
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
+import {idGen} from "../func";
 
 class CloudConfig extends Component {
     constructor(props) {

+ 1 - 5
src/login/LoginInput.js

@@ -8,16 +8,12 @@ import {request} from 'graphql-request'
 import gql from "graphql-tag";
 // todo: _.debounce 的引入
 import _ from 'lodash';
-
+import {idGen} from "../func";
 import {setCookie} from "../cookie";
 
 axios.defaults.withCredentials = true;
 
 
-const idGen = (kind) => {
-    return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
-};
-
 class LoginInput extends Component {
     constructor() {
         super();