dev_jzx
parent
dee8c115d7
commit
7d1bbac23a
@ -0,0 +1,44 @@
|
||||
import React, { Component } from "react";
|
||||
|
||||
export default class Kecheng extends Component {
|
||||
state = {
|
||||
list: [],
|
||||
};
|
||||
componentDidMount() {
|
||||
fetch(
|
||||
"https://test-data.educoder.net/api/stages.json?subject_id=" +
|
||||
this.props.id
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
console.log(data.stages);
|
||||
this.setState({
|
||||
list: data.stages,
|
||||
});
|
||||
});
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div className="left_three">
|
||||
<div className="left_three_box">
|
||||
<div className="left_three_box_box_active">全部</div>
|
||||
<div className="left_three_box_box_active">实践项目</div>
|
||||
<div className="left_three_box_box_active">视频项目</div>
|
||||
</div>
|
||||
{this.state.list.map((item) => (
|
||||
<div key={item.stage_id} className="zhangjie">
|
||||
<div className="zhangjie_wenzi">
|
||||
<div className="zhangjie_wenzi_box">{item.stage_name}</div>
|
||||
<div className="zhangjie_wenzi_box">{item.stage_description}</div>
|
||||
{item.items.map((item2) => (
|
||||
<div className="zhangjie_wenzi_box" key={item2.id}>
|
||||
{item2.name}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue