Browse Source

增加离线设备 ,无id 相关提示

zhengkaixin 3 years ago
parent
commit
e06aa06e38
3 changed files with 25 additions and 5 deletions
  1. 13 1
      pages/charge/index.vue
  2. 8 1
      pages/charge/switchCharge.vue
  3. 4 3
      pages/index/index.vue

+ 13 - 1
pages/charge/index.vue

@@ -219,11 +219,23 @@
 				};
 				if(this.id){
 					data.deviceId=this.id
+				}else{
+					uni.showToast({
+						title:'链接超时,请重新扫码'
+					})
+					return
 				}
 				API.chargingData(data).then((res) => {
+					this.detail = res.data.chargingDevice;
+					
+					if(!this.detail .online){
+						uni.showToast({
+							title:'设备不在线,请扫描其他二维码'
+						})
+						return
+					}
 					
 					this.carhelp.set("qr-default-id",this.id);
-					this.detail = res.data.chargingDevice;
 					this.user = res.data.userAccount;
 					this.list=this.detail.chargeStatusArray
 					this.isReady=true;

+ 8 - 1
pages/charge/switchCharge.vue

@@ -73,9 +73,16 @@
 				uni.showLoading({
 					title:"加载中",mask:true,
 				})
+				if(this.select){
 				
+				}else{
+					uni.showToast({
+						title:'链接超时,请重新扫码'
+					})
+					return
+				}
 				var data={
-				 
+					deviceId:this.select
 				};
 				API.chargingDeviceData(data).then((res) => {
 						 

+ 4 - 3
pages/index/index.vue

@@ -44,10 +44,10 @@
 				</view>
 				<view class="chargeTime" v-if="item.status==2">
 					<h1>充电结束</h1>
-					{{item.updateTime}}:{{item.remark}}
+					{{item.updateTime}}{{item.remark?':'+item.remark:''}}
 				</view>
 				<view class="chargeTime" v-if="item.status==1">
-					<p>剩余时长</p>
+					<p>剩余时长<span>(时分)</span></p>
 					<u-line-progress active-color="#ececec" height="48" :percent="getPercent(item).percent">
 						<div style="     
 						border-radius: 100px;
@@ -213,7 +213,8 @@
 						var ms = item.estimateMinute * 60 - second
 						if (ms > 0) {
 							var Hour = parseInt(Math.floor(ms / (60 * 60)));
-							var Fen = parseInt(Math.floor(ms % (60 * 60) / 60));
+							var Fen = parseInt(Math.floor(ms % (60 * 60) / 60));
+							
 							obj.value = (Hour > 9 ? "" : "0") + Hour + ":" + (Fen > 9 ? "" : "0") + Fen
 						}