Browse Source

暗色风格联动

YaolongHan 4 years ago
parent
commit
89be2e7824
2 changed files with 44 additions and 6 deletions
  1. 36 4
      src/components/menuList.vue
  2. 8 2
      src/views/homepage/darkColor.vue

+ 36 - 4
src/components/menuList.vue

@@ -124,7 +124,14 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(["plazas", "plazaId", "fmapID", "plazaName", "permissions"]),
+    ...mapGetters([
+      "plazas",
+      "plazaId",
+      "fmapID",
+      "plazaName",
+      "permissions",
+      "userInfo",
+    ]),
   },
   watch: {
     $route: "handleRoute",
@@ -138,7 +145,6 @@ export default {
   },
   mounted() {
     this.handleRoute(this.$route);
-    // console.log(this.fmapID)
     // 定时查询草稿箱数量
     this.getDraftNum(); //首次查询
     this.timer = setInterval(() => {
@@ -148,7 +154,6 @@ export default {
     this.$once("hook:beforeDestroy", () => {
       clearInterval(this.timer);
     });
-    console.log("permissions", this.permissions);
   },
   methods: {
     /**
@@ -200,6 +205,33 @@ export default {
       const { path } = newRouter;
       let router = path.split("home/")[1];
       this.modelNum(this.dict[router]);
+
+      // 当样式切换时样式设置为初始化
+      if (router == "homepage") {
+        this.showStyleBtn = true;
+        /**
+         * 使用localStorage中储存的, 当前用户的皮肤模式
+         */
+        let skinMode = localStorage.getItem(
+          `${this.userInfo.username}__skinMode`
+        );
+        if (skinMode) {
+          if (skinMode === "light") {
+            this.showStyle = false;
+            //   改变颜色风格
+            bus.$emit("changeStyleColor", false);
+          } else {
+            this.showStyle = true;
+            //   改变颜色风格
+            setTimeout(()=>{
+              bus.$emit("changeStyleColor", true);
+            })
+          }
+        }
+      } else {
+        this.showStyleBtn = false;
+        this.showStyle = false;
+      }
     },
     formatter(str, arrv) {
       if (str && arrv) {
@@ -423,7 +455,7 @@ export default {
   align-items: center;
   line-height: 48px;
   color: #646c73;
-  img{
+  img {
     width: 24px;
     height: 24px;
   }

+ 8 - 2
src/views/homepage/darkColor.vue

@@ -41,6 +41,7 @@
                     class="number"
                     v-for="(equip, index) in item.assetTypeList"
                     :key="index"
+                    @click='navToInnerPage(item, equip)'
                   >
                     <div class="title">
                       <P
@@ -204,12 +205,12 @@
               ></canvas>
             </div>
             <div class="msg">
-              <div class="msg-item item-1">
+              <div class="msg-item">
                 <span class="msg-color"></span>
                 <span class="type">未完成得任务</span>
                 <span class="num">{{ item.unfinished }}</span>
               </div>
-              <div class="msg-item item-1">
+              <div class="msg-item">
                 <span class="msg-color"></span>
                 <span class="type">即将逾期</span>
                 <span class="num">{{ item.due_num }}</span>
@@ -292,6 +293,7 @@ export default {
     ...mapGetters(["floorsArr", "floorObj"]),
   },
   methods: {
+    // 点击下拉框选择
     changeClick(statisticItem, data) {
       this.projectStatistics(
         statisticItem.type,
@@ -429,6 +431,10 @@ export default {
       } else {
       }
     },
+    // 点击跳转
+    navToInnerPage (item, equip) {
+      this.$router.push({path:"./analysis", query:{smsxt:item.smsxt, equipId: equip.category_code, module:'core'}})
+    },
 
     /**
      * 项目首页右侧统计