Pārlūkot izejas kodu

fix: 查看主空间

chenzhen2 2 gadi atpakaļ
vecāks
revīzija
170fac14a6

+ 18 - 1
src/styles/comMedia.scss

@@ -1,4 +1,4 @@
-@media screen and (max-width: 414px) and (min-width: 0px) {
+@media screen  and (min-width: 0px) and (max-width: 414px) {
     .space-box {
       width: 100% !important;
     }
@@ -22,4 +22,21 @@
     .space-box {
       width: 20% !important;
     }
+  }
+
+  
+  @media screen  and (min-width: 0px) and (max-width: 585px) {
+    .time-btn-small {
+      width: 68px !important;
+    }
+  }
+  @media screen  and (min-width: 585px) and (max-width: 700px) {
+    .time-btn-small {
+      width: 58px !important;
+    }
+  }
+  @media screen  and (min-width: 700px) and (max-width: 860px) {
+    .time-btn-small {
+      width: 48px !important;
+    }
   }

+ 9 - 4
src/views/choiceSpace/choiceProject.vue

@@ -22,7 +22,7 @@
 <script lang="ts">
 import { defineComponent, nextTick, onMounted, reactive, toRefs } from "vue";
 import { useRoute, onBeforeRouteUpdate } from "vue-router";
-import { Search } from "vant";
+import { Search, Toast } from "vant";
 import router from "@/router";
 import { getUsersInfo } from "@/apis/user";
 import { store } from "@/store";
@@ -49,9 +49,14 @@ export default defineComponent({
       getUsersInfo() {
         getUsersInfo().then((res) => {
           let resData: any = res;
-          let projects: any = resData?.projects ?? [];
-          proxyData.cloneProjects = JSON.parse(JSON.stringify(projects));
-          proxyData.projects = projects;
+          if (resData.result === "success") {
+            let projects: any = resData?.projects ?? [];
+            proxyData.cloneProjects = JSON.parse(JSON.stringify(projects));
+            proxyData.projects = projects;
+          } else {
+            Toast("登录过期,请重新扫码进入!")
+            router.push({ name: "home" });
+          }
         });
       },
       searchVal: "",

+ 6 - 5
src/views/envmonitor/components/workOvertime/WorkConfig.vue

@@ -510,6 +510,7 @@ export default defineComponent({
 });
 </script>
 <style lang="scss" scoped>
+@import "~@/styles/comMedia.scss";
 .scene-config {
   display: flex;
   flex-wrap: wrap;
@@ -576,7 +577,7 @@ export default defineComponent({
       display: inline-block;
       width: 98px;
       // width: 64px;
-      height: 50px;
+      height: 58px;
       line-height: 20px;
       background: #ffffff;
       box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1),
@@ -584,7 +585,7 @@ export default defineComponent({
       border-radius: 12px;
       span {
         position: absolute;
-        padding: 0 8px;
+        padding: 0 4px;
         width: 100%;
         top: 50%;
         transform: translateY(-50%);
@@ -596,13 +597,13 @@ export default defineComponent({
       }
     }
     .time-btn-small {
-      width: 64px;
+      width: 45px;
     }
   }
 
   .time-del {
     // width: 27%;
-    padding-top: 18px;
+    padding-top: 14px;
     flex: 1;
     margin-left: 10px;
     background: #f1f4f8;
@@ -623,7 +624,7 @@ export default defineComponent({
       span {
         display: block;
         font-size: 13px;
-        line-height: 18px;
+        line-height: 20px;
         text-align: center;
         color: #000000;
       }

+ 8 - 2
src/views/envmonitor/index.vue

@@ -1618,12 +1618,18 @@ export default defineComponent({
             proxyData.spaceData = [];
           }
           proxyData.spaceData.map((item: any) => {
-            if (item.isMajorSpace) {
+            if(proxyData.spaceInfo.spaceId===item.spaceId){
               item.active = true;
               proxyData.spaceInfo = item;
-            } else {
+            }else {
               item.active = false;
             }
+            // if (item.isMajorSpace) {
+            //   item.active = true;
+            //   proxyData.spaceInfo = item;
+            // } else {
+            //   item.active = false;
+            // }
           });
         });
       },

+ 31 - 15
src/views/home/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="home">
+  <div class="home" v-if="showLogin">
     <div class="home-btn" @click="checkLoginType">
       <span v-if="type === 2">二维码登录</span>
       <span v-else>账号登录</span>
@@ -114,7 +114,11 @@ export default defineComponent({
       });
     } else {
       next((e: any) => {
-        router.push({ name: "home", query: { mac: e.userInfo.mac } });
+        e.showLogin = true;
+        // to.query = { mac: e.userInfo.mac };
+        console.log(to);
+        // console.log( e.showLogin )
+        // router.push({ name: "home", query: { mac: e.userInfo.mac } });
       });
     }
   },
@@ -128,6 +132,7 @@ export default defineComponent({
     const proxyData = reactive({
       parseImgUrl: parseImgUrl,
       codeValue: `${orgin}/sgipad/home`,
+      showLogin: false,
       size: 134,
       type: 1, // 1:二维码登录 2:用户密码登录
       userInfo: userInfo,
@@ -166,30 +171,41 @@ export default defineComponent({
         let params: any = {
           criteria: {
             macAddress: proxyData.userInfo.mac,
+            isMajorSpace:1
           },
           orders: [
             {
               column: "createTime",
+
               asc: false,
             },
           ],
           page: 1,
           size: 1,
         };
-        queryWorkSpace(params).then((res: any) => {
-          let resData: any = res;
-          if (resData.result === "success") {
-            let content: any = resData?.content ?? [];
-            if (content && content.length) {
-              let projectId: any = content[0].projectId;
-              store.commit(UserMutationTypes.SET_PROJECT_ID, projectId);
-              router.push({
-                name: "envmonitor",
-                query: { spaceId: content[0].spaceId },
-              });
+        queryWorkSpace(params)
+          .then((res: any) => {
+            let resData: any = res;
+            if (resData.result === "success") {
+              let content: any = resData?.content ?? [];
+              if (content && content.length) {
+                proxyData.showLogin = false;
+                let projectId: any = content[0].projectId;
+                store.commit(UserMutationTypes.SET_PROJECT_ID, projectId);
+                router.push({
+                  name: "envmonitor",
+                  query: { spaceId: content[0].spaceId },
+                });
+              } else {
+                proxyData.showLogin = true;
+              }
+            } else {
+              proxyData.showLogin = true;
             }
-          }
-        });
+          })
+          .catch(() => {
+            proxyData.showLogin = true;
+          });
       },
       /**
        * 获取mac地址