|
|
@@ -20,6 +20,7 @@ import 'css/home-page.css'
|
|
|
import {fetchGet, fetchPost} from "../../utils/fetchRequest";
|
|
|
import {_baseURL, API} from "../../configs/api.config";
|
|
|
import icon_home_change from "../../style/imgs/icon_home_change.png";
|
|
|
+
|
|
|
let holly = 0
|
|
|
const operation = Modal.operation;
|
|
|
|
|
|
@@ -30,7 +31,6 @@ class HomePage extends Component {
|
|
|
|
|
|
this.state = {
|
|
|
studentIndex: 0,
|
|
|
- selectStuName:'',//被切换之后的选中的孩子
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -74,7 +74,6 @@ class HomePage extends Component {
|
|
|
if (this.props.userInfo.parent.student.stuId == item.stuId) {
|
|
|
this.setState({
|
|
|
studentIndex: index,
|
|
|
- selectStuName:this.props.userInfo.parent.student.stuName
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
@@ -251,8 +250,8 @@ class HomePage extends Component {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- this.setState({studentIndex:studentIndex,
|
|
|
- selectStuName:this.props.userInfo.parent.students[studentIndex].stuName
|
|
|
+ this.setState({
|
|
|
+ studentIndex: studentIndex,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -302,7 +301,7 @@ class HomePage extends Component {
|
|
|
if (userInfo.parent) {
|
|
|
schoolName = userInfo.parent.schoolName
|
|
|
// userName = userInfo.parent.parentsName
|
|
|
- userName = this.state.selectStuName
|
|
|
+ userName = userInfo.parent.student ? userInfo.parent.student.stuName : ''
|
|
|
}
|
|
|
} else if (userInfo.userRole === 2) {
|
|
|
if (userInfo.teacher) {
|
|
|
@@ -319,11 +318,11 @@ class HomePage extends Component {
|
|
|
</div>
|
|
|
{
|
|
|
userInfo.userRole === 1 ?
|
|
|
- <div className='home-student-layout-root' style={{display:'flex',flexDirection:'column'}}>
|
|
|
- <div className='home-top-msg-text'>{this.state.selectStuName +' | ' + schoolName}</div>
|
|
|
+ <div className='home-student-layout-root' style={{display: 'flex', flexDirection: 'column'}}>
|
|
|
+ <div className='home-top-msg-text'>{userName + ' | ' + schoolName}</div>
|
|
|
</div>
|
|
|
:
|
|
|
- <div className='home-top-msg-root' style={{paddingBottom:10}}>
|
|
|
+ <div className='home-top-msg-root' style={{paddingBottom: 10}}>
|
|
|
{isObjEmpty(userInfo.userAvatar) ?
|
|
|
<Avatar size={42} icon='user'/> :
|
|
|
<img
|
|
|
@@ -332,7 +331,7 @@ class HomePage extends Component {
|
|
|
style={{border: '3px solid #ffffff'}}/>
|
|
|
}
|
|
|
<span
|
|
|
- className='home-top-msg-text'>{userName +' | ' + schoolName}</span>
|
|
|
+ className='home-top-msg-text'>{userName + ' | ' + schoolName}</span>
|
|
|
</div>
|
|
|
}
|
|
|
</div>
|
|
|
@@ -416,38 +415,37 @@ class HomePage extends Component {
|
|
|
}
|
|
|
|
|
|
onStuSwitch = (stuIndex) => {
|
|
|
- console.log("onStuSwitch",stuIndex)
|
|
|
-
|
|
|
- /* if (stuIndex != 0) {
|
|
|
- Toast.loading('学生切换中...', 0)
|
|
|
- setTimeout(() => {
|
|
|
- Toast.success('切换成功!', 1)
|
|
|
- const studentList = this.props.userInfo.parent.students
|
|
|
- const centerStu = studentList[stuIndex]
|
|
|
- studentList[stuIndex] = studentList[0]
|
|
|
- studentList[0] = centerStu
|
|
|
-
|
|
|
- switchUser({
|
|
|
- parent: {
|
|
|
- ...this.props.userInfo.parent,
|
|
|
- students:studentList,
|
|
|
- student: centerStu
|
|
|
- },
|
|
|
- user: {
|
|
|
- ...this.props.userInfo.parent,
|
|
|
- students:studentList,
|
|
|
- student: centerStu
|
|
|
- }
|
|
|
- })()
|
|
|
- }, 400)
|
|
|
- }*/
|
|
|
+ console.log("onStuSwitch", stuIndex)
|
|
|
+
|
|
|
+ /* if (stuIndex != 0) {
|
|
|
+ Toast.loading('学生切换中...', 0)
|
|
|
+ setTimeout(() => {
|
|
|
+ Toast.success('切换成功!', 1)
|
|
|
+ const studentList = this.props.userInfo.parent.students
|
|
|
+ const centerStu = studentList[stuIndex]
|
|
|
+ studentList[stuIndex] = studentList[0]
|
|
|
+ studentList[0] = centerStu
|
|
|
+
|
|
|
+ switchUser({
|
|
|
+ parent: {
|
|
|
+ ...this.props.userInfo.parent,
|
|
|
+ students:studentList,
|
|
|
+ student: centerStu
|
|
|
+ },
|
|
|
+ user: {
|
|
|
+ ...this.props.userInfo.parent,
|
|
|
+ students:studentList,
|
|
|
+ student: centerStu
|
|
|
+ }
|
|
|
+ })()
|
|
|
+ }, 400)
|
|
|
+ }*/
|
|
|
if (this.state.studentIndex !== stuIndex) {
|
|
|
Toast.loading('学生切换中...', 0)
|
|
|
setTimeout(() => {
|
|
|
Toast.success('切换成功!', 1)
|
|
|
this.setState({
|
|
|
studentIndex: stuIndex,
|
|
|
- selectStuName:this.props.userInfo.parent.students[stuIndex].stuName
|
|
|
})
|
|
|
switchUser({
|
|
|
parent: {
|
|
|
@@ -562,7 +560,7 @@ class StuItem extends Component {
|
|
|
<Avatar className={this.props.isSelect ? 'border-radius-50-blue' : 'border-radius-50'}
|
|
|
size={30} icon='user'/>
|
|
|
}
|
|
|
- {/* <span
|
|
|
+ {/* <span
|
|
|
className={this.props.isSelect ? "margin_left_5 color_blue text_bold"
|
|
|
: 'margin_left_5'}>{this.props.stuObj.stuName+','+this.props.isSelect}</span>*/}
|
|
|
</div>
|