Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_auth
杨树明 5 years ago
commit c90ed292cb

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, memo } from 'react'
import { trigger, WordsBtn } from 'educoder'
import { Input, Checkbox, Popconfirm } from "antd";
import axios from 'axios'
@ -8,9 +8,11 @@ import axios from 'axios'
*/
function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) {
const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles)
useEffect(() => {
setCheckBoxRoles(member_roles)
}, [member_roles])
// useEffect(() => {
// if (checkBoxRoles.length != member_roles.length) { // 死循环
// setCheckBoxRoles(member_roles)
// }
// }, [member_roles])
function onCheckBoxChange(val) {
console.log(val)
@ -77,4 +79,4 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces
</Popconfirm>
)
}
export default ChangeRolePop
export default memo(ChangeRolePop)

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

Loading…
Cancel
Save