Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
suxiaoxin 2017-10-10 20:26:25 +08:00
commit 2b8141a3d1
9 changed files with 30 additions and 13 deletions

View File

@ -34,7 +34,7 @@ const tipAdd = (<div className="title-container">
</div>);
const tipDoc = (<div className="title-container">
<h3 className="title">使用文档 <Tag color="orange">推荐!</Tag></h3>
<p>初次使用 YApi强烈建议你阅读 <a target="_blank" href="https://ued.qunar.com/yapi/" rel="noopener noreferrer">使用文档</a> 使 </p>
<p>初次使用 YApi强烈建议你阅读 <a target="_blank" href="https://yapi.ymfe.org/" rel="noopener noreferrer">使用文档</a> 使 </p>
</div>);
MenuUser.propTypes={
@ -93,7 +93,7 @@ const ToolUser = (props)=> {
>
<Tooltip placement="bottom" title={'使用文档'}>
<li className="toolbar-li">
<a target="_blank" href="https://ued.qunar.com/yapi/" rel="noopener noreferrer"><Icon className="dropdown-link" style={{ fontSize: 16 }} type="question-circle" /></a>
<a target="_blank" href="https://yapi.ymfe.org/" rel="noopener noreferrer"><Icon className="dropdown-link" style={{ fontSize: 16 }} type="question-circle" /></a>
</li>
</Tooltip>
</Popover>

View File

@ -24,7 +24,7 @@ const HomeGuest = () => (
<Col span={24}>
<div className="home-header">
<a href="#" className="item">YAPI</a>
<a target="_blank" rel="noopener noreferrer" href="https://ued.qunar.com/yapi/" className="item">使用文档</a>
<a target="_blank" rel="noopener noreferrer" href="https://yapi.ymfe.org/" className="item">使用文档</a>
</div>
</Col>
</Row>
@ -210,7 +210,7 @@ class Home extends Component {
<div className="tip-btns">
<div className="btn-group">
<Link to="/login"><Button type="primary" className="btn-home btn-login">登录 / 注册</Button></Link>
<Button className="btn-home btn-home-normal"><a target="_blank" rel="noopener noreferrer" href="https://ued.qunar.com/yapi/" >使用文档</a></Button>
<Button className="btn-home btn-home-normal"><a target="_blank" rel="noopener noreferrer" href="https://yapi.ymfe.org/" >使用文档</a></Button>
</div>
</div>
</div>

View File

@ -734,7 +734,7 @@ class InterfaceEditForm extends Component {
</Tabs>
<div>
<h3 style={{ padding: '10px 0' }}>基于mockjs和json5,可直接写mock模板和注释,具体使用方法请 <span className="href" onClick={() => window.open('https://ued.qunar.com/yapi/mock.html', '_blank')}>查看文档</span></h3>
<h3 style={{ padding: '10px 0' }}>基于mockjs和json5,可直接写mock模板和注释,具体使用方法请 <span className="href" onClick={() => window.open('https://yapi.ymfe.org/mock.html', '_blank')}>查看文档</span></h3>
<div id="res_body_json" style={{ minHeight: "300px", display: this.state.jsonType === 'tpl' ? 'block' : 'none' }} ></div>
<div id="mock-preview" style={{ backgroundColor: "#eee", lineHeight: "20px", minHeight: "300px", display: this.state.jsonType === 'preview' ? 'block' : 'none' }}></div>
</div>

View File

@ -135,7 +135,7 @@ class PrpjectEnv extends Component {
const envSettingItems = envs.map((k, index) => {
const secondIndex = 'next' + index; // 为保证key的唯一性
return (
<Row key={index} type="flex" justify="space-between" align={index === 0 ? 'middle' : 'top'}>
<Row key={index} type="flex" justify="space-between" className={index === 0 ? 'env-first-row' : null} align={index === 0 ? 'bottom' : 'top'}>
<Col span={11}>
<FormItem
label={index === 0 ? (
@ -227,7 +227,7 @@ class PrpjectEnv extends Component {
);
});
return (
<div className="m-panel">
<div className="m-panel env">
<div className="panel-title">
<h2 className="title">在这里添加项目的环境配置</h2>
<p className="desc">你可以添加多个环境用于区分不同的使用场景</p>

View File

@ -192,3 +192,10 @@
}
}
}
.env-first-row {
.ant-col-2 {
position: relative;
bottom: .16rem;
}
}

View File

@ -293,7 +293,13 @@ class groupController extends baseController {
try {
let groupInst = yapi.getInst(groupModel);
let group = await groupInst.get(params.id);
ctx.body = yapi.commons.resReturn(group.members);
const members = [];
for(let i = 0, len = group.members.length; i < len; i++) {
let item = group.members[i];
let member = await this.getUserdata(item.uid, item.role)
members.push(member)
}
ctx.body = yapi.commons.resReturn(members);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}

View File

@ -306,7 +306,13 @@ class projectController extends baseController {
try {
let project = await this.Model.get(params.id);
ctx.body = yapi.commons.resReturn(project.members);
const members = [];
for(let i = 0, len = project.members.length; i < len; i++) {
let item = project.members[i];
let member = await this.getUserdata(item.uid, item.role)
members.push(member)
}
ctx.body = yapi.commons.resReturn(members);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}

View File

@ -17,9 +17,7 @@ class groupModel extends baseModel {
members: [
{
uid: Number,
role: {type: String, enum:['owner', 'dev']},
username: String,
email: String
role: {type: String, enum:['owner', 'dev']}
}
]
};

View File

@ -15,7 +15,7 @@ class projectModel extends baseModel {
group_id: { type: Number, required: true },
project_type: {type:String, required: true, enum: ['public', 'private']},
members: [
{uid: Number, role: {type: String, enum:['owner', 'dev']},username: String, email: String}
{uid: Number, role: {type: String, enum:['owner', 'dev']}}
],
env: [
{ name: String, domain: String }