diff --git a/client/actions/addInterFace.js b/client/actions/addInterFace.js
deleted file mode 100644
index 4675fb63..00000000
--- a/client/actions/addInterFace.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import {
- FETCH_ADD_INTERFACE_INPUT,
- FETCH_ADD_INTERFACE_TAG_VALUE,
- FETCH_ADD_INTERFACE_HEADER_VALUE,
- ADD_INTERFACE_SEQ_HEADER,
- DELETE_INTERFACE_SEQ_HEADER,
- GET_INTERFACE_REQ_PARAMS,
- GET_INTERFACE_RES_PARAMS,
- PUSH_INTERFACE_NAME,
- PUSH_INTERFACE_METHOD
-} from '../constants/action-types.js'
-
-export function pushInputValue (value) {
- return {
- type: FETCH_ADD_INTERFACE_INPUT,
- payload: value
- };
-}
-
-export function reqTagValue (value) {
- return {
- type: FETCH_ADD_INTERFACE_TAG_VALUE,
- payload: value
- };
-}
-
-export function reqHeaderValue (value) {
- return {
- type: FETCH_ADD_INTERFACE_HEADER_VALUE,
- payload: value
- };
-}
-
-export function addReqHeader (value) {
- return {
- type: ADD_INTERFACE_SEQ_HEADER,
- payload: value
- };
-}
-
-export function deleteReqHeader (value) {
- return {
- type: DELETE_INTERFACE_SEQ_HEADER,
- payload: value
- };
-}
-
-export function getReqParams (value) {
- return {
- type: GET_INTERFACE_REQ_PARAMS,
- payload: value
- };
-}
-
-export function getResParams (value) {
- return {
- type: GET_INTERFACE_RES_PARAMS,
- payload: value
- };
-}
-
-export function pushInterfaceName (value) {
- return {
- type: PUSH_INTERFACE_NAME,
- payload: value
- }
-}
-
-export function pushInterfaceMethod (value) {
- return {
- type: PUSH_INTERFACE_METHOD,
- payload: value
- }
-}
diff --git a/client/actions/addInterface.js b/client/actions/addInterface.js
index 4675fb63..7437eb20 100644
--- a/client/actions/addInterface.js
+++ b/client/actions/addInterface.js
@@ -7,8 +7,10 @@ import {
GET_INTERFACE_REQ_PARAMS,
GET_INTERFACE_RES_PARAMS,
PUSH_INTERFACE_NAME,
- PUSH_INTERFACE_METHOD
+ PUSH_INTERFACE_METHOD,
+ FETCH_INTERFACE_PROJECT
} from '../constants/action-types.js'
+import axios from 'axios'
export function pushInputValue (value) {
return {
@@ -72,3 +74,10 @@ export function pushInterfaceMethod (value) {
payload: value
}
}
+
+export function fetchInterfaceProject(id) {
+ return {
+ type: FETCH_INTERFACE_PROJECT,
+ payload: axios.get('/project/get', { params: {id}})
+ }
+}
diff --git a/client/actions/login.js b/client/actions/login.js
index 6ea78871..bf967528 100644
--- a/client/actions/login.js
+++ b/client/actions/login.js
@@ -11,7 +11,6 @@ import axios from 'axios';
const checkLoginState = () => {
return(dispatch)=> {
axios.get('/user/status').then((res) => {
- console.log(res);
dispatch({
type: GET_LOGIN_STATE,
payload: res
diff --git a/client/components/Header/Search/Search.js b/client/components/Header/Search/Search.js
index 5e57b57a..84f5f1d3 100644
--- a/client/components/Header/Search/Search.js
+++ b/client/components/Header/Search/Search.js
@@ -31,7 +31,7 @@ export default class Srch extends Component{
}
onSelect = (value) => {
- if( value.split(":")[0] == "group" ){
+ if( value.split(":")[0] == "分组" ){
this.props.history.push('/group/'+value.split(":")[1].trim());
} else {
this.props.history.push('/project/'+value.split("(")[1].slice(0,-1));
@@ -45,7 +45,7 @@ export default class Srch extends Component{
const dataSource = [];
for(let title in res.data.data){
res.data.data[title].map(item => {
- title == "group" ? dataSource.push( title+": "+item.groupName ): dataSource.push( title+": "+item.name+"("+item._id+")" );
+ title == "group" ? dataSource.push( "分组"+": "+item.groupName ): dataSource.push( "项目"+": "+item.name+"("+item._id+")" );
})
}
this.setState({
@@ -84,8 +84,13 @@ export default class Srch extends Component{
>
}
- size="large" style={{ width: 200 }}
- placeholder="search group/project"
+ size="large"
+ style={{
+ // width: 200,
+ // borderColor:"#AAA",
+ // borderWidth:"1px",
+ }}
+ placeholder="搜索分组/项目"
className="search-input"
/>
diff --git a/client/components/Header/Search/Search.scss b/client/components/Header/Search/Search.scss
index 2a497729..5de982eb 100644
--- a/client/components/Header/Search/Search.scss
+++ b/client/components/Header/Search/Search.scss
@@ -2,10 +2,14 @@ $color-grey:#979DA7;
.search-wrapper{
.search-input{
- border:1px solid #AAA;
- background-color: rgba(255,255,255,0.5);
+ border:1px solid $color-grey;
+ color: $color-grey;
+ width: 2rem;
+ transition: width 2s;
+ //background-color:rgba(0,0,0,0.5);
}
.srch-icon{
color: $color-grey;
+ font-weight: bold;
}
}
diff --git a/client/constants/action-types.js b/client/constants/action-types.js
index 68173e59..12a7d58b 100644
--- a/client/constants/action-types.js
+++ b/client/constants/action-types.js
@@ -14,6 +14,7 @@ export const DELETE_INTERFACE_SEQ_HEADER = 'DELETE_INTERFACE_SEQ_HEADER'
export const GET_INTERFACE_REQ_PARAMS = 'GET_INTERFACE_REQ_PARAMS'
export const GET_INTERFACE_RES_PARAMS = 'GET_INTERFACE_RES_PARAMS'
export const PUSH_INTERFACE_METHOD = 'PUSH_INTERFACE_METHOD'
+export const FETCH_INTERFACE_PROJECT = 'FETCH_INTERFACE_PROJECT'
// group
export const FETCH_GROUP_LIST = 'FETCH_GROUP_LIST'
diff --git a/client/containers/AddInterface/AddInterface.js b/client/containers/AddInterface/AddInterface.js
index 5dfdb26e..14789991 100644
--- a/client/containers/AddInterface/AddInterface.js
+++ b/client/containers/AddInterface/AddInterface.js
@@ -10,13 +10,16 @@ import ReqHeader from './ReqHeader/ReqHeader.js'
import ReqParams from './ReqParams/ReqParams.js'
import ResParams from './ResParams/ResParams.js'
import Result from './Result/Result.js'
-import {
+import InterfaceTest from './InterfaceTest/InterfaceTest.js'
+import {
saveForms,
getResParams,
getReqParams,
addReqHeader,
pushInputValue,
- pushInterfaceName
+ pushInterfaceName,
+ fetchInterfaceProject,
+ pushInterfaceMethod
} from '../../actions/addInterface.js'
const success = () => {
@@ -40,7 +43,9 @@ const success = () => {
getResParams,
addReqHeader,
pushInputValue,
- pushInterfaceName
+ pushInterfaceName,
+ fetchInterfaceProject,
+ pushInterfaceMethod
}
)
@@ -105,12 +110,14 @@ class AddInterface extends Component {
editState (data) {
const props = this.props
- const { path, title, req_params_other, res_body, req_headers} = data
+ const { path, title, req_params_other, res_body, req_headers, project_id, method } = data
props.pushInputValue(path)
+ props.pushInterfaceMethod(method)
props.pushInterfaceName(title)
props.getReqParams(req_params_other)
props.getResParams(res_body)
props.addReqHeader(req_headers)
+ props.fetchInterfaceProject(project_id)
}
initInterfaceData (interfaceId) {
@@ -204,7 +211,9 @@ class AddInterface extends Component {
mock
- 测试
+
+
+
@@ -214,5 +223,3 @@ class AddInterface extends Component {
}
export default AddInterface
-
-
diff --git a/client/containers/AddInterface/InterfaceTest/InterfaceTest.js b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js
new file mode 100644
index 00000000..728d6279
--- /dev/null
+++ b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js
@@ -0,0 +1,120 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import { connect } from 'react-redux'
+import { Button, Input } from 'antd'
+import { autobind } from 'core-decorators';
+import crossRequest from 'cross-request';
+import { withRouter } from 'react-router';
+import URL from 'url';
+
+import {
+} from '../../../actions/group.js'
+
+import './InterfaceTest.scss'
+
+@connect(
+ state => ({
+ reqParams: state.addInterface.reqParams,
+ method: state.addInterface.method,
+ url: state.addInterface.url,
+ seqGroup: state.addInterface.seqGroup,
+ interfaceName: state.addInterface.interfaceName,
+ interfaceProject: state.addInterface.project
+ }),
+ {
+ }
+)
+@withRouter
+export default class InterfaceTest extends Component {
+
+ static propTypes = {
+ reqParams: PropTypes.string,
+ method: PropTypes.string,
+ url: PropTypes.string,
+ interfaceName: PropTypes.string,
+ seqGroup: PropTypes.array,
+ match: PropTypes.object,
+ interfaceProject: PropTypes.object
+ }
+
+ state = {
+ res: {},
+ header: {}
+ }
+
+ constructor(props) {
+ super(props)
+ }
+
+ componentWillMount() {
+
+ }
+
+ @autobind
+ testInterface() {
+ crossRequest({
+ url: 'http://petstore.swagger.io/v2/swagger.json',
+ method: 'GET',
+ data: {
+ a:1
+ },
+ success: (res, header) => {
+ this.setState({res})
+ console.log(header)
+ }
+ })
+ }
+
+
+ render () {
+ const { method, url, seqGroup, interfaceName, interfaceProject } = this.props;
+ const { prd_host, basepath, protocol } = interfaceProject;
+ const reqParams = JSON.parse(this.props.reqParams);
+ let query = {};
+
+ if (method === 'GET') {
+ Object.keys(reqParams).forEach(key => {
+ const value = typeof reqParams[key] === 'object' ? JSON.stringify(reqParams) : reqParams.toString();
+ query[key] = value;
+ })
+ }
+
+ const href = URL.format({
+ protocol: protocol || 'http',
+ host: prd_host,
+ pathname: URL.resolve(basepath, url),
+ query
+ });
+
+
+ return (
+
+
接口名:{interfaceName}
+
+
+
+ 返回结果:
+ {JSON.stringify(this.state.res, 2)}
+
+
+ )
+ }
+}
diff --git a/client/containers/AddInterface/InterfaceTest/InterfaceTest.scss b/client/containers/AddInterface/InterfaceTest/InterfaceTest.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/client/containers/Home/Home.js b/client/containers/Home/Home.js
index b7aac9b0..56383d10 100644
--- a/client/containers/Home/Home.js
+++ b/client/containers/Home/Home.js
@@ -40,7 +40,7 @@ const HomeGuest = (props) => (
(
-
+
@@ -66,7 +66,7 @@ const HomeGuest = (props) => (
接口管理
-
+
@@ -74,7 +74,7 @@ const HomeGuest = (props) => (
支持Mock
-
+
@@ -82,6 +82,14 @@ const HomeGuest = (props) => (
团队协作
+
+
+
+
+
+ 可部署
+
+
@@ -132,7 +140,7 @@ class Home extends Component {
YAPI
-
一个高效,易用,功能强大的api管理系统
+
一个高效,易用,可部署的Api管理系统