diff --git a/client/containers/Project/Setting/ProjectMember/ProjectMember.js b/client/containers/Project/Setting/ProjectMember/ProjectMember.js
index 663133cc..0dd368f8 100755
--- a/client/containers/Project/Setting/ProjectMember/ProjectMember.js
+++ b/client/containers/Project/Setting/ProjectMember/ProjectMember.js
@@ -6,7 +6,7 @@ import { fetchGroupMsg } from '../../../../reducer/modules/group';
import { connect } from 'react-redux';
import ErrMsg from '../../../../components/ErrMsg/ErrMsg.js';
import { fetchGroupMemberList } from '../../../../reducer/modules/group.js';
-import { getProjectMsg, getProjectMemberList, addMember, delMember, changeMemberRole } from '../../../../reducer/modules/project.js';
+import { getProjectMsg, getProjectMemberList,getProject, addMember, delMember, changeMemberRole } from '../../../../reducer/modules/project.js';
import UsernameAutoComplete from '../../../../components/UsernameAutoComplete/UsernameAutoComplete.js';
import '../Setting.scss';
@@ -24,7 +24,7 @@ const arrayAddKey = (arr) => {
@connect(
state => {
return {
- projectMsg: state.project.projectMsg,
+ projectMsg: state.project.currProject,
uid: state.user.uid
}
},
@@ -35,7 +35,8 @@ const arrayAddKey = (arr) => {
addMember,
delMember,
fetchGroupMsg,
- changeMemberRole
+ changeMemberRole,
+ getProject
}
)
class ProjectMember extends Component {
@@ -49,16 +50,18 @@ class ProjectMember extends Component {
visible: false,
dataSource: [],
inputUid: 0,
- inputRole: 'dev'
+ inputRole: 'dev'
}
}
static propTypes = {
+ match: PropTypes.object,
projectId: PropTypes.number,
projectMsg: PropTypes.object,
uid: PropTypes.number,
addMember: PropTypes.func,
delMember: PropTypes.func,
changeMemberRole: PropTypes.func,
+ getProject: PropTypes.func,
fetchGroupMemberList: PropTypes.func,
getProjectMsg: PropTypes.func,
fetchGroupMsg: PropTypes.func,
@@ -74,7 +77,7 @@ class ProjectMember extends Component {
// 重新获取列表
@autobind
reFetchList() {
- this.props.getProjectMemberList(this.props.projectId).then((res) => {
+ this.props.getProjectMemberList(this.props.match.params.id).then((res) => {
this.setState({
projectMemberList: arrayAddKey(res.payload.data.data),
visible: false
@@ -86,7 +89,7 @@ class ProjectMember extends Component {
@autobind
handleOk() {
this.props.addMember({
- id: this.props.projectId,
+ id: this.props.match.params.id,
member_uid: this.state.inputUid,
role: this.state.inputRole
}).then((res) => {
@@ -108,7 +111,7 @@ class ProjectMember extends Component {
@autobind
deleteConfirm(member_uid) {
return () => {
- const id = this.props.projectId;
+ const id = this.props.match.params.id;
this.props.delMember({ id, member_uid }).then((res) => {
if (!res.payload.data.errcode) {
message.success(res.payload.data.errmsg);
@@ -121,7 +124,7 @@ class ProjectMember extends Component {
// 改 - 修改成员权限
@autobind
changeUserRole(e) {
- const id = this.props.projectId;
+ const id = this.props.match.params.id;
const role = e.split('-')[0];
const member_uid = e.split('-')[1];
this.props.changeMemberRole({ id, member_uid, role }).then((res) => {
@@ -147,11 +150,12 @@ class ProjectMember extends Component {
})
}
- async componentWillMount() {
+ async componentWillMount() {
+ await this.props.getProject(this.props.match.params.id)
const groupMemberList = await this.props.fetchGroupMemberList(this.props.projectMsg.group_id);
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
- const rojectMsg = await this.props.getProjectMsg(this.props.projectId);
- const projectMemberList = await this.props.getProjectMemberList(this.props.projectId);
+ const rojectMsg = await this.props.getProjectMsg(this.props.match.params.id);
+ const projectMemberList = await this.props.getProjectMemberList(this.props.match.params.id);
this.setState({
groupMemberList: groupMemberList.payload.data.data,
groupName: groupMsg.payload.data.data.group_name,
@@ -201,7 +205,7 @@ class ProjectMember extends Component {
}
}];
return (
-
+
)
diff --git a/server/controllers/interface.js b/server/controllers/interface.js
index f2e01464..55d250fc 100755
--- a/server/controllers/interface.js
+++ b/server/controllers/interface.js
@@ -654,28 +654,30 @@ class interfaceController extends baseController {
/**
- * 获取分类列表
- * @interface /interface/getCatMenu
- * @method GET
- * @category interface
- * @foldnumber 10
- * @param {Number} project_id 项目id,不能为空
- * @returns {Object}
- * @example ./api/interface/getCatMenu
- */
+ * 获取分类列表
+ * @interface /interface/getCatMenu
+ * @method GET
+ * @category interface
+ * @foldnumber 10
+ * @param {Number} project_id 项目id,不能为空
+ * @returns {Object}
+ * @example ./api/interface/getCatMenu
+ */
async getCatMenu(ctx) {
let project_id = ctx.request.query.project_id;
- if (!project_id) {
+
+ if (!project_id || !isNaN(project_id)) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
}
- let project = await this.projectModel.getBaseInfo(project_id);
- if (project.project_type === 'private') {
- if (await this.checkAuth(project._id, 'project', 'edit') !== true) {
- return ctx.body = yapi.commons.resReturn(null, 406, '没有权限');
- }
- }
+
try {
+ let project = await this.projectModel.getBaseInfo(project_id);
+ if (project.project_type === 'private') {
+ if (await this.checkAuth(project._id, 'project', 'edit') !== true) {
+ return ctx.body = yapi.commons.resReturn(null, 406, '没有权限');
+ }
+ }
let res = await this.catModel.list(project_id);
return ctx.body = yapi.commons.resReturn(res);
} catch (e) {