Skip to content

Commit

Permalink
Merge pull request YMFE#2 from YMFE/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
shouldnotappearcalm authored Apr 21, 2019
2 parents 92170de + 708d88a commit 08cfa2d
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 63 deletions.
4 changes: 2 additions & 2 deletions client/components/Postman/Postman.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ export default class Run extends Component {
)}
<span className="eq-symbol">=</span>
<Input
value={item.value}
value={item.value ? item.value : item.example}
className="value"
onChange={e => this.changeParam('req_query', e.target.value, index)}
placeholder="参数值"
Expand Down Expand Up @@ -825,7 +825,7 @@ export default class Run extends Component {
// />
) : (
<Input
value={item.value}
value={item.value ? item.value : item.example}
className="value"
onChange={e => this.changeBody(e.target.value, index)}
placeholder="参数值"
Expand Down
11 changes: 10 additions & 1 deletion client/containers/Project/Setting/Setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import ProjectToken from './ProjectToken/ProjectToken';
import ProjectMock from './ProjectMock/index.js';
import { connect } from 'react-redux';
const TabPane = Tabs.TabPane;
const plugin = require('client/plugin.js');

const routers = {}

import './Setting.scss';

Expand All @@ -23,7 +26,7 @@ class Setting extends Component {
};
render() {
const id = this.props.match.params.id;

plugin.emitHook('sub_setting_nav', routers);
return (
<div className="g-row">
<Tabs type="card" className="has-affix-footer tabs-large">
Expand All @@ -44,6 +47,12 @@ class Setting extends Component {
<TabPane tab="全局mock脚本" key="5">
<ProjectMock projectId={+id} />
</TabPane>
{Object.keys(routers).map(key=>{
const C = routers[key].component;
return <TabPane tab={routers[key].name} key={routers[key].name}>
<C projectId={+id} />
</TabPane>
})}
</Tabs>
</div>
);
Expand Down
13 changes: 13 additions & 0 deletions client/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ hooks = {
type: 'listener',
mulit: true,
listener: []
},
/*
* 添加项目设置 nav
* @param Object routers
*
* let routers = {
interface: { name: 'xxx', component: Xxx },
}
*/
sub_setting_nav:{
type: 'listener',
mulit: true,
listener: []
}
};

Expand Down
6 changes: 5 additions & 1 deletion common/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ module.exports = {
name: 'import-yapi-json'
},{
name: 'wiki'
}]
}
// {
// name: 'test'
// }
]
}
10 changes: 10 additions & 0 deletions exts/yapi-plugin-test/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function hander(routers) {
routers.test = {
name: 'test',
component: ()=> 'hello world.'
};
}

module.exports = function() {
this.bindHook('sub_setting_nav', hander);
};
4 changes: 4 additions & 0 deletions exts/yapi-plugin-test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
server: false,
client: true
}
98 changes: 49 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yapi-vendor",
"version": "1.5.11",
"version": "1.5.12",
"description": "YAPI",
"main": "server/app.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class baseController {
// }
// return (this.$tokenAuth = true);
// }

let checkId = await this.getProjectIdByToken(token);
if(!checkId){
ctx.body = yapi.commons.resReturn(null, 42014, 'token 无效');
Expand Down
Loading

0 comments on commit 08cfa2d

Please sign in to comment.