Bläddra i källkod

refactor: 优化多页面业务逻辑与展示细节

1. 给首页新增created钩子防抖调用登录接口
2. 完善虫害图片列表的时间格式化处理
3. 简化设备配置数据处理逻辑,移除冗余注释
4. 优化设备数据页面的开关展示与新增风扇状态列
allen 1 vecka sedan
förälder
incheckning
1cacc1c46c

+ 5 - 1
pages/cb/smallPest/photolist.vue

@@ -101,7 +101,11 @@
 					}
 				})
 				console.log(res)
-				this.imglists = res.data
+				const list = res.data
+				for (var i = 0; i < list.length; i++) {
+					list[i].time = this.timetab(list[i].addtime)
+				}
+				this.imglists = list
 			},
 			top() {
 				uni.pageScrollTo({

+ 4 - 6
pages/environment/equipment.vue

@@ -140,16 +140,14 @@
 				for (var key in res.conf) {
 					if (res.conf[key]) {
 						if (res.conf[key].indexOf("#") != -1) {
-							// let lable = res.conf[key].replace("#", "(") + ")"
-							console.log(res.conf[key])
-							// if(res.dat[key].split('#')[0] == -99.99) return
+							const conf = res.conf[key];
+							const unit = conf.replace("#", "(") + ")";
+							const unit2 = conf.split('#')[1];
 							this.olddata.push({
-								lable:res.conf[key].replace("#", "(") + ")",
+								lable:unit2 != ' ' ? unit : conf.split('#')[0],
 								value:res.dat[key].split('#')
 							})
-							// this.olddata[res.conf[key].replace("#", "(") + ")"] = res.dat[key].split("#")
 						} else {
-							// this.olddata[res.conf[key]] = res.dat[key].split("#")
 						}
 					}
 				}

+ 5 - 0
pages/index/index.vue

@@ -416,6 +416,11 @@
 			}, 500)();
 			this.checkLocationPermission(true); // 首次加载弹框提醒
 		},
+		created() {
+			Debounce(() => {
+				this.getUserlogin();
+			}, 500)();
+		},
 		onShow() {
 			this.loadTF = false;
 			Debounce(() => {

+ 19 - 4
pages/scd/components/deviceData.vue

@@ -24,8 +24,8 @@
       <view class="main-data-panel">
         <view class="data-column-left">
           <view class="data-item">
-            <text class="data-value">{{ objItem.ds == '1' ? '开机' : '关机' }}</text>
-            <text class="data-label">设备开</text>
+            <text class="data-value">{{ objItem.ds }}</text>
+            <text class="data-label">设备开</text>
           </view>
           <view class="data-item">
             <text class="data-value">{{ objItem.ws }}</text>
@@ -106,6 +106,7 @@
               <text class="header-cell">电压状态</text>
               <text class="header-cell">定时状态</text>
               <text class="header-cell">杀虫数量</text>
+              <text class="header-cell">风扇状态</text>
               <text class="header-cell">温度(°C)</text>
               <text class="header-cell">湿度(%)</text>
               <text class="header-cell">充电电压</text>
@@ -120,8 +121,8 @@
                 class="scrollable-row"
               >
                 <text class="body-cell">
-                  <view class="status-icon" :class="item.ds == 1 ? 'success-icon' : 'status-icon'"></view>
-                  {{ item.ds == 1? '打开' : '关闭' }}
+                  <view class="status-icon" :class="item.ds == '开机' ? 'success-icon' : 'status-icon'"></view>
+                  {{ item.ds }}
                 </text>
                 <text class="body-cell">
                   <view class="status-icon" :class="item.ws == '工作' ? 'success-icon' : 'warning-icon'"></view>
@@ -152,6 +153,7 @@
                   {{ item.tt }}
                 </text>
                 <text class="body-cell">{{ item.infr_ct }}</text>
+                <text class="body-cell">{{ getCtFormat(item.ct) }}</text>
                 <text class="body-cell">{{ item.at }}</text>
                 <text class="body-cell">{{ item.ah }}</text>
                 <text class="body-cell">{{ item.cv }}</text>
@@ -421,6 +423,19 @@ export default {
     },
   },
   methods: {
+    getCtFormat(ct){
+      if(ct == 0){
+        return '停止'
+      }else if(ct == 1){
+        return '启动'
+      }else if(ct == 2){
+        return '堵转'
+      }else if(ct == 3){
+        return '断路'
+      }else{
+        return ct
+      }
+    },
     async openPhoto(){
        const res = await this.$myRequest({
         url: '/api/api_gateway?method=forecast.send_control.admin_device_control',