Ver código fonte

修改侧边栏默认图片展示

bobo04052021@163.com 5 meses atrás
pai
commit
8bbe1ed703

+ 12 - 12
manifest.json

@@ -6,18 +6,18 @@
     "versionCode" : 1,
     "transformPx" : false,
     "app-plus" : {
-		"orientation" : [
-			//竖屏正方向
-			"portrait-primary",
-			//竖屏反方向
-			"portrait-secondary",
-			//横屏正方向
-			"landscape-primary",
-			//横屏反方向
-			"landscape-secondary",
-			//自然方向
-			"default"
-		],
+        "orientation" : [
+            //竖屏正方向
+            "portrait-primary",
+            //竖屏反方向
+            "portrait-secondary",
+            //横屏正方向
+            "landscape-primary",
+            //横屏反方向
+            "landscape-secondary",
+            //自然方向
+            "default"
+        ],
         /* 5+App特有相关 */
         "modules" : {
             "Maps" : {},

+ 0 - 147
pages/device/devicemenu/treeMenu/typeMenu.vue

@@ -1,147 +0,0 @@
-<template>
-  <view class="device-type-modal">
-    <scroll-view>
-      <!-- 通风设备 -->
-      <view v-for="(typeitem, index) in typeList" :key="index">
-        <view
-          class="cu-bar bg-white solid-bottom margin-top"
-          :style="[{ animation: 'show 0.5s 1' }]"
-        >
-          <view class="action">
-            <text style="font-weight: bold">{{ typeitem.itemText }}</text>
-          </view>
-        </view>
-
-        <view class="cu-list grid col-4 text-sm">
-          <view
-            class="cu-item animation-slide-bottom"
-            :style="[{ animationDelay: (index + 1) * 0.05 + 's' }]"
-            v-for="(item, index) in typeitem.children"
-            :key="index"
-            @tap="goPage(item.itemValue)"
-          >
-            <view class="padding text-center">
-              <image
-                :src="icon_prefix + 'bottombg.png'"
-                style="width: 50px; height: 30px"
-              >
-              </image>
-              <image class="icon" :src="getIcon(item.itemValue)" alt="Icon" />
-              <view class="margin-top-xs">{{ item.itemText }}</view>
-            </view>
-          </view>
-        </view>
-      </view>
-    </scroll-view>
-    <view class="cu-tabbar-height margin-top"></view>
-  </view>
-</template>
-
-<script>
-import { us, os } from "@/common/util/type.js";
-import socket from "@/common/js-sdk/socket/socket.js";
-import api from "@/api/api";
-export default {
-  name: "home",
-  watch: {},
-  data() {
-    return {
-      icon_prefix: "/static/sidebar/",
-      typeList: [],
-      usList: us.data,
-      osList: os.data,
-      dsList: os.data,
-      msgCount: 0,
-      dot: {
-        mailHome: false,
-      },
-      iconMap: {
-        gate: "/static/sidebar/ventS/gate.svg",
-        window: "/static/sidebar/ventS/window.svg",
-        windrect: "/static/sidebar/ventS/windrect.svg",
-        fanmain: "/static/sidebar/ventS/fanmain.svg",
-        fanlocal: "/static/sidebar/ventS/fanlocal.svg",
-        drilling: "/static/sidebar/gasS/drilling.svg",
-        gasmonitor: "/static/sidebar/gasS/gasmonitor.svg",
-        pump: "/static/sidebar/gasS/pump.svg",
-        unit: "/static/sidebar/gasS/unit.svg",
-        dusting: "/static/sidebar/dustS/dusting.svg",
-        spray: "/static/sidebar/dustS/spray.svg",
-        bundletube: "/static/sidebar/fireS/bundletube.svg",
-        fiber: "/static/sidebar/fireS/fiber.svg",
-        nitrogen: "/static/sidebar/fireS/nitrogen.svg",
-        obfurage: "/static/sidebar/fireS/obfurage.svg",
-        pulping: "/static/sidebar/fireS/pulping.svg",
-        atomizing: "/static/sidebar/dustS/atomizing.svg",
-      },
-    };
-  },
-  created() {
-    this.loadData();
-  },
-  methods: {
-    loadData() {
-      return new Promise((resolve, reject) => {
-        api
-          .getDeviceType({})
-          .then((response) => {
-            if (response.data.code == 200) {
-              for (var i = 0; i < response.data.result.length; i++) {
-                if (
-                  response.data.result[i].itemValue.indexOf("synthesizeS") == -1
-                )
-                  this.typeList.push(response.data.result[i]);
-              }
-            } else {
-              resolve(response);
-            }
-          })
-          .catch((error) => {
-            console.log("catch===>response", response);
-            reject(error);
-          });
-      });
-    },
-    goPage(page) {
-      this.$emit("menuClick", page);
-    },
-    getIcon(itemValue) {
-      const defaultIconPath = "/static/sidebar/fireS/pulping.svg";
-
-      // 检查 iconMap 中是否存在对应的图标路径
-      if (itemValue && this.iconMap[itemValue]) {
-        return "/static/sidebar/" + itemValue + ".svg";
-      }
-      // 如果不存在对应的图标路径,则返回默认图标路径
-      return defaultIconPath;
-    },
-  },
-};
-</script>
-
-<style scoped lang="scss">
-.device-type-modal {
-  margin-top: 30rpx;
-}
-.cu-list.grid > .cu-item {
-  padding: 0rpx 0rpx;
-  background: linear-gradient(
-    to right,
-    rgba(55, 135, 254, 0.08),
-    rgba(4, 184, 255, 0.08),
-    rgba(60, 161, 237, 0.08)
-  );
-}
-.line2-icon {
-  width: 60rpx;
-  height: 60rpx;
-}
-.icon {
-  position: absolute;
-  top: 5rpx;
-  left: 50%;
-  transform: translateX(-50%);
-  width: 20rpx;
-  height: 20rpx;
-}
-</style>

+ 7 - 3
pages/history/Historymodel.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <!-- 建议放在外层 -->
     <u-navbar
-      title="设备中心"
+      title="历史数据"
       @leftClick="devicemenuShow"
       :safeAreaInsetTop="true"
     >
@@ -250,7 +250,7 @@ export default {
       deviceID: "", //设备ID
       deviceType: "", //设备类型
       skip: 8, //时间间隔
-      dataTime: dayjs().toDate().format('YYYY-MM-DD HH:mm:ss'),
+      dataTime: dayjs().toDate().format("YYYY-MM-DD HH:mm:ss"),
       historyData: [], //历史数据
     };
   },
@@ -262,6 +262,9 @@ export default {
     showColum(data) {
       this.colums = data;
     },
+	menushow(newValue,oldValue){
+		console.log('menushow 变化了:', newValue);
+	}
   },
   created() {
     this.colums = this.showColum;
@@ -381,7 +384,8 @@ export default {
       });
     },
     devicemenuShow(e) {
-      this.menushow = true;
+		this.menushow = !this.menushow;
+		console.log( this.menushow,'dainjichengg成都多大事');
     },
     menuClick(id) {
       this.TabCur = id;

+ 0 - 1
pages/history/devicemenu/devicemenu.vue

@@ -7,7 +7,6 @@
 <script>
 import TreeMenu from './treeMenu/typeMenu.vue'
 export default {
-	name: 'Study',
 	components: {
 		TreeMenu
 	},

+ 38 - 30
pages/history/devicemenu/treeMenu/typeMenu.vue

@@ -1,5 +1,5 @@
 <template>
-  <view>
+  <view class="device-type-modal">
     <scroll-view>
       <!-- 通风设备 -->
       <view v-for="(typeitem, index) in typeList" :key="index">
@@ -55,6 +55,25 @@ export default {
       dot: {
         mailHome: false,
       },
+      iconMap: {
+        gate: "/static/sidebar/ventS/gate.svg",
+        window: "/static/sidebar/ventS/window.svg",
+        windrect: "/static/sidebar/ventS/windrect.svg",
+        fanmain: "/static/sidebar/ventS/fanmain.svg",
+        fanlocal: "/static/sidebar/ventS/fanlocal.svg",
+        drilling: "/static/sidebar/gasS/drilling.svg",
+        gasmonitor: "/static/sidebar/gasS/gasmonitor.svg",
+        pump: "/static/sidebar/gasS/pump.svg",
+        unit: "/static/sidebar/gasS/unit.svg",
+        dusting: "/static/sidebar/dustS/dusting.svg",
+        spray: "/static/sidebar/dustS/spray.svg",
+        bundletube: "/static/sidebar/fireS/bundletube.svg",
+        fiber: "/static/sidebar/fireS/fiber.svg",
+        nitrogen: "/static/sidebar/fireS/nitrogen.svg",
+        obfurage: "/static/sidebar/fireS/obfurage.svg",
+        pulping: "/static/sidebar/fireS/pulping.svg",
+        atomizing: "/static/sidebar/dustS/atomizing.svg",
+      },
     };
   },
   created() {
@@ -86,37 +105,26 @@ export default {
     goPage(page) {
       this.$emit("menuClick", page);
     },
-
     getIcon(itemValue) {
-      const iconMap = {
-        gate: "/static/sidebar/ventS/gate.svg",
-        window: "/static/sidebar/ventS/window.svg",
-        windrect: "/static/sidebar/ventS/windrect.svg",
-        fanmain: "/static/sidebar/ventS/fanmain.svg",
-        fanlocal: "/static/sidebar/ventS/fanlocal.svg",
-        drilling: "/static/sidebar/gasS/drilling.svg",
-        gasmonitor: "/static/sidebar/gasS/gasmonitor.svg",
-        pump: "/static/sidebar/gasS/pump.svg",
-        unit: "/static/sidebar/gasS/unit.svg",
-        dusting: "/static/sidebar/dustS/dusting.svg",
-        spray: "/static/sidebar/dustS/spray.svg",
-        bundletube: "/static/sidebar/fireS/bundletube.svg",
-        fiber: "/static/sidebar/fireS/fiber.svg",
-        nitrogen: "/static/sidebar/fireS/nitrogen.svg",
-        obfurage: "/static/sidebar/fireS/obfurage.svg",
-        pulping: "/static/sidebar/fireS/pulping.svg",
-        atomizing: "/static/sidebar/dustS/atomizing.svg",
-      };
-      // 根据itemValue获取对应的图标路径,如果找不到对应关系则返回默认图标
-      return iconMap[itemValue];
+      const defaultIconPath = "/static/sidebar/fireS/pulping.svg";
+
+      // 检查 iconMap 中是否存在对应的图标路径
+      if (itemValue && this.iconMap[itemValue]) {
+        return "/static/sidebar/" + itemValue + ".svg";
+      }
+      // 如果不存在对应的图标路径,则返回默认图标路径
+      return defaultIconPath;
     },
   },
 };
 </script>
 
-<style scoped>
+<style scoped lang="scss">
+.device-type-modal {
+  margin-top: 30rpx;
+}
 .cu-list.grid > .cu-item {
-  padding: 0px 0px;
+  padding: 0rpx 0rpx;
   background: linear-gradient(
     to right,
     rgba(55, 135, 254, 0.08),
@@ -125,15 +133,15 @@ export default {
   );
 }
 .line2-icon {
-  width: 60px;
-  height: 60px;
+  width: 60rpx;
+  height: 60rpx;
 }
 .icon {
   position: absolute;
-  top: 5px;
+  top: 5rpx;
   left: 50%;
   transform: translateX(-50%);
-  width: 20px;
-  height: 20px;
+  width: 20rpx;
+  height: 20rpx;
 }
 </style>

+ 1 - 8
pages/home/firstmodel.vue

@@ -176,8 +176,6 @@ export default {
       TabCur: "gate",
       curlist: [],
       deviceList: {},
-      scrollLeft: 0,
-      currentTab: 0,
       colums: {},
     };
   },
@@ -188,7 +186,6 @@ export default {
   watch: {
     showColum(data) {
       this.colums = data;
-      console.log(this.colums);
     },
   },
   created() {
@@ -196,7 +193,7 @@ export default {
   },
   mounted() {
     this.loadData(this.TabCur);
-	this.startTimer();
+    this.startTimer();
   },
   methods: {
     startTimer() {
@@ -263,10 +260,6 @@ export default {
           });
       });
     },
-    tabSelect(e) {
-      this.currentTab = e.currentTarget.dataset.id;
-      this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
-    },
     devicemenuShow(e) {
       this.menushow = !this.menushow;
     },

+ 1 - 1
pages/index/index.vue

@@ -29,7 +29,7 @@
     <Device
       v-if="PageCur == 'device'"
       :style="{ marginTop: wvTop + 20 + 'px' }"
-    />
+    ></Device>
     <filecenter :cur="PageCur" v-if="PageCur == 'filecenter'"></filecenter>
     <warndata v-if="PageCur == 'warndata'" :cur="PageCur"></warndata>
     <u-tabbar

+ 38 - 30
pages/operation/devicemenu/treeMenu/typeMenu.vue

@@ -1,5 +1,5 @@
 <template>
-  <view>
+  <view class="device-type-modal">
     <scroll-view>
       <!-- 通风设备 -->
       <view v-for="(typeitem, index) in typeList" :key="index">
@@ -55,6 +55,25 @@ export default {
       dot: {
         mailHome: false,
       },
+      iconMap: {
+        gate: "/static/sidebar/ventS/gate.svg",
+        window: "/static/sidebar/ventS/window.svg",
+        windrect: "/static/sidebar/ventS/windrect.svg",
+        fanmain: "/static/sidebar/ventS/fanmain.svg",
+        fanlocal: "/static/sidebar/ventS/fanlocal.svg",
+        drilling: "/static/sidebar/gasS/drilling.svg",
+        gasmonitor: "/static/sidebar/gasS/gasmonitor.svg",
+        pump: "/static/sidebar/gasS/pump.svg",
+        unit: "/static/sidebar/gasS/unit.svg",
+        dusting: "/static/sidebar/dustS/dusting.svg",
+        spray: "/static/sidebar/dustS/spray.svg",
+        bundletube: "/static/sidebar/fireS/bundletube.svg",
+        fiber: "/static/sidebar/fireS/fiber.svg",
+        nitrogen: "/static/sidebar/fireS/nitrogen.svg",
+        obfurage: "/static/sidebar/fireS/obfurage.svg",
+        pulping: "/static/sidebar/fireS/pulping.svg",
+        atomizing: "/static/sidebar/dustS/atomizing.svg",
+      },
     };
   },
   created() {
@@ -86,37 +105,26 @@ export default {
     goPage(page) {
       this.$emit("menuClick", page);
     },
-
     getIcon(itemValue) {
-      const iconMap = {
-        gate: "/static/sidebar/ventS/gate.svg",
-        window: "/static/sidebar/ventS/window.svg",
-        windrect: "/static/sidebar/ventS/windrect.svg",
-        fanmain: "/static/sidebar/ventS/fanmain.svg",
-        fanlocal: "/static/sidebar/ventS/fanlocal.svg",
-        drilling: "/static/sidebar/gasS/drilling.svg",
-        gasmonitor: "/static/sidebar/gasS/gasmonitor.svg",
-        pump: "/static/sidebar/gasS/pump.svg",
-        unit: "/static/sidebar/gasS/unit.svg",
-        dusting: "/static/sidebar/dustS/dusting.svg",
-        spray: "/static/sidebar/dustS/spray.svg",
-        bundletube: "/static/sidebar/fireS/bundletube.svg",
-        fiber: "/static/sidebar/fireS/fiber.svg",
-        nitrogen: "/static/sidebar/fireS/nitrogen.svg",
-        obfurage: "/static/sidebar/fireS/obfurage.svg",
-        pulping: "/static/sidebar/fireS/pulping.svg",
-        atomizing: "/static/sidebar/dustS/atomizing.svg",
-      };
-      // 根据itemValue获取对应的图标路径,如果找不到对应关系则返回默认图标
-      return iconMap[itemValue];
+      const defaultIconPath = "/static/sidebar/fireS/pulping.svg";
+
+      // 检查 iconMap 中是否存在对应的图标路径
+      if (itemValue && this.iconMap[itemValue]) {
+        return "/static/sidebar/" + itemValue + ".svg";
+      }
+      // 如果不存在对应的图标路径,则返回默认图标路径
+      return defaultIconPath;
     },
   },
 };
 </script>
 
-<style scoped>
+<style scoped lang="scss">
+.device-type-modal {
+  margin-top: 30rpx;
+}
 .cu-list.grid > .cu-item {
-  padding: 0px 0px;
+  padding: 0rpx 0rpx;
   background: linear-gradient(
     to right,
     rgba(55, 135, 254, 0.08),
@@ -125,15 +133,15 @@ export default {
   );
 }
 .line2-icon {
-  width: 60px;
-  height: 60px;
+  width: 60rpx;
+  height: 60rpx;
 }
 .icon {
   position: absolute;
-  top: 5px;
+  top: 5rpx;
   left: 50%;
   transform: translateX(-50%);
-  width: 20px;
-  height: 20px;
+  width: 20rpx;
+  height: 20rpx;
 }
 </style>

+ 4 - 4
pages/operation/operationModel.vue

@@ -2,9 +2,9 @@
   <view class="container">
     <!-- 建议放在外层 -->
     <u-navbar
-      title="设备中心"
+      title="操作历史"
       @leftClick="devicemenuShow"
-	  :safeAreaInsetTop="true"
+      :safeAreaInsetTop="true"
     >
       <view class="u-nav-slot" slot="left">
         <u-icon name="list" size="20"> </u-icon>
@@ -112,7 +112,7 @@ export default {
       TabCur: "gate",
       dataShow: false,
       dataShow1: false,
-      dataTime: dayjs().toDate().format('YYYY-MM-DD HH:mm:ss'),
+      dataTime: dayjs().toDate().format("YYYY-MM-DD HH:mm:ss"),
       deviceType: "gate", //设备类型
       StartTime: "",
       EndTime: "",
@@ -134,7 +134,7 @@ export default {
     const startTime = new Date(
       new Date(
         new Date().getTime() - 3600 * 1000 * 24 * 30
-      ).toLocaleDateString()
+      )
     );
     const endTime = new Date();
     this.StartTime = dayjs(startTime).format("YYYY-MM-DD HH:mm:ss");