mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-12 15:10:23 +08:00
opti: 整体布局调整
This commit is contained in:
parent
bb361200e6
commit
2873eb650e
@ -17,14 +17,14 @@ export default class Group extends Component {
|
||||
render () {
|
||||
|
||||
const GroupContent = (
|
||||
<Layout>
|
||||
<Sider style={{ height: 'auto', marginLeft: '24px', marginTop: '24px' }} width={300}>
|
||||
<Layout style={{minHeight: 'calc(100vh - 100px)', marginLeft: '24px', marginTop: '24px'}}>
|
||||
<Sider style={{ height: '100%', overflowY: 'scroll'}} width={300}>
|
||||
<div className="logo" />
|
||||
<GroupList></GroupList>
|
||||
</Sider>
|
||||
<Layout>
|
||||
<Content style={{ margin: '24px 24px 0 16px', overflow: 'initial' }}>
|
||||
<Tabs type="card" className="m-tab">
|
||||
<Content style={{ height: '100%', margin: '0 24px 0 16px', overflow: 'initial',backgroundColor: '#fff'}}>
|
||||
<Tabs type="card" className="m-tab" style={{height: '100%'}}>
|
||||
<TabPane tab="项目列表" key="1"><ProjectList/></TabPane>
|
||||
<TabPane tab="成员列表" key="2"><MemberList/></TabPane>
|
||||
</Tabs>
|
||||
|
@ -82,8 +82,8 @@ class Interface extends Component {
|
||||
const activeKey = action === 'api' ? 'api' : 'colOrCase';
|
||||
// console.log(matchPath(this.props.location.pathname, contentRouter));
|
||||
return (
|
||||
<Layout style={{marginTop: '-24px'}}>
|
||||
<Sider style={{ height: 'auto', marginLeft: '24px', marginTop: '24px' }} width={300}>
|
||||
<Layout style={{minHeight: 'calc(100vh - 156px)', marginLeft: '24px', marginTop: '24px'}}>
|
||||
<Sider style={{ height: '100%', overflowY: 'scroll'}} width={300}>
|
||||
<div className="left-menu">
|
||||
<Tabs type="card" activeKey={activeKey} onChange={this.onChange}>
|
||||
<Tabs.TabPane tab="接口列表" key="api">
|
||||
@ -96,7 +96,7 @@ class Interface extends Component {
|
||||
</div>
|
||||
</Sider>
|
||||
<Layout>
|
||||
<Content style={{ margin: '24px 24px 0 16px', overflow: 'initial' }}>
|
||||
<Content style={{ height: '100%', margin: '0 24px 0 16px', overflow: 'initial',backgroundColor: '#fff'}}>
|
||||
<div className="right-content">
|
||||
<Switch>
|
||||
<Route exact path="/project/:id/interface/:action" component={InterfaceRoute} />
|
||||
|
@ -100,14 +100,16 @@ class InterfaceList extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
changeInterfaceStatus = (e) => {
|
||||
console.log(e);
|
||||
// this.props.changeMemberRole({ id, member_uid, role }).then((res) => {
|
||||
// if (!res.payload.data.errcode) {
|
||||
// message.success(res.payload.data.errmsg);
|
||||
// this.reFetchList(); // 添加成功后重新获取分组成员列表
|
||||
// }
|
||||
// });
|
||||
changeInterfaceStatus = async (value) => {
|
||||
const params = {
|
||||
id: value.split('-')[0],
|
||||
status: value.split('-')[1]
|
||||
};
|
||||
let result = await axios.post('/api/interface/up', params);
|
||||
if (result.data.errcode === 0) {
|
||||
message.success('修改成功');
|
||||
this.handleRequest(this.props);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -148,11 +150,11 @@ class InterfaceList extends Component {
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 14,
|
||||
render: (item) => {
|
||||
console.log(item);
|
||||
return <Select value={item} className="select" onChange={this.changeInterfaceStatus}>
|
||||
<Option value={'done'}><span className="tag-status done">已完成</span></Option>
|
||||
<Option value={'undone'}><span className="tag-status undone">未完成</span></Option>
|
||||
render: (text, record) => {
|
||||
const key = record.key;
|
||||
return <Select value={key + '-' + text} className="select" onChange={this.changeInterfaceStatus}>
|
||||
<Option value={key + '-done'}><span className="tag-status done">已完成</span></Option>
|
||||
<Option value={key + '-undone'}><span className="tag-status undone">未完成</span></Option>
|
||||
</Select>
|
||||
},
|
||||
filters: [{
|
||||
|
@ -222,7 +222,6 @@ class View extends Component {
|
||||
})
|
||||
})
|
||||
}
|
||||
console.log(this.props);
|
||||
const req_dataSource = [];
|
||||
if(this.props.curData.req_params&&this.props.curData.req_params.length){
|
||||
this.props.curData.req_params.map((item,i)=>{
|
||||
@ -289,7 +288,7 @@ class View extends Component {
|
||||
if(!methodColor) methodColor = "get";
|
||||
let res = <div className="caseContainer">
|
||||
<h2 className="interface-title" style={{ marginTop: 0 }}>基本信息</h2>
|
||||
<div className="panel-sub">
|
||||
<div className="panel-view">
|
||||
<Row className="row">
|
||||
<Col span={4} className="colKey">接口名称:</Col>
|
||||
<Col span={8}>{this.props.curData.title}</Col>
|
||||
|
@ -106,7 +106,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.panel-sub {
|
||||
.panel-view {
|
||||
.row {
|
||||
margin-bottom: .16rem;
|
||||
line-height: 36px;
|
||||
|
@ -147,7 +147,6 @@
|
||||
}
|
||||
|
||||
.right-content{
|
||||
margin:3px;
|
||||
min-height: 5rem;
|
||||
background: #fff;
|
||||
.interface-content{
|
||||
@ -173,6 +172,7 @@
|
||||
margin-bottom: .16rem;
|
||||
}
|
||||
.panel-sub {
|
||||
background: rgba(236, 238, 241, 0.67);
|
||||
padding: .16rem;
|
||||
}
|
||||
.ant-radio-button-wrapper-checked {
|
||||
|
@ -81,6 +81,11 @@ em {
|
||||
height: 2.4rem;
|
||||
}
|
||||
}
|
||||
.m-tab {
|
||||
.ant-tabs-nav-wrap {
|
||||
background-color: #eceef1;
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
|
@ -357,28 +357,39 @@ class interfaceController extends baseController {
|
||||
}
|
||||
|
||||
let interfaceData = await this.Model.get(id);
|
||||
if(!interfaceData){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '不存在的接口');
|
||||
}
|
||||
let auth = await this.checkAuth(interfaceData.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
let data = {
|
||||
up_time: yapi.commons.time()
|
||||
};
|
||||
|
||||
if(params.path){
|
||||
let http_path = url.parse(params.path, true);
|
||||
|
||||
let http_path = url.parse(params.path, true);
|
||||
|
||||
if (!yapi.commons.verifyPath(http_path.pathname)) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
|
||||
if (!yapi.commons.verifyPath(http_path.pathname)) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
|
||||
}
|
||||
params.query_path = {};
|
||||
params.query_path.path = http_path.pathname;
|
||||
params.query_path.params = [];
|
||||
Object.keys(http_path.query).forEach((item) => {
|
||||
params.query_path.params.push({
|
||||
name: item,
|
||||
value: http_path.query[item]
|
||||
})
|
||||
})
|
||||
data.query_path = params.query_path
|
||||
}
|
||||
|
||||
params.query_path = {};
|
||||
params.query_path.path = http_path.pathname;
|
||||
params.query_path.params = [];
|
||||
Object.keys(http_path.query).forEach((item) => {
|
||||
params.query_path.params.push({
|
||||
name: item,
|
||||
value: http_path.query[item]
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if (params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method)) {
|
||||
let checkRepeat = await this.Model.checkRepeat(interfaceData.project_id, params.path, params.method);
|
||||
@ -387,10 +398,7 @@ class interfaceController extends baseController {
|
||||
}
|
||||
}
|
||||
|
||||
let data = {
|
||||
up_time: yapi.commons.time(),
|
||||
query_path: params.query_path
|
||||
};
|
||||
|
||||
|
||||
if (!_.isUndefined(params.path)) {
|
||||
data.path = params.path;
|
||||
@ -416,12 +424,15 @@ class interfaceController extends baseController {
|
||||
if (!_.isUndefined(params.req_body_form)) {
|
||||
data.req_body_form = params.req_body_form;
|
||||
}
|
||||
if (params.req_params && Array.isArray(params.req_params) && params.req_params.length > 0) {
|
||||
if (!_.isUndefined(params.req_params) && Array.isArray(params.req_params) && params.req_params.length > 0) {
|
||||
if(Array.isArray(params.req_params) && params.req_params.length > 0){
|
||||
data.type = 'var'
|
||||
data.req_params = params.req_params;
|
||||
} else {
|
||||
}else{
|
||||
data.type = 'static'
|
||||
data.req_params = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!_.isUndefined(params.req_query)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user