From 1dc734f1c842f5ddbe9affc10ce99ec142c9f9a9 Mon Sep 17 00:00:00 2001 From: Jzx201211 <1595536662@qq.com> Date: Fri, 4 Mar 2022 18:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=AF=B9=E5=BA=94=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/shijiankecheng/box2.js | 58 +++++++++-- src/pages/shijiankecheng/box4.js | 108 +++++++++++++++++++- src/pages/shijiankecheng/shijiankecheng.css | 4 + src/pages/shijiankecheng/shijiankecheng.js | 3 +- 4 files changed, 159 insertions(+), 14 deletions(-) diff --git a/src/pages/shijiankecheng/box2.js b/src/pages/shijiankecheng/box2.js index 2f1feb65..e721ec97 100644 --- a/src/pages/shijiankecheng/box2.js +++ b/src/pages/shijiankecheng/box2.js @@ -5,33 +5,77 @@ export default class Box2 extends Component { super(); this.state = { list: [], + color: "", + color2: -1, }; fetch("https://test-data.educoder.net/api/disciplines.json?source=subject") .then((res) => res.json()) .then((data) => { - console.log(data.disciplines); this.setState({ list: data.disciplines, }); }); } + handleclick2(t, i) { + this.props.eventbox(t); + this.setState({ + color2: i, + color: "", + }); + } + handleclick(e, v, t, i, o) { + e.stopPropagation(); + this.props.event(v, t); + this.setState({ + color: i, + color2: o, + }); + } + handleclick3() { + this.props.eventall(); + this.setState({ + color2: -1, + color: "", + }); + } render() { return (