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 { trigger, WordsBtn } from 'educoder'
import { Input, Checkbox, Popconfirm } from "antd"; import { Input, Checkbox, Popconfirm } from "antd";
import axios from 'axios' import axios from 'axios'
@ -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)
@ -77,4 +79,4 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces
</Popconfirm> </Popconfirm>
) )
} }
export default ChangeRolePop export default memo(ChangeRolePop)

@ -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