parent
ca27ae5a97
commit
bbcd701863
@ -0,0 +1,94 @@
|
||||
import React, { Component } from "react";
|
||||
import Zhangjie from "./zhangjie";
|
||||
|
||||
export default class Path extends Component {
|
||||
state = {
|
||||
list: [],
|
||||
list2: [],
|
||||
url: "",
|
||||
};
|
||||
componentDidMount() {
|
||||
fetch(
|
||||
"https://test-data.educoder.net/api/paths/" +
|
||||
this.props.id +
|
||||
".json?identifier=" +
|
||||
this.props.id
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
this.setState({
|
||||
list: data,
|
||||
});
|
||||
});
|
||||
|
||||
fetch(
|
||||
"https://test-data.educoder.net/api/paths/" +
|
||||
this.props.id +
|
||||
".json?identifier=" +
|
||||
this.props.id
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
console.log(data.attachments);
|
||||
this.setState({
|
||||
list2: data.attachments,
|
||||
});
|
||||
});
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div className="path">
|
||||
<div className="path_top">
|
||||
<div className="path_top_box">{this.state.list.name}</div>
|
||||
<div className="path_top_box2">
|
||||
<div className="path_top_box2_box">
|
||||
<span>章节</span>
|
||||
<p>{this.state.list.stages_count}</p>
|
||||
</div>
|
||||
<div className="path_top_box2_box">
|
||||
<span>实训</span>
|
||||
<p>{this.state.list.shixuns_count}</p>
|
||||
</div>
|
||||
<div className="path_top_box2_box">
|
||||
<span>选择题关卡</span>
|
||||
<p>{this.state.list.challenge_choose_count}</p>
|
||||
</div>
|
||||
<div className="path_top_box2_box">
|
||||
<span>实践关卡</span>
|
||||
<p>{this.state.list.challenges_count}</p>
|
||||
</div>
|
||||
<div className="path_top_box2_box">
|
||||
<span>视频</span>
|
||||
<p>{this.state.list.videos_count}</p>
|
||||
</div>
|
||||
<div className="path_top_box2_box">
|
||||
<span>参与人数</span>
|
||||
<p>{this.state.list.member_count}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="left">
|
||||
<div className="left_one">
|
||||
<div className="left_one_box1">
|
||||
<img
|
||||
style={{ marginRight: "10px" }}
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAO9JREFUOBFj3H//P8ePj//a/jMyRDH8/y/uZcDCyAAEoZP//QfRxAHG54yMDIv+izHUsYANY/hfyECCdkxL/kv+/89QzviKkYGFgZEhGpdhEvwMDJNiwQ6Gm5G3+D/Di49wLgoDaGgc0///QIdSDfyXZKKaWVCDiDLwxUeQN4kLZBZ8LgSGCcP2i/8Zlh6HqIq2/A9MCPh0MAAjBQ94+YmBYf5hhAJkNkIUlUWUl1G14OeNGog/fIiRHQ1DYkIJvxomRgbG5/iVkCLL+BxoIMMiUrTgUwsqtVlkWZnqHv/+Bypj44BZXxKfBtxyiCoAAHADSWb7p5YAAAAAAElFTkSuQmCC"
|
||||
></img>
|
||||
课程介绍
|
||||
</div>
|
||||
<div className="left_one_box2">{this.state.list.description}</div>
|
||||
</div>
|
||||
<div className="left_two">
|
||||
<div className="left_two_box">课程章节</div>
|
||||
<div className="left_two_box">排行榜</div>
|
||||
<div className="left_two_box">证书申请</div>
|
||||
</div>
|
||||
<div className="left_three">
|
||||
<Zhangjie id={this.props.id}></Zhangjie>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
import React, { Component } from "react";
|
||||
import "../shijiankecheng.css";
|
||||
|
||||
export default class Zhangjie 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>
|
||||
{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>
|
||||
|
||||
{/* <span>{item.stage_name}</span>
|
||||
<span>{item.stage_description}</span> */}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue