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

This commit is contained in:
suxiaoxin 2017-09-29 15:55:45 +08:00
commit 963726708b
10 changed files with 42 additions and 36 deletions

View File

@ -17,8 +17,7 @@ const LOADING_STATUS = 0;
@connect(
state => {
return {
loginState: state.user.loginState,
study: state.user.study
loginState: state.user.loginState
};
},
{
@ -35,8 +34,7 @@ export default class App extends Component {
static propTypes = {
checkLoginState: PropTypes.func,
loginState: PropTypes.number,
study: PropTypes.bool
loginState: PropTypes.number
};
@ -73,7 +71,6 @@ export default class App extends Component {
</div>
</div>
<Footer/>
{!this.props.study ? <div className="study-mask"></div> : null}
</div>
</Router>

View File

@ -196,7 +196,7 @@ export default class HeaderCom extends Component {
</div>
</Link>
<Breadcrumb />
<div className="user-toolbar">
<div className="user-toolbar" style={{ position: 'relative', zIndex: this.props.studyTip === 1 ? 3 : 1}}>
{login?
<Popover
overlayClassName="popover-index"

View File

@ -278,9 +278,9 @@ export default class GroupList extends Component {
menu = null;
}
return (
<div className="m-group">
{!this.props.study ? <div className="study-mask"></div> : null}
<div className="group-bar">
<div className="curr-group">
<div className="curr-group-name">
@ -303,14 +303,14 @@ export default class GroupList extends Component {
>
{this.state.groupList.map((group) => {
if(group.type === 'private') {
return <Menu.Item key={`${group._id}`} className="group-item">
return <Menu.Item key={`${group._id}`} className="group-item" style={{zIndex: this.props.studyTip === 0 ? 3 : 1}}>
<Icon type="user" />
<Popover
overlayClassName="popover-index"
content={<GuideBtns/>}
title={tip}
placement="right"
visible={(this.props.studyTip === 0 && !this.props.study) ? true : false}
visible={(this.props.studyTip === 0) && !this.props.study}
>
{group.group_name}
</Popover>

View File

@ -132,7 +132,7 @@ class ProjectList extends Component {
placement="right"
visible={(this.props.studyTip === 2 && !this.props.study) ? true : false}
>
<Button type="primary" ><Link to="/add-project">添加项目</Link></Button>
<Button type="primary" style={{ position: 'relative', boxShadow: this.props.studyTip === 2 ? '0 0 2px 3px #fff' : '' , zIndex: this.props.studyTip === 2 ? 3 : 1}}><Link to="/add-project">添加项目</Link></Button>
</Popover> :
<Tooltip title="您没有权限,请联系该分组组长或管理员">
<Button type="primary" disabled >添加项目</Button>

View File

@ -300,12 +300,11 @@ class InterfaceColContent extends Component {
if (!interfaceColList.find(item => +item._id === +newColId)) {
this.props.history.push('/project/' + id + '/interface/col/' + interfaceColList[0]._id)
} else if (oldColId !== newColId) {
if (newColId && newColId != 0) {
if ((newColId && newColId != 0) || interfaceColList !== this.props.interfaceColList) {
await this.props.fetchCaseList(newColId);
this.props.setColData({ currColId: +newColId, isShowCol: true })
this.handleColdata(this.props.currCaseList)
}
}
}

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { connect } from 'react-redux';
import { withRouter } from 'react-router'
import PropTypes from 'prop-types'
import { fetchInterfaceColList, fetchInterfaceCaseList, setColData } from '../../../../reducer/modules/interfaceCol'
import { fetchInterfaceColList, fetchInterfaceCaseList, setColData, fetchCaseList } from '../../../../reducer/modules/interfaceCol'
import { fetchInterfaceList } from '../../../../reducer/modules/interface.js';
import axios from 'axios';
// import { Input, Icon, Button, Modal, message, Tooltip, Tree, Dropdown, Menu, Form } from 'antd';
@ -55,6 +55,7 @@ const ColModalForm = Form.create()((props) => {
fetchInterfaceColList,
fetchInterfaceCaseList,
fetchInterfaceList,
fetchCaseList,
setColData
}
)
@ -67,6 +68,7 @@ export default class InterfaceColMenu extends Component {
fetchInterfaceColList: PropTypes.func,
fetchInterfaceCaseList: PropTypes.func,
fetchInterfaceList: PropTypes.func,
fetchCaseList: PropTypes.func,
setColData: PropTypes.func,
history: PropTypes.object,
currColId: PropTypes.number,
@ -197,6 +199,7 @@ export default class InterfaceColMenu extends Component {
}
selectInterface = (importInterIds) => {
// console.log(importInterIds)
this.setState({ importInterIds })
}
@ -204,21 +207,25 @@ export default class InterfaceColMenu extends Component {
const projectId = this.props.match.params.id;
await this.props.fetchInterfaceList(projectId)
this.setState({ importInterVisible: true, importColId: colId })
// confirm({
// title: '导入接口到集合',
// content: <ImportInterface onSelect={this.selectInterface} list={this.props.list} />,
// onOk() {
// console.log(colId)
// console.log(this.state.importInterIds);
// },
// onCancel() {
// console.log('Cancel');
// },
// width: 800
// });
}
handleImportOk = () => {
this.setState({ importInterVisible: false })
handleImportOk = async () => {
const project_id = this.props.match.params.id;
const { importColId, importInterIds } = this.state;
const res = await axios.post('/api/col/add_case_list', {
interface_list: importInterIds,
col_id: importColId,
project_id
})
if (!res.data.errcode) {
this.setState({ importInterVisible: false })
message.success('导入集合成功');
await this.props.fetchInterfaceColList(project_id);
// if (this.props.isShowCol) {
// await this.props.fetchCaseList(this.props.currColId);
// }
} else {
message.error(res.data.errmsg);
}
}
handleImportCancel = () => {
this.setState({ importInterVisible: false })

View File

@ -1 +1 @@
module.exports = {qsso : require('plugins/yapi-plugin-qsso/client.js')}
module.exports = {}

View File

@ -31,7 +31,8 @@ const initialState = {
// name: '当前页面'
// }]
breadcrumb: [],
studyTip: 0
studyTip: 0,
study: false
};
export default (state = initialState, action) => {
@ -88,7 +89,8 @@ export default (state = initialState, action) => {
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username,
type: action.payload.data.data.type
type: action.payload.data.data.type,
study: action.payload.data.data ? action.payload.data.data.study : false
};
}
case SET_BREADCRUMB: {
@ -106,7 +108,8 @@ export default (state = initialState, action) => {
case FINISH_STUDY: {
return {
...state,
study: true
study: true,
studyTip: 0
};
}
default:

View File

@ -197,6 +197,6 @@ em {
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,.2);
z-index: 1;
background-color: rgba(0,0,0,.35);
z-index: 2;
}

View File

@ -306,8 +306,7 @@ class userController extends baseController {
role: 'member',
add_time: yapi.commons.time(),
up_time: yapi.commons.time(),
type: "site",
study: false
type: "site"
};
if (!data.username) {
@ -326,7 +325,8 @@ class userController extends baseController {
add_time: user.add_time,
up_time: user.up_time,
role: 'member',
type: user.type
type: user.type,
study: false
});
yapi.commons.sendMail({
to: user.email,