This commit is contained in:
喻希里 2017-09-26 10:26:44 +08:00
commit e1a4c6da6c
7 changed files with 1950 additions and 2098 deletions

View File

@ -101,6 +101,9 @@ export default class GroupList extends Component {
});
} else {
this.setState({
newGroupName: '',
group_name: '',
owner_uid: 0,
addGroupModalVisible: false
});
}
@ -111,6 +114,9 @@ export default class GroupList extends Component {
const res = await axios.post('/api/group/add', { group_name, group_desc, owner_uid })
if (!res.data.errcode) {
this.setState({
newGroupName: '',
group_name: '',
owner_uid: 0,
addGroupModalVisible: false
});
await this.props.fetchGroupList();

View File

@ -108,11 +108,12 @@ class ProjectList extends Component {
</Col>
<Col>
<Tooltip title="您没有权限,请联系该分组组长或管理员">
{ /(admin)|(owner)|(dev)/.test(this.props.currGroup.role) ?
<Button type="primary" ><Link to="/add-project">添加项目</Link></Button> :
<Button type="primary" disabled >添加项目</Button>}
</Tooltip>
{/(admin)|(owner)|(dev)/.test(this.props.currGroup.role) ?
<Button type="primary" ><Link to="/add-project">添加项目</Link></Button> :
<Tooltip title="您没有权限,请联系该分组组长或管理员">
<Button type="primary" disabled >添加项目</Button>
</Tooltip>}
</Col>
@ -120,7 +121,7 @@ class ProjectList extends Component {
<Row gutter={16}>
{projectData.length ? projectData.map((item, index) => {
return (
<Col span={6} key={index}>
<Col xs={8} md={6} xl={4} key={index}>
<ProjectCard projectData={item} callbackResult={this.receiveRes} />
</Col>);
}) : <ErrMsg type="noProject" />}

View File

@ -111,6 +111,7 @@ class InterfaceEditForm extends Component {
req_radio_type: 'req-query'
}, curdata)
console.log(this.state.path)
}
handleSubmit = (e) => {
@ -182,17 +183,17 @@ class InterfaceEditForm extends Component {
onChangeMethod = (val) => {
let radio = [];
if(HTTP_METHOD[val].request_body){
if (HTTP_METHOD[val].request_body) {
radio = ['req', 'body'];
}else{
} else {
radio = ['req', 'query'];
}
this.setState({
req_radio_type: radio.join("-")
})
this.setState({ method: val }, ()=>{
this._changeRadioGroup(radio[0] , radio[1])
this.setState({ method: val }, () => {
this._changeRadioGroup(radio[0], radio[1])
})
}
@ -290,7 +291,7 @@ class InterfaceEditForm extends Component {
// 点击切换radio
changeRadioGroup = (e) => {
const res = e.target.value.split('-');
if(res[0] === 'req'){
if (res[0] === 'req') {
this.setState({
req_radio_type: e.target.value
})
@ -537,7 +538,10 @@ class InterfaceEditForm extends Component {
label={(
<span>
接口路径&nbsp;
<Tooltip title="接口路径,支持动态路由,例如:'/api/user/:id'">
<Tooltip title={<div>
<p>1. 支持动态路由,例如:/api/user/:id</p>
<p>2. 支持 ?controller=xxx 的QueryRouter,非router的Query参数请定义到 Request设置-&#62;Query</p>
</div>}>
<Icon type="question-circle-o" style={{ width: "10px" }} />
</Tooltip>
@ -560,10 +564,9 @@ class InterfaceEditForm extends Component {
required: true, message: '请输入接口路径!'
}]
})(
<Tooltip title="支持类似 ?controller=xxx&action=xxx 的QueryRouter 默认接口Query参数请定义到 Request设置 -> Query ">
<Input onChange={this.handlePath} placeholder="/path" style={{ width: '60%' }} />
</Tooltip>
<Input onChange={this.handlePath} placeholder="/path" style={{ width: '60%' }} />
)}
</InputGroup>
<Row className="interface-edit-item">
<Col span={24} offset={0}>

View File

@ -189,7 +189,7 @@ class InterfaceMenu extends Component {
that.props.history.push('/project/' + that.props.match.params.id + '/interface/api')
},
async onCancel() {
onCancel() {
ref.destroy()
}
});

3982
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "yapi",
"version": "1.0.1",
"version": "1.0.2",
"description": "YAPI",
"main": "index.js",
"scripts": {
@ -20,7 +20,6 @@
"assets-webpack-plugin": "^3.5.1",
"axios": "^0.16.2",
"babel": "^6.5.2",
"babel-cli": "^6.24.1",
"babel-core": "^6.8.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^6.2.4",
@ -56,7 +55,6 @@
"jsonwebtoken": "^7.4.1",
"koa": "^2.0.0",
"koa-bodyparser": "^3.2.0",
"koa-logger": "^3.0.0",
"koa-multer": "^1.0.2",
"koa-mysql-session": "0.0.2",
"koa-router": "^7.0.1",
@ -99,7 +97,7 @@
"url": "^0.11.0",
"validate-commit-msg": "^2.12.2",
"wangeditor": "^3.0.8",
"webpack": "^3.5.5",
"webpack": "^2.2.0",
"webpack-dev-middleware": "^1.12.0",
"ykit-config-antd": "^0.1.3",
"ykit-config-es6": "^1.1.0"

View File

@ -67,14 +67,18 @@ class groupController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '项目分组名不能为空');
}
if (!params.owner_uid) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长');
}
// if (!params.owner_uid) {
// return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长');
// }
let groupUserdata = await this.getUserdata(params.owner_uid, 'owner');
if (groupUserdata === null) {
return ctx.body = yapi.commons.resReturn(null, 400, '组长uid不存在')
let groupUserdata = null;
if (params.owner_uid) {
groupUserdata = await this.getUserdata(params.owner_uid, 'owner');
if (groupUserdata === null) {
return ctx.body = yapi.commons.resReturn(null, 400, '组长uid不存在')
}
}
let groupInst = yapi.getInst(groupModel);
let checkRepeat = await groupInst.checkRepeat(params.group_name);
@ -89,7 +93,7 @@ class groupController extends baseController {
uid: this.getUid(),
add_time: yapi.commons.time(),
up_time: yapi.commons.time(),
members: [groupUserdata]
members: groupUserdata ? [groupUserdata] : []
};
try {