Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
42e6c3ba
Commit
42e6c3ba
authored
Feb 12, 2020
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school api
parent
5ab9369e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
5 deletions
+50
-5
src/components/passport/studentRoot/index.js
+50
-5
No files found.
src/components/passport/studentRoot/index.js
View file @
42e6c3ba
import
React
,
{
PureComponent
}
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
classnames
from
'classnames'
;
import
{
http
}
from
'@/utils'
;
import
{
Formik
,
Form
,
Field
}
from
'formik'
;
import
{
HeaderBar
}
from
"@/common"
;
import
Captcha
from
'@/common/Captcha'
...
...
@@ -22,9 +23,33 @@ class StudentRoot extends PureComponent {
disabled
:
false
,
isSchool
:
false
,
isCollege
:
false
,
list
:
[],
schoolList
:
[],
collegeList
:
[],
};
}
componentDidMount
()
{
this
.
fetchSchoolInfo
();
}
fetchSchoolInfo
=
()
=>
{
http
.
get
(
`
${
API
[
'home'
]}
/sys/school/list `
).
then
(
res
=>
{
console
.
log
(
res
);
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
const
schoolList
=
[];
data
.
forEach
(
item
=>
{
schoolList
.
push
(
item
.
school
);
});
this
.
setState
({
list
:
data
,
schoolList
});
}
});
}
onVerify
=
(
err
,
data
)
=>
{
if
(
!
err
)
{
this
.
setState
({
...
...
@@ -39,10 +64,20 @@ class StudentRoot extends PureComponent {
this
.
setState
(
param
);
}
changeToCollege
=
(
school
=
''
)
=>
{
const
{
list
}
=
this
.
state
;
const
data
=
list
.
filter
(
item
=>
item
[
'school'
]
===
school
);
if
(
data
.
length
>
0
)
{
this
.
setState
({
collegeList
:
data
[
0
][
'colleges'
]
});
}
}
render
()
{
// console.log(this.props
);
console
.
log
(
this
.
state
,
1
);
const
{
country
}
=
this
.
props
;
const
{
validate
,
captchaInstance
,
disabled
,
isSchool
,
isCollege
}
=
this
.
state
;
const
{
validate
,
captchaInstance
,
isSchool
,
isCollege
,
schoolList
,
collegeList
}
=
this
.
state
;
return
(
<>
<
HeaderBar
title
=
{
'助学计划'
}
arrow
=
{
true
}
/
>
...
...
@@ -140,8 +175,10 @@ class StudentRoot extends PureComponent {
key
:
'isSchool'
,
val
:
isSchool
}}
options
=
{
schoolList
}
onChange
=
{
props
.
setFieldValue
}
selectSwitch
=
{
this
.
selectSwitch
}
selectSwitch
=
{
this
.
selectSwitch
}
changeToCollege
=
{
this
.
changeToCollege
}
/
>
<
/div
>
<
div
className
=
"student-form__item"
>
...
...
@@ -153,8 +190,10 @@ class StudentRoot extends PureComponent {
key
:
'isCollege'
,
val
:
isCollege
}}
options
=
{
collegeList
}
onChange
=
{
props
.
setFieldValue
}
selectSwitch
=
{
this
.
selectSwitch
}
changeToCollege
=
{
this
.
changeToCollege
}
/
>
<
/div
>
<
div
className
=
"student-form__item"
>
...
...
@@ -182,13 +221,15 @@ class StudentRoot extends PureComponent {
}
const
StudentSelect
=
(
props
)
=>
{
console
.
log
(
props
);
const
{
options
=
[
1
,
2
,
3
,
4
],
options
=
[],
data
:
{
key
=
''
,
val
=
false
},
name
,
value
,
onChange
,
selectSwitch
selectSwitch
,
changeToCollege
}
=
props
;
return
(
<
div
className
=
"student-select"
>
...
...
@@ -214,6 +255,10 @@ const StudentSelect = (props) => {
onClick
=
{()
=>
{
selectSwitch
(
key
,
false
);
onChange
(
name
,
item
);
if
(
name
===
'school'
)
{
onChange
(
'college'
,
''
);
}
changeToCollege
(
item
);
}}
>
{
item
}
<
/li
>
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment