修改当前用户角色

competitions
hjm 5 years ago
parent 8b65317d97
commit b2f406aa2f

@ -6,7 +6,7 @@ import axios from 'axios'
/**
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
*/
function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification }) {
function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) {
const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles)
useEffect(() => {
setCheckBoxRoles(member_roles)
@ -43,8 +43,13 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces
if (response.data.status == 0) {
showNotification('保存成功')
onChangeRoleSuccess()
if (fetchUser && record.user_id == getUserId) {
fetchUser()
trigger('updatabanner')
}
}
console.log(response)
}
const isAdmin = checkBoxRoles.indexOf('CREATOR') != -1

@ -155,6 +155,8 @@ const buildColumns = (that,isParent) => {
member_roles={record.member_roles}
onChangeRoleSuccess={that.onChangeRoleSuccess}
showNotification={that.props.showNotification}
getUserId={that.props.isUserid}
fetchUser={that.props.fetchUser}
></ChangeRolePop>
</React.Fragment>
)

@ -165,6 +165,9 @@ function buildColumns(that) {
member_roles={record.member_roles}
onChangeRoleSuccess={that.onChangeRoleSuccess}
showNotification={that.props.showNotification}
getUserId={that.props.isUserid}
fetchUser={that.props.fetchUser}
></ChangeRolePop>
{/* <Popconfirm
placement="bottom"

Loading…
Cancel
Save