console.log(affixed)}>
+
diff --git a/client/containers/AddInterface/AddInterface.scss b/client/containers/AddInterface/AddInterface.scss
index 7a149baf..add49c33 100644
--- a/client/containers/AddInterface/AddInterface.scss
+++ b/client/containers/AddInterface/AddInterface.scss
@@ -244,6 +244,11 @@
}
#mock-clipboard {
margin: 3px 0 0 0;
+ background: #108ee9;
+ border-radius: 5px;
+ padding: 5px 20px;
+ border: none;
+ color: #FFF;
}
}
diff --git a/client/containers/AddInterface/MockUrl/MockUrl.js b/client/containers/AddInterface/MockUrl/MockUrl.js
index e114b744..1f7a6549 100644
--- a/client/containers/AddInterface/MockUrl/MockUrl.js
+++ b/client/containers/AddInterface/MockUrl/MockUrl.js
@@ -1,20 +1,34 @@
import '../AddInterface.scss'
import React, { Component } from 'react'
-import { Button, message } from 'antd'
+import { message } from 'antd'
import Clipboard from 'clipboard'
import PropTypes from 'prop-types'
+import { connect } from 'react-redux'
+import {
+ addInterfaceClipboard
+} from '../../../actions/addInterface.js'
const success = () => {
message.success('复制成功!')
}
+@connect(
+ () => {
+ return {}
+ },
+ {
+ addInterfaceClipboard
+ }
+)
+
class MockUrl extends Component {
static propTypes = {
mockURL: PropTypes.string,
serverIp: PropTypes.string,
mockData: PropTypes.string,
showMock: PropTypes.string,
- projectData: PropTypes.object
+ projectData: PropTypes.object,
+ addInterfaceClipboard: PropTypes.func
}
constructor(props) {
@@ -22,13 +36,15 @@ class MockUrl extends Component {
}
componentDidMount () {
+ this.props.addInterfaceClipboard(this.clipboard)
setTimeout(this.clipboard, 500)
}
clipboard () {
+ document.querySelector('#clipboard-button').innerHTML = ''
const btn = document.querySelector('#mock-clipboard')
const txt = document.querySelector('#mock-p').innerHTML
-
+
new Clipboard(btn, {
text: () => txt,
target () {
@@ -39,11 +55,12 @@ class MockUrl extends Component {
render () {
const { serverIp, showMock } = this.props
+
return (
mock地址 :
{this.props.mockURL}
-
+
{this.props.projectData.prd_host} { serverIp }
)
diff --git a/client/containers/AddInterface/ReqMethod/ReqMethod.js b/client/containers/AddInterface/ReqMethod/ReqMethod.js
index bc3ecbb0..2e36a805 100644
--- a/client/containers/AddInterface/ReqMethod/ReqMethod.js
+++ b/client/containers/AddInterface/ReqMethod/ReqMethod.js
@@ -66,9 +66,8 @@ class ReqMethod extends Component {
请求方式 :
diff --git a/client/reducer/addInterface/addInterface.js b/client/reducer/addInterface/addInterface.js
index 1f554aa1..28562eb0 100644
--- a/client/reducer/addInterface/addInterface.js
+++ b/client/reducer/addInterface/addInterface.js
@@ -8,7 +8,8 @@ import {
GET_INTERFACE_RES_PARAMS,
PUSH_INTERFACE_NAME,
PUSH_INTERFACE_METHOD,
- FETCH_INTERFACE_PROJECT
+ FETCH_INTERFACE_PROJECT,
+ ADD_INTERFACE_CLIPBOARD
} from '../../constants/action-types.js'
const initialState = {
@@ -25,7 +26,8 @@ const initialState = {
],
reqParams: '',
resParams: '',
- project: {}
+ project: {},
+ clipboard: () => {}
}
export default (state = initialState, action) => {
@@ -80,6 +82,11 @@ export default (state = initialState, action) => {
...state,
project: action.payload.data.data
}
+ case ADD_INTERFACE_CLIPBOARD:
+ return {
+ ...state,
+ clipboard: action.payload
+ }
default:
return state
}
|