|
@@ -27,78 +27,89 @@ import Carousel3_7 from '../asstes/img/CocoPi2/卡片-21.png';
|
|
|
import Carousel3_8 from '../asstes/img/CocoPi2/卡片-23.png';
|
|
|
|
|
|
import img1 from '../asstes/img/初级1.png';
|
|
|
-import img2 from '../asstes/img/初级2.png';
|
|
|
import img3 from '../asstes/img/中级1.png';
|
|
|
-import img4 from '../asstes/img/中级2.png';
|
|
|
+// import img4 from '../asstes/img/中级2.png';
|
|
|
import img5 from '../asstes/img/高级1.png';
|
|
|
-import img6 from '../asstes/img/高级2.png';
|
|
|
+// import img6 from '../asstes/img/高级2.png';
|
|
|
+
|
|
|
+import biArrowLeft from '../asstes/img/bi_arrow_left.png';
|
|
|
+import biArrowRight from '../asstes/img/bi_arrow_right.png';
|
|
|
|
|
|
|
|
|
|
|
|
const carouselRef = React.createRef();
|
|
|
function Example() {
|
|
|
const [state1, setState1] = useState(0);
|
|
|
+ const [imgSrc, setImgSrc] = useState(img1)
|
|
|
const onChange = (e) => {
|
|
|
setState1(e)
|
|
|
+ if (e === 0 || e === 1) {
|
|
|
+ setImgSrc(img1)
|
|
|
+ } else if (e === 2 || e === 3) {
|
|
|
+ setImgSrc(img3)
|
|
|
+ } else if (e === 4 || e === 5) {
|
|
|
+ setImgSrc(img5)
|
|
|
+ }
|
|
|
};
|
|
|
- // const switchClickState = (e) => {
|
|
|
- // carouselRef.current.goTo(e);
|
|
|
- // }
|
|
|
+ const switchClickState = (type) => {
|
|
|
+ let a = state1
|
|
|
+ if (type === 'prev') {
|
|
|
+ if (state1 === 0) {
|
|
|
+ a = 5
|
|
|
+ } else {
|
|
|
+ a = a-1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (state1 === 5) {
|
|
|
+ a = 0
|
|
|
+ } else {
|
|
|
+ a = a + 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ carouselRef.current.goTo(a);
|
|
|
+ }
|
|
|
return (
|
|
|
<div className="Example">
|
|
|
<h1>課程案例</h1>
|
|
|
<div className="Example_content">
|
|
|
- <Carousel infinite afterChange={onChange} slideNumber={state1} ref={carouselRef}
|
|
|
+ <div className="img_title">
|
|
|
+ <img src={imgSrc} alt="" />
|
|
|
+ </div>
|
|
|
+ <img onClick={() => switchClickState("prev")} className="bi_arrow_left" src={biArrowLeft} alt="left" />
|
|
|
+ <img onClick={() => switchClickState("next")} className="bi_arrow_right" src={biArrowRight} alt="left" />
|
|
|
+ <Carousel arrow={true} infinite afterChange={onChange} slideNumber={state1} ref={carouselRef}
|
|
|
arrowOffset={16} arrowSize={16}>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img1} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel1_1} alt="即將上綫" />
|
|
|
<img src={Carousel1_3} alt="即將上綫" />
|
|
|
<img src={Carousel1_2} alt="即將上綫" />
|
|
|
<img src={Carousel1_4} alt="即將上綫" />
|
|
|
</div>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img2} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel1_5} alt="即將上綫" />
|
|
|
<img src={Carousel1_6} alt="即將上綫" />
|
|
|
<img src={Carousel1_7} alt="即將上綫" />
|
|
|
<img src={Carousel1_8} alt="即將上綫" />
|
|
|
</div>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img3} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel2_1} alt="即將上綫" />
|
|
|
<img src={Carousel2_2} alt="即將上綫" />
|
|
|
<img src={Carousel2_3} alt="即將上綫" />
|
|
|
<img src={Carousel2_4} alt="即將上綫" />
|
|
|
</div>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img4} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel2_5} alt="即將上綫" />
|
|
|
<img src={Carousel2_6} alt="即將上綫" />
|
|
|
<img src={Carousel2_7} alt="即將上綫" />
|
|
|
<img src={Carousel2_8} alt="即將上綫" />
|
|
|
</div>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img5} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel3_1} alt="即將上綫" />
|
|
|
<img src={Carousel3_2} alt="即將上綫" />
|
|
|
<img src={Carousel3_3} alt="即將上綫" />
|
|
|
<img src={Carousel3_4} alt="即將上綫" />
|
|
|
</div>
|
|
|
<div className="contentStyle">
|
|
|
- <div>
|
|
|
- <img src={img6} alt="" />
|
|
|
- </div>
|
|
|
<img src={Carousel3_5} alt="即將上綫" />
|
|
|
<img src={Carousel3_6} alt="即將上綫" />
|
|
|
<img src={Carousel3_7} alt="即將上綫" />
|