xujunjie 1 год назад
Родитель
Сommit
edac4aeb89
3 измененных файлов с 34 добавлено и 17 удалено
  1. 18 5
      src/pages/Projects/index.js
  2. 15 11
      src/pages/Projects/index.less
  3. 1 1
      src/services/diagnosticTec.js

+ 18 - 5
src/pages/Projects/index.js

@@ -1,4 +1,5 @@
 import { queryProject } from '@/services/diagnosticTec';
+import { UnityAction } from '@/utils/utils';
 import { useRequest } from '@umijs/max';
 import { useRef } from 'react';
 import Swiper from 'react-id-swiper';
@@ -10,13 +11,18 @@ const Projects = () => {
 
   const { data: projectList } = useRequest(queryProject, {
     formatResult: (res) => {
-      return res?.data?.list?.filter((item) => item?.Stage == 3);
+      // return res?.data?.list?.filter((item) => item?.Stage == 3);
+      var list = [];
+      res.data.forEach((item) => {
+        list = list.concat(item.List);
+      });
+      return list;
     },
   });
   const params = {
     slidesPerView: 'auto',
     freeMode: true,
-    spaceBetween: 30,
+    spaceBetween: 50,
   };
   const goNext = () => {
     if (ref.current !== null && ref.current.swiper !== null) {
@@ -29,6 +35,11 @@ const Projects = () => {
       ref.current.swiper.slidePrev();
     }
   };
+
+  const toProject = (item) => {
+    UnityAction.sendMsg('project', JSON.stringify(item));
+  };
+
   return (
     <div className={styles.main}>
       <div className={styles.titleCon}>
@@ -41,7 +52,7 @@ const Projects = () => {
       <div className={styles.swiper}>
         <Swiper {...params} ref={ref}>
           {projectList?.map((item) => (
-            <div>
+            <div key={item.ProjectId} onClick={() => toProject(item)}>
               <div className={styles.swiperItem}>
                 <div
                   className={styles.pic}
@@ -55,7 +66,8 @@ const Projects = () => {
                     <div className={styles.line} />
                     <div className={styles.valueCon}>
                       <span className={styles.value}>
-                        2347<span className={styles.valueCon}>m3/h</span>
+                        {item.WaterIn}
+                        <div className={styles.valueCon}>m3/h</div>
                       </span>
                       <div>进水流量</div>
                     </div>
@@ -64,7 +76,8 @@ const Projects = () => {
                     <div className={styles.line} />
                     <div className={styles.valueCon}>
                       <span className={styles.value}>
-                        2347<span className={styles.valueCon}>m3/h</span>
+                        {item.WaterOut}
+                        <div className={styles.valueCon}>m3/h</div>
                       </span>
                       <div>进水流量</div>
                     </div>

+ 15 - 11
src/pages/Projects/index.less

@@ -19,9 +19,8 @@
     .titleSelect {
       font-size: 0.55rem;
       font-family: Source Han Sans, Source Han Sans;
-      font-weight: 600;
       color: #3b3b3b;
-      letter-spacing: 0.14rem;
+      font-weight: bold;
     }
     .titleRight {
       display: flex;
@@ -36,9 +35,9 @@
 }
 .swiper {
   position: relative;
-  margin-top: 2.72rem;
+  margin-top: 2rem;
   .pic {
-    width: 2.97rem;
+    width: 100%;
     height: 2.26rem;
     border-radius: 0.16rem;
     background-size: 100% 100%;
@@ -60,20 +59,20 @@
   .swiperItem {
     position: relative;
     padding: 0.18rem;
-    width: 3.33rem;
-    height: 4.57rem;
+    width: 3.72rem;
+    height: 4.96rem;
     background: url('@/assets/projects/item-bg.png') no-repeat center;
     background-size: 100% 100%;
   }
   .shadow {
-    width: 3.34rem;
-    height: 1.86rem;
+    width: 3.72rem;
+    height: 2.06rem;
     background: url('@/assets/projects/item-bg-down.png') no-repeat center;
     background-size: 100% 100%;
   }
   .line {
     margin-right: 0.14rem;
-    height: 0.49rem;
+    height: 100%;
     width: 0.01rem;
     background-color: #0054a7;
   }
@@ -81,9 +80,14 @@
     position: absolute;
     bottom: 0.3rem;
     display: flex;
-    justify-content: space-between;
+    width: 100%;
+    padding-right: 0.4rem;
+    // justify-content: space-between;
     .itemCon {
       display: flex;
+      &:first-child {
+        margin-right: 0.2rem;
+      }
     }
   }
   .valueCon {
@@ -131,7 +135,7 @@
 }
 .bg {
   position: absolute;
-  top: 4.57rem;
+  top: 4.97rem;
   width: 100%;
   height: 3.14rem;
   background: url('@/assets/projects/bg-01.png') no-repeat center;

+ 1 - 1
src/services/diagnosticTec.js

@@ -2,7 +2,7 @@ import { stringify } from 'qs';
 import { request } from 'umi';
 
 export async function queryProject(params = {}) {
-  return request(`/api/v2/project?${stringify(params)}`);
+  return request(`/api/v2/project/list?${stringify(params)}`);
 }
 
 export async function queryStatisticList(params = {}) {