|
@@ -1,5 +1,34 @@
|
|
|
+import { queryProject } from '@/services/diagnosticTec';
|
|
|
+import { useRequest } from '@umijs/max';
|
|
|
+import { useRef } from 'react';
|
|
|
+import Swiper from 'react-id-swiper';
|
|
|
+import 'swiper/css/swiper.css';
|
|
|
import styles from './index.less';
|
|
|
+const nodata = require('@/assets/projects/nodata.png');
|
|
|
const Projects = () => {
|
|
|
+ const ref = useRef(null);
|
|
|
+
|
|
|
+ const { data: projectList } = useRequest(queryProject, {
|
|
|
+ formatResult: (res) => {
|
|
|
+ return res?.data?.list?.filter((item) => item?.Stage == 3);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ const params = {
|
|
|
+ slidesPerView: 'auto',
|
|
|
+ freeMode: true,
|
|
|
+ spaceBetween: 30,
|
|
|
+ };
|
|
|
+ const goNext = () => {
|
|
|
+ if (ref.current !== null && ref.current.swiper !== null) {
|
|
|
+ ref.current.swiper.slideNext();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const goPrev = () => {
|
|
|
+ if (ref.current !== null && ref.current.swiper !== null) {
|
|
|
+ ref.current.swiper.slidePrev();
|
|
|
+ }
|
|
|
+ };
|
|
|
return (
|
|
|
<div className={styles.main}>
|
|
|
<div className={styles.titleCon}>
|
|
@@ -9,6 +38,47 @@ const Projects = () => {
|
|
|
<span className={styles.titleText}>新水岛无人值守管理平台</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div className={styles.swiper}>
|
|
|
+ <Swiper {...params} ref={ref}>
|
|
|
+ {projectList?.map((item) => (
|
|
|
+ <div>
|
|
|
+ <div className={styles.swiperItem}>
|
|
|
+ <div
|
|
|
+ className={styles.pic}
|
|
|
+ style={{
|
|
|
+ backgroundImage: `url('${item.ScreenShot || nodata}')`,
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div className={styles.name}>{item.Name}</div>
|
|
|
+ <div className={styles.bottomCon}>
|
|
|
+ <div className={styles.itemCon}>
|
|
|
+ <div className={styles.line} />
|
|
|
+ <div className={styles.valueCon}>
|
|
|
+ <span className={styles.value}>
|
|
|
+ 2347<span className={styles.valueCon}>m3/h</span>
|
|
|
+ </span>
|
|
|
+ <div>进水流量</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className={styles.itemCon}>
|
|
|
+ <div className={styles.line} />
|
|
|
+ <div className={styles.valueCon}>
|
|
|
+ <span className={styles.value}>
|
|
|
+ 2347<span className={styles.valueCon}>m3/h</span>
|
|
|
+ </span>
|
|
|
+ <div>进水流量</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className={styles.shadow} />
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </Swiper>
|
|
|
+ <div className={styles.arrowLeft} onClick={goPrev}></div>
|
|
|
+ <div className={styles.arrowRight} onClick={goNext}></div>
|
|
|
+ <div className={styles.bg}></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
};
|