dev_ec^2
hjm 5 years ago
parent 36be24af6d
commit ffeb362b78

@ -8,9 +8,11 @@ import axios from 'axios'
*/ */
function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) { function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) {
const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles) const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles)
useEffect(() => { // useEffect(() => {
setCheckBoxRoles(member_roles) // if (checkBoxRoles.length != member_roles.length) { // 死循环
}, [member_roles]) // setCheckBoxRoles(member_roles)
// }
// }, [member_roles])
function onCheckBoxChange(val) { function onCheckBoxChange(val) {
console.log(val) console.log(val)

@ -149,7 +149,7 @@ const buildColumns = (that,isParent) => {
return ( return (
<React.Fragment> <React.Fragment>
<WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除学生</WordsBtn> <WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除学生</WordsBtn>
<ChangeRolePop {record.member_roles && record.member_roles.length && <ChangeRolePop
courseId={courseId} courseId={courseId}
record={record} record={record}
member_roles={record.member_roles} member_roles={record.member_roles}
@ -157,7 +157,7 @@ const buildColumns = (that,isParent) => {
showNotification={that.props.showNotification} showNotification={that.props.showNotification}
getUserId={that.props.isUserid} getUserId={that.props.isUserid}
fetchUser={that.props.fetchUser} fetchUser={that.props.fetchUser}
></ChangeRolePop> ></ChangeRolePop>}
</React.Fragment> </React.Fragment>
) )
}, },

Loading…
Cancel
Save