Ver código fonte

feat:柏乡修改

yf_zhb 1 ano atrás
pai
commit
4fe5b378ba

Diferenças do arquivo suprimidas por serem muito extensas
+ 872 - 868
pages/cb/equip-detail/equip-detail.vue


+ 2 - 2
pages/cb/xy2.0/particulars.vue

@@ -13,10 +13,10 @@
 				<u-calendar v-model="glass_showtwo" mode="date" :max-date="date" @change="timeChangetwo"></u-calendar>
 			</view>
 			<view class="control">
-				<view class="control_item" @click="repairs">
+				<!-- <view class="control_item" @click="repairs">
 					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
 					<p>一键报修</p>
-				</view>
+				</view> -->
 				<view class="control_item" @click="toggle" v-if="$QueryPermission(176)">
 					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/cb/2.png'" mode=""></image>
 					<p>历史数据</p>

+ 1 - 1
pages/cbqxyj/cbwarn.vue

@@ -193,7 +193,7 @@
 			return {
 				date: "",
 				active: 0,
-				equipArr: ["预警记录", "预警发布", "预警设置"],
+				equipArr: ["预警记录"],
 				timeshow: false,
 				mode: 'range',
 				start_time: "",

Diferenças do arquivo suprimidas por serem muito extensas
+ 545 - 545
pages/environment/equipment.vue


Diferenças do arquivo suprimidas por serem muito extensas
+ 893 - 825
pages/index/index.vue


+ 253 - 248
pages/my/index/index.vue

@@ -1,248 +1,253 @@
-<template>
-	<view>
-		<view class="subject">
-			<view style="width: 100%;background-color: #FFFFFF;position: relative;">
-				<view class="personal">
-					<view class="personal_left">
-						<image :src="userinfos.image" mode="" @error="imageError"></image>
-					</view>
-					<view class="personal_center">
-						<p>{{usernames}}</p>
-						<p>{{userinfos.email?userinfos.email:userinfos.mobile}}</p>
-					</view>
-					<view class="personal_right" @click="userinfo">
-						<uni-icons type="compose" style="color: #FFFFFF;margin-right: 10rpx;"></uni-icons>
-						编辑
-					</view>
-				</view>
-			</view>
-			<view style="background-color: #FFFFFF;margin: 20rpx auto 0;">
-				<view class="AboutUs" @click="about">
-					<u-icon name="pingtai" custom-prefix="custom-icon" class="icon_left"></u-icon>
-					{{$isneutral?"关于我们":"关于更新"}}
-					<p class="update" v-if="updateTF">NEW</p>
-					<uni-icons type="arrowright" class="icon_right"></uni-icons>
-				</view>
-			</view>
-			<view style="background-color: #FFFFFF;">
-				<view class="quit" @click="outto">
-					<u-icon name="tuichudenglu" custom-prefix="custom-icon" class="icon_left"></u-icon>
-					退出登录
-					<uni-icons type="arrowright" class="icon_right"></uni-icons>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-<script>
-	export default {
-		data() {
-			return {
-				usernames: '',
-				userinfos: {},
-				versions: "",
-				updateTF: false
-			}
-		},
-		methods: {
-			async getEquipList() {
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=home.homes.app_version_record',
-					data: {
-						ret: "first"
-					}
-				})
-				console.log(res)
-				// this.appName = res[0].app_name
-				this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
-				var ids = Number(plus.runtime.version.match(/\d+/g).join(""))
-				if (this.versions > ids) {
-					this.updateTF = true
-				} else {
-					this.updateTF = false
-				}
-			},
-			//user.login.user_login_info
-			//home.homes.personal_center
-			async getUserlogin() {
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=user.login.user_login_info',
-				})
-				console.log(res.children)
-				this.usernames = res.username
-				this.getUsermsg(this.usernames)
-				uni.setStorage({
-					key: 'jurisdiction',
-					data: JSON.stringify(res.children),
-					success: () => {
-
-					}
-				})
-			},
-			async getuserinfonew() {
-				const res = await this.$myRequest({
-					url: '/api/v2/theme/home/info/',
-				})
-				if(res.items && res.items.logo_url){
-					this.userinfos.image = res.items.logo_url
-				} else{
-					this.userinfos.image = ''
-				}
-				
-			},
-			async getUsermsg(user) {
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=home.homes.personal_center',
-					data: {
-						username: user
-					}
-				})
-				this.userinfos = res
-				this.getuserinfonew()
-			}, //user.login.logout_user
-			async getlogout() {
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=user.login.logout_user',
-				})
-			},
-			about() {
-				uni.navigateTo({
-					url: "../about/about"
-				})
-			},
-			imageError(e) {
-				if (e) {
-					this.userinfos.image = "../../../static/images/my/user.png"
-				}
-			},
-			userinfo() {
-				uni.navigateTo({
-					url: "../user-info/user-info?data=" + JSON.stringify(this.userinfos)
-				})
-			},
-			outto() {
-				uni.showModal({
-					title: '提示',
-					content: '是否退出登录',
-					success: (res) => {
-						if (res.confirm) {
-							this.getlogout()
-							uni.removeStorage({
-								key: "session_key"
-							})
-							uni.reLaunch({
-								url: "../../login/login"
-							})
-						} else if (res.cancel) {
-							console.log('用户点击取消');
-						}
-					}
-				});
-			}
-		},
-		onLoad() {
-			this.getUserlogin()
-			this.getEquipList()
-		},
-		onShow() {
-			this.getUserlogin()
-			this.$forceUpdate()
-		}
-	}
-</script>
-<style lang="scss">
-	.subject {
-		width: 100%;
-		height: 100vh;
-		background-color: #F9F9F9;
-	}
-
-	.personal {
-		width: 90%;
-		margin: 0 auto;
-		display: flex;
-		padding: 20rpx 0 40rpx;
-		box-sizing: border-box;
-
-		.personal_left {
-			width: 18%;
-			margin-right: 30rpx;
-
-			image {
-				width: 124rpx;
-				height: 120rpx;
-				border-radius: 60rpx;
-			}
-		}
-
-		.personal_center {
-			padding-top: 20rpx;
-
-			p:nth-child(1) {
-				font-size: 34rpx;
-				font-weight: 700;
-				margin-bottom: 10rpx;
-			}
-
-			p:nth-child(2) {
-				font-size: 24rpx;
-			}
-		}
-
-		.personal_right {
-			width: 150rpx;
-			background-color: #55C87B;
-			height: 60rpx;
-			text-align: center;
-			border-radius: 30rpx;
-			line-height: 60rpx;
-			color: #FFFFFF;
-			position: absolute;
-			top: 50rpx;
-			right: 30rpx;
-		}
-	}
-
-	.AboutUs,
-	.quit,
-	.opinion {
-		width: 90%;
-		height: 100rpx;
-		line-height: 100rpx;
-		margin: 20rpx auto 0;
-		position: relative;
-		padding-left: 20rpx;
-		font-size: 28rpx;
-
-		.icon_left {
-			margin-right: 20rpx;
-			color: #55C87B !important;
-			font-size: 32rpx;
-		}
-
-		.icon_right {
-			position: absolute;
-			top: 0;
-			right: 10rpx;
-			font-size: 32rpx !important;
-		}
-
-		.update {
-			position: absolute;
-			top: 34rpx;
-			right: 40rpx;
-			font-size: 16rpx !important;
-			background-color: #f00;
-			border-radius: 25rpx;
-			height: 30rpx;
-			padding: 2rpx 16rpx;
-			line-height: 30rpx;
-			color: #fff;
-		}
-	}
-
-	.opinion {
-		margin: 0 auto;
-		border-top: 2rpx solid #EAEAEA;
-	}
-</style>
+<template>
+  <view>
+    <view class="subject">
+      <view style="width: 100%; background-color: #ffffff; position: relative">
+        <view class="personal">
+          <view class="personal_left">
+            <image :src="userinfos.image" mode="" @error="imageError"></image>
+          </view>
+          <view class="personal_center">
+            <p>{{ usernames }}</p>
+            <p>{{ userinfos.email ? userinfos.email : userinfos.mobile }}</p>
+          </view>
+          <!-- <view class="personal_right" @click="userinfo">
+						<uni-icons type="compose" style="color: #FFFFFF;margin-right: 10rpx;"></uni-icons>
+						编辑
+					</view> -->
+        </view>
+      </view>
+      <view style="background-color: #ffffff; margin: 20rpx auto 0">
+        <view class="AboutUs" @click="about">
+          <u-icon
+            name="pingtai"
+            custom-prefix="custom-icon"
+            class="icon_left"
+          ></u-icon>
+          {{ $isneutral ? '关于我们' : '关于更新' }}
+          <p class="update" v-if="updateTF">NEW</p>
+          <uni-icons type="arrowright" class="icon_right"></uni-icons>
+        </view>
+      </view>
+      <view style="background-color: #ffffff">
+        <view class="quit" @click="outto">
+          <u-icon
+            name="tuichudenglu"
+            custom-prefix="custom-icon"
+            class="icon_left"
+          ></u-icon>
+          退出登录
+          <uni-icons type="arrowright" class="icon_right"></uni-icons>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+<script>
+export default {
+  data() {
+    return {
+      usernames: '',
+      userinfos: {},
+      versions: '',
+      updateTF: false,
+    };
+  },
+  methods: {
+    async getEquipList() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=home.homes.app_version_record',
+        data: {
+          ret: 'first',
+        },
+      });
+      console.log(res);
+      // this.appName = res[0].app_name
+      this.versions = Number(res[0].app_num.match(/\d+/g).join(''));
+      var ids = Number(plus.runtime.version.match(/\d+/g).join(''));
+      if (this.versions > ids) {
+        this.updateTF = true;
+      } else {
+        this.updateTF = false;
+      }
+    },
+    //user.login.user_login_info
+    //home.homes.personal_center
+    async getUserlogin() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=user.login.user_login_info',
+      });
+      console.log(res,'login user');
+      this.usernames = res.username;
+      this.getUsermsg(this.usernames);
+      uni.setStorage({
+        key: 'jurisdiction',
+        data: JSON.stringify(res.children),
+        success: () => {},
+      });
+    },
+    async getuserinfonew() {
+      const res = await this.$myRequest({
+        url: '/api/v2/theme/home/info/',
+      });
+      if (res.items && res.items.logo_url) {
+        this.userinfos.image = res.items.logo_url;
+      } else {
+        this.userinfos.image = '';
+      }
+    },
+    async getUsermsg(user) {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=home.homes.personal_center',
+        data: {
+          username: user,
+        },
+      });
+      this.userinfos = res;
+      this.getuserinfonew();
+    }, //user.login.logout_user
+    async getlogout() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=user.login.logout_user',
+      });
+    },
+    about() {
+      uni.navigateTo({
+        url: '../about/about',
+      });
+    },
+    imageError(e) {
+      if (e) {
+        this.userinfos.image = '../../../static/images/my/user.png';
+      }
+    },
+    userinfo() {
+      uni.navigateTo({
+        url: '../user-info/user-info?data=' + JSON.stringify(this.userinfos),
+      });
+    },
+    outto() {
+      uni.showModal({
+        title: '提示',
+        content: '是否退出登录',
+        success: (res) => {
+          if (res.confirm) {
+            this.getlogout();
+            uni.removeStorage({
+              key: 'session_key',
+            });
+            uni.reLaunch({
+              url: '../../login/login',
+            });
+          } else if (res.cancel) {
+            console.log('用户点击取消');
+          }
+        },
+      });
+    },
+  },
+  onLoad() {
+    this.getUserlogin();
+    this.getEquipList();
+  },
+  onShow() {
+    this.getUserlogin();
+    this.$forceUpdate();
+  },
+};
+</script>
+<style lang="scss">
+.subject {
+  width: 100%;
+  height: 100vh;
+  background-color: #f9f9f9;
+}
+
+.personal {
+  width: 90%;
+  margin: 0 auto;
+  display: flex;
+  padding: 20rpx 0 40rpx;
+  box-sizing: border-box;
+
+  .personal_left {
+    width: 18%;
+    margin-right: 30rpx;
+
+    image {
+      width: 124rpx;
+      height: 120rpx;
+      border-radius: 60rpx;
+    }
+  }
+
+  .personal_center {
+    padding-top: 20rpx;
+
+    p:nth-child(1) {
+      font-size: 34rpx;
+      font-weight: 700;
+      margin-bottom: 10rpx;
+    }
+
+    p:nth-child(2) {
+      font-size: 24rpx;
+    }
+  }
+
+  .personal_right {
+    width: 150rpx;
+    background-color: #55c87b;
+    height: 60rpx;
+    text-align: center;
+    border-radius: 30rpx;
+    line-height: 60rpx;
+    color: #ffffff;
+    position: absolute;
+    top: 50rpx;
+    right: 30rpx;
+  }
+}
+
+.AboutUs,
+.quit,
+.opinion {
+  width: 90%;
+  height: 100rpx;
+  line-height: 100rpx;
+  margin: 20rpx auto 0;
+  position: relative;
+  padding-left: 20rpx;
+  font-size: 28rpx;
+
+  .icon_left {
+    margin-right: 20rpx;
+    color: #55c87b !important;
+    font-size: 32rpx;
+  }
+
+  .icon_right {
+    position: absolute;
+    top: 0;
+    right: 10rpx;
+    font-size: 32rpx !important;
+  }
+
+  .update {
+    position: absolute;
+    top: 34rpx;
+    right: 40rpx;
+    font-size: 16rpx !important;
+    background-color: #f00;
+    border-radius: 25rpx;
+    height: 30rpx;
+    padding: 2rpx 16rpx;
+    line-height: 30rpx;
+    color: #fff;
+  }
+}
+
+.opinion {
+  margin: 0 auto;
+  border-top: 2rpx solid #eaeaea;
+}
+</style>

+ 384 - 384
pages/prevention/equipmentdetails.vue

@@ -1,384 +1,384 @@
-<template>
-	<view>
-		<view class="status_bar"></view>
-		<view class="" style="position: relative;top: 44px;">
-			<view style="position: fixed;z-index: 100;width: 100%;">
-				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
-			</view>
-			<view class="info">
-				<view class="info_item">
-					<image
-						:src="eqinfo.item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png'"
-						mode="" class="bgi"></image>
-					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
-						ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
-						<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
-							class="tishi"></image>
-					</p>
-					<p>设备名称:{{eqinfo.item.device_name}}</p>
-					<p>设备型号:{{eqinfo.item.dtype}}</p>
-					<p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
-					<p>设备地址:{{eqinfo.item.address||city}}</p>
-				</view>
-			</view>
-			<view class="control">
-				<view class="control_item" v-if="$QueryPermission(75)" @click="control">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
-					<p>设备控制</p>
-				</view>
-				<view class="control_item" v-if="$QueryPermission(77)" @click="charts">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
-					<p>历史数据</p>
-				</view>
-				<view class="control_item" v-if="$QueryPermission(76)" @click="sim">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/9.png'" mode=""></image>
-					<p>SIM卡详情</p>
-				</view>
-				<view class="control_item" @click="repairs">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
-					<p>一键报修</p>
-				</view>
-			</view>
-			<view class="realtime">
-				<p class="realtime_title">实时数据</p>
-				<view class="realtime_tishi" v-if="!newdatesTF && !dataloadingtf">
-					暂无数据
-				</view>
-				<view class="realtime_text" v-else>
-					<view class="realtime_text_item">
-						<view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
-							<view class="item_info_img">
-								<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode=""></image>
-							</view>
-							<view class="item_info_text">
-								<p>{{item.txt}}</p>
-								<p style="margin-top: 20rpx;">{{item.value}}</p>
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="realtime_tishi" v-if="dataloadingtf">
-					<p class="dataloading">加载中</p>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-<script>
-	export default {
-		data() {
-			return {
-				eqinfo: {},
-				olddata: {},
-				olddatas: [],
-				newdatesTF: false, //暂无数据显示隐藏
-				work: "",
-				shujutf: false,
-				kongtf: false,
-				simtf: false,
-				city: "",
-				dataloadingtf: true, //加载中显示隐藏
-			}
-		},
-		methods: {
-			modification() {
-				this.olddatas = [{
-						icon: '/image/cb/icon02.png',
-						txt: '设备开关',
-						value: Number(this.olddata.ds) == 1 ? '开机' : "关机",
-					},
-					{
-						icon: '/image/cb/icon05.png',
-						txt: '工作状态',
-						value: this.work
-					},
-					{
-						icon: '/image/prevention/44.png',
-						txt: '电击次数',
-						value: this.olddata.ct
-					},
-					{
-						icon: '/image/prevention/33.png',
-						txt: '定时时长',
-						value: this.olddata.tt
-					}, {
-						icon: '/image/cb/icon08.png',
-						txt: '环境温度(℃)',
-						value: this.olddata.at == "" ? "--" : this.olddata.at
-					}, {
-						icon: '/image/cb/icon07.png',
-						txt: '环境湿度(%)',
-						value: this.olddata.ah == "" ? "--" : this.olddata.ah
-					}, {
-						icon: '/image/prevention/icon16.png',
-						txt: '信号强度',
-						value: this.olddata.csq
-					}, {
-						icon: '/image/prevention/100.png',
-						txt: '清虫间隔(min)',
-						value: this.olddata.clt_t
-					}, {
-						icon: '/image/prevention/101.png',
-						txt: '雨控状态',
-						value: Number(this.olddata.rps) == 1 ? "雨控" : '正常'
-					}, {
-						icon: '/image/prevention/102.png',
-						txt: '温控状态',
-						value: Number(this.olddata.tps) == 1 ? "温控" : '正常'
-					},
-					{
-						icon: '/image/prevention/105.png',
-						txt: '充电电压',
-						value: this.olddata.cv
-					},
-					{
-						icon: '/image/prevention/106.png',
-						txt: '电池电压',
-						value: Number(this.olddata.bv)
-					}
-				]
-			},
-			async history() { //设备列表
-				var newtime = +new Date() / 1000
-				var oldtime = newtime - 24 * 60 * 60
-				this.dataloadingtf = true
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
-					data: {
-						device_type_id: 2,
-						device_id: this.eqinfo.item.imei,
-						start_time: parseInt(oldtime),
-						end_time: parseInt(newtime)
-					}
-				})
-				this.dataloadingtf = false
-				if (res.data.length != 0) {
-					this.olddata = res.data[0].d_h_t
-					this.newdatesTF = true
-					if (Number(this.olddata.ws) == 0) {
-						this.work = "待机"
-					} else if (Number(this.olddata.ws) == 1) {
-						this.work = "工作"
-					} else {
-						this.work = "充电"
-					}
-				} else {
-					this.newdatesTF = false
-				}
-				this.modification()
-			},
-			async eqlist(id) { //搜索
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
-					data: {
-						device_type_id: 2,
-						device_id: id
-					}
-				})
-				this.eqinfo.item = res.data[0]
-				console.log(res.data[0])
-				this.history()
-			},
-			clickLeft() {
-				uni.navigateBack({
-					delta: 1
-				})
-			},
-			sim() {
-				// sim卡详情
-				uni.navigateTo({
-					url: "./sim?id=" + this.eqinfo.item.d_id
-				})
-			},
-			repairs() {
-				console.log(this.eqinfo.item)
-				var device_id = this.eqinfo.item.imei
-				uni.navigateTo({
-					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 2
-				})
-			},
-			control() { //设备控制
-				uni.navigateTo({
-					url: "./control?id=" + this.eqinfo.item.d_id
-				})
-			},
-			charts() { //历史数据
-				uni.navigateTo({
-					url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
-				})
-			},
-			copy(item) {
-				uni.setClipboardData({
-					data: item,
-					success: function() {
-						console.log('success');
-					}
-				});
-			},
-			selectaddress(lat, lng) { //获取分布位置
-				uni.request({
-					type: "GET",
-					url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
-						"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
-					dataType: "json",
-					complete: ress => {
-						console.log(ress.data.regeocode.formatted_address)
-						if (ress.data.regeocode.formatted_address.length == 0) {
-							this.city = "--"
-						} else {
-							this.city = ress.data.regeocode.formatted_address
-						}
-					}
-				});
-			},
-		},
-		onLoad(option) {
-			this.$forceUpdate()
-			this.eqinfo.item = JSON.parse(option.shebei)
-			console.log(JSON.parse(option.shebei))
-			this.eqlist(JSON.parse(option.shebei).device_id || JSON.parse(option.shebei).imei)
-			this.selectaddress(this.eqinfo.item.lat, this.eqinfo.item.lng)
-		}
-	}
-</script>
-
-<style lang="scss">
-	.info {
-		width: 100%;
-		position: absolute;
-		top: 44px;
-
-		.info_item {
-			width: 90%;
-			margin: 0 auto;
-			height: 280rpx;
-			padding: 26rpx 50rpx;
-			position: relative;
-			box-sizing: border-box;
-
-			.bgi {
-				width: 100%;
-				height: 280rpx;
-				position: absolute;
-				top: 0;
-				left: 0;
-				z-index: -1;
-			}
-
-			p {
-				font-size: 24rpx;
-				color: #FFFFFF;
-				margin-bottom: 10rpx;
-
-				.tishi {
-					width: 30rpx;
-					height: 30rpx;
-					margin: 0rpx 0 0 20rpx;
-				}
-			}
-		}
-	}
-
-	.control {
-		width: 90%;
-		position: absolute;
-		top: 392rpx;
-		left: 5%;
-		display: flex;
-		justify-content: space-between;
-		text-align: center;
-		padding: 0 30rpx;
-		box-sizing: border-box;
-
-		.control_item {
-			width: 120rpx;
-			height: 120rpx;
-
-			image {
-				width: 70rpx;
-				height: 70rpx;
-			}
-
-			p {
-				font-size: 24rpx;
-			}
-		}
-	}
-
-	.realtime {
-		width: 100%;
-		position: absolute;
-		top: 520rpx;
-
-		.realtime_title {
-			font-weight: 700;
-			width: 90%;
-			margin: 0 auto;
-		}
-		.dataloading:after {
-			overflow: hidden;
-			display: inline-block;
-			vertical-align: bottom;
-			animation: ellipsis 2s infinite;
-			content: "\2026";
-		}
-
-		@keyframes ellipsis {
-			from {
-				width: 2px;
-			}
-
-			to {
-				width: 15px;
-			}
-		}
-
-		.realtime_tishi {
-			width: 90%;
-			margin: 0 auto;
-			text-align: center;
-			font-size: 32rpx;
-			padding-top: 40rpx;
-		}
-
-		.realtime_text {
-			width: 90%;
-			margin: 0 auto;
-
-			.realtime_text_item {
-				width: 100%;
-				display: flex;
-				justify-content: space-between;
-				flex-wrap: wrap;
-				margin-bottom: 50rpx;
-
-				.realtime_text_item_info {
-					width: 48%;
-					box-shadow: 0 0 10rpx #bcb9ca;
-					margin-top: 20rpx;
-					display: flex;
-					padding: 20rpx 20rpx;
-					box-sizing: border-box;
-
-					.item_info_img {
-						width: 30%;
-						text-align: center;
-						margin-right: 30rpx;
-
-						image {
-							width: 64rpx;
-							height: 64rpx;
-							margin-top: 10rpx;
-						}
-					}
-
-					.item_info_text {
-						font-size: 24rpx;
-
-					}
-				}
-			}
-		}
-
-	}
-</style>
+<template>
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative;top: 44px;">
+			<view style="position: fixed;z-index: 100;width: 100%;">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
+			</view>
+			<view class="info">
+				<view class="info_item">
+					<image
+						:src="eqinfo.item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png'"
+						mode="" class="bgi"></image>
+					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
+						ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
+						<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
+							class="tishi"></image>
+					</p>
+					<p>设备名称:{{eqinfo.item.device_name}}</p>
+					<p>设备型号:{{eqinfo.item.dtype}}</p>
+					<p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
+					<p>设备地址:{{eqinfo.item.address||city}}</p>
+				</view>
+			</view>
+			<view class="control">
+				<view class="control_item" v-if="$QueryPermission(75)" @click="control">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
+					<p>设备控制</p>
+				</view>
+				<view class="control_item" v-if="$QueryPermission(77)" @click="charts">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
+					<p>历史数据</p>
+				</view>
+				<view class="control_item" v-if="$QueryPermission(76)" @click="sim">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/9.png'" mode=""></image>
+					<p>SIM卡详情</p>
+				</view>
+				<!-- <view class="control_item" @click="repairs">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
+					<p>一键报修</p>
+				</view> -->
+			</view>
+			<view class="realtime">
+				<p class="realtime_title">实时数据</p>
+				<view class="realtime_tishi" v-if="!newdatesTF && !dataloadingtf">
+					暂无数据
+				</view>
+				<view class="realtime_text" v-else>
+					<view class="realtime_text_item">
+						<view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
+							<view class="item_info_img">
+								<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode=""></image>
+							</view>
+							<view class="item_info_text">
+								<p>{{item.txt}}</p>
+								<p style="margin-top: 20rpx;">{{item.value}}</p>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="realtime_tishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	export default {
+		data() {
+			return {
+				eqinfo: {},
+				olddata: {},
+				olddatas: [],
+				newdatesTF: false, //暂无数据显示隐藏
+				work: "",
+				shujutf: false,
+				kongtf: false,
+				simtf: false,
+				city: "",
+				dataloadingtf: true, //加载中显示隐藏
+			}
+		},
+		methods: {
+			modification() {
+				this.olddatas = [{
+						icon: '/image/cb/icon02.png',
+						txt: '设备开关',
+						value: Number(this.olddata.ds) == 1 ? '开机' : "关机",
+					},
+					{
+						icon: '/image/cb/icon05.png',
+						txt: '工作状态',
+						value: this.work
+					},
+					{
+						icon: '/image/prevention/44.png',
+						txt: '电击次数',
+						value: this.olddata.ct
+					},
+					{
+						icon: '/image/prevention/33.png',
+						txt: '定时时长',
+						value: this.olddata.tt
+					}, {
+						icon: '/image/cb/icon08.png',
+						txt: '环境温度(℃)',
+						value: this.olddata.at == "" ? "--" : this.olddata.at
+					}, {
+						icon: '/image/cb/icon07.png',
+						txt: '环境湿度(%)',
+						value: this.olddata.ah == "" ? "--" : this.olddata.ah
+					}, {
+						icon: '/image/prevention/icon16.png',
+						txt: '信号强度',
+						value: this.olddata.csq
+					}, {
+						icon: '/image/prevention/100.png',
+						txt: '清虫间隔(min)',
+						value: this.olddata.clt_t
+					}, {
+						icon: '/image/prevention/101.png',
+						txt: '雨控状态',
+						value: Number(this.olddata.rps) == 1 ? "雨控" : '正常'
+					}, {
+						icon: '/image/prevention/102.png',
+						txt: '温控状态',
+						value: Number(this.olddata.tps) == 1 ? "温控" : '正常'
+					},
+					{
+						icon: '/image/prevention/105.png',
+						txt: '充电电压',
+						value: this.olddata.cv
+					},
+					{
+						icon: '/image/prevention/106.png',
+						txt: '电池电压',
+						value: Number(this.olddata.bv)
+					}
+				]
+			},
+			async history() { //设备列表
+				var newtime = +new Date() / 1000
+				var oldtime = newtime - 24 * 60 * 60
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
+					data: {
+						device_type_id: 2,
+						device_id: this.eqinfo.item.imei,
+						start_time: parseInt(oldtime),
+						end_time: parseInt(newtime)
+					}
+				})
+				this.dataloadingtf = false
+				if (res.data.length != 0) {
+					this.olddata = res.data[0].d_h_t
+					this.newdatesTF = true
+					if (Number(this.olddata.ws) == 0) {
+						this.work = "待机"
+					} else if (Number(this.olddata.ws) == 1) {
+						this.work = "工作"
+					} else {
+						this.work = "充电"
+					}
+				} else {
+					this.newdatesTF = false
+				}
+				this.modification()
+			},
+			async eqlist(id) { //搜索
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
+					data: {
+						device_type_id: 2,
+						device_id: id
+					}
+				})
+				this.eqinfo.item = res.data[0]
+				console.log(res.data[0])
+				this.history()
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			sim() {
+				// sim卡详情
+				uni.navigateTo({
+					url: "./sim?id=" + this.eqinfo.item.d_id
+				})
+			},
+			repairs() {
+				console.log(this.eqinfo.item)
+				var device_id = this.eqinfo.item.imei
+				uni.navigateTo({
+					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 2
+				})
+			},
+			control() { //设备控制
+				uni.navigateTo({
+					url: "./control?id=" + this.eqinfo.item.d_id
+				})
+			},
+			charts() { //历史数据
+				uni.navigateTo({
+					url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
+				})
+			},
+			copy(item) {
+				uni.setClipboardData({
+					data: item,
+					success: function() {
+						console.log('success');
+					}
+				});
+			},
+			selectaddress(lat, lng) { //获取分布位置
+				uni.request({
+					type: "GET",
+					url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
+						"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
+					dataType: "json",
+					complete: ress => {
+						console.log(ress.data.regeocode.formatted_address)
+						if (ress.data.regeocode.formatted_address.length == 0) {
+							this.city = "--"
+						} else {
+							this.city = ress.data.regeocode.formatted_address
+						}
+					}
+				});
+			},
+		},
+		onLoad(option) {
+			this.$forceUpdate()
+			this.eqinfo.item = JSON.parse(option.shebei)
+			console.log(JSON.parse(option.shebei))
+			this.eqlist(JSON.parse(option.shebei).device_id || JSON.parse(option.shebei).imei)
+			this.selectaddress(this.eqinfo.item.lat, this.eqinfo.item.lng)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.info {
+		width: 100%;
+		position: absolute;
+		top: 44px;
+
+		.info_item {
+			width: 90%;
+			margin: 0 auto;
+			height: 280rpx;
+			padding: 26rpx 50rpx;
+			position: relative;
+			box-sizing: border-box;
+
+			.bgi {
+				width: 100%;
+				height: 280rpx;
+				position: absolute;
+				top: 0;
+				left: 0;
+				z-index: -1;
+			}
+
+			p {
+				font-size: 24rpx;
+				color: #FFFFFF;
+				margin-bottom: 10rpx;
+
+				.tishi {
+					width: 30rpx;
+					height: 30rpx;
+					margin: 0rpx 0 0 20rpx;
+				}
+			}
+		}
+	}
+
+	.control {
+		width: 90%;
+		position: absolute;
+		top: 392rpx;
+		left: 5%;
+		display: flex;
+		justify-content: space-between;
+		text-align: center;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+
+		.control_item {
+			width: 120rpx;
+			height: 120rpx;
+
+			image {
+				width: 70rpx;
+				height: 70rpx;
+			}
+
+			p {
+				font-size: 24rpx;
+			}
+		}
+	}
+
+	.realtime {
+		width: 100%;
+		position: absolute;
+		top: 520rpx;
+
+		.realtime_title {
+			font-weight: 700;
+			width: 90%;
+			margin: 0 auto;
+		}
+		.dataloading:after {
+			overflow: hidden;
+			display: inline-block;
+			vertical-align: bottom;
+			animation: ellipsis 2s infinite;
+			content: "\2026";
+		}
+
+		@keyframes ellipsis {
+			from {
+				width: 2px;
+			}
+
+			to {
+				width: 15px;
+			}
+		}
+
+		.realtime_tishi {
+			width: 90%;
+			margin: 0 auto;
+			text-align: center;
+			font-size: 32rpx;
+			padding-top: 40rpx;
+		}
+
+		.realtime_text {
+			width: 90%;
+			margin: 0 auto;
+
+			.realtime_text_item {
+				width: 100%;
+				display: flex;
+				justify-content: space-between;
+				flex-wrap: wrap;
+				margin-bottom: 50rpx;
+
+				.realtime_text_item_info {
+					width: 48%;
+					box-shadow: 0 0 10rpx #bcb9ca;
+					margin-top: 20rpx;
+					display: flex;
+					padding: 20rpx 20rpx;
+					box-sizing: border-box;
+
+					.item_info_img {
+						width: 30%;
+						text-align: center;
+						margin-right: 30rpx;
+
+						image {
+							width: 64rpx;
+							height: 64rpx;
+							margin-top: 10rpx;
+						}
+					}
+
+					.item_info_text {
+						font-size: 24rpx;
+
+					}
+				}
+			}
+		}
+
+	}
+</style>

+ 1 - 1
pages/qxzyj/cbwarn.vue

@@ -193,7 +193,7 @@
 				device_type:'',
 				date: "",
 				active: 0,
-				equipArr: ["预警记录", "预警发布", "预警设置"],
+				equipArr: ["预警记录"],
 				timeshow: false,
 				mode: 'range',
 				start_time: "",

+ 320 - 320
pages/waterandfer/datails.vue

@@ -1,320 +1,320 @@
-<template>
-	<view>
-		<view class="status_bar"></view>
-		<view class="" style="position: relative;top: 44px;">
-			<view style="position: fixed;z-index: 100;width: 100%;">
-				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
-			</view>
-			<view class="info">
-				<view class="info_item">
-					<!-- <image
-						:src="eqinfo.item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png'"
-						mode="" class="bgi"></image> -->
-					<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png" mode="" class="bgi"></image>
-					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
-						ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
-						<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
-							class="tishi"></image>
-					</p>
-					<p>设备名称:{{eqinfo.item.device_name}}</p>
-					<p>设备型号:水肥一体化</p>
-					<p>最近上报时间:{{eqinfo.item.uptime|timeFormat()}}</p>
-					<p>设备地址:{{city}}</p>
-				</view>
-			</view>
-			<view class="control">
-				<view class="control_item" v-if="$QueryPermission(196)" @click="control">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
-					<p>设备状态</p>
-				</view>
-				<view class="control_item" v-if="$QueryPermission(197)" @click="charts">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
-					<p>要素数据</p>
-				</view>
-				<view class="control_item" @click="repairs">
-					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
-					<p>一键报修</p>
-				</view>
-			</view>
-			<view class="realtime">
-				<p class="realtime_title">实时数据</p>
-				<view class="realtime_tishi" v-if="olddatas.length==0 && dataloadingtf == false">
-					暂无数据
-				</view>
-				<view class="realtime_text" v-else>
-					<view class="realtime_text_item">
-						<view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
-							<view class="item_info_img">
-								<image :src="'http://www.hnyfwlw.com:8006/bigdata_pc/sf/dev/icon_'+item.icon+'.png'"
-									mode=""></image>
-							</view>
-							<view class="item_info_text">
-								<p>{{item.txt}}</p>
-								<p style="margin-top: 20rpx;">{{item.value}}</p>
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="realtime_tishi" v-if="dataloadingtf">
-					<p class="dataloading">加载中</p>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-<script>
-	import elelist from "../../static/json/eleList.json"
-	export default {
-		data() {
-			return {
-				eqinfo: {
-				},
-				olddata: {},
-				olddatas: [],
-				newdatesTF: false, //暂无数据显示隐藏
-				work: "",
-				zttf: false,
-				ystf: false,
-				city: "",
-				dataloadingtf: true, //加载中显示隐藏
-			}
-		},
-		methods: {
-			async history() { //设备列表
-				var newtime = +new Date() / 1000
-				var oldtime = newtime - 24 * 60 * 60
-				this.dataloadingtf = true
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=weather.weather.sf_status',
-					data: {
-						device_id: this.eqinfo.item.device_id
-					}
-				})
-				this.dataloadingtf = false
-				console.log(res)
-				this.olddatas = []
-				var dataarr = res.conf.eleName.split("/")
-				var elearr = res.conf.eleNum.split("/")
-				var numarr = JSON.stringify(res.dat.device_status).slice(2, -2)
-				numarr = numarr.split(",")
-				var numobj = {}
-				for (var i = 0; i < numarr.length; i++) {
-					numarr[i] = numarr[i].split(":")
-					var index = numarr[i][0].indexOf("e")==-1?numarr[i][0].indexOf("j"):numarr[i][0].indexOf("e")
-					numobj[numarr[i][0].slice(index, -1)] = Number(numarr[i][1])
-				}
-				console.log(numobj)
-				// for(var key in numarr){
-				// 	console.log(numarr[key])
-				// }
-				for (var i = 0; i < dataarr.length; i++) {
-					if(dataarr[i]!="-"){
-						var obj = {
-							txt: dataarr[i],
-							icon: elearr[i],
-							value: numobj['e'+(i+1)] + elelist[elearr[i]].unit
-						}
-						this.olddatas.push(obj)
-					}
-				}
-				console.log(this.olddatas)
-			},
-			clickLeft() {
-				uni.navigateBack({
-					delta: 1
-				})
-			},
-			repairs() {
-				console.log(this.eqinfo.item)
-				var device_id = this.eqinfo.item.device_id
-				uni.navigateTo({
-					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 13
-				})
-			},
-			control() { //设备控制
-				uni.navigateTo({
-					url: "./basestate?device_id=" + this.eqinfo.item.device_id
-				})
-			},
-			charts() { //历史数据
-				uni.navigateTo({
-					url: "./elementdata?device_id=" + this.eqinfo.item.device_id
-				})
-			},
-			copy(item) {
-				uni.setClipboardData({
-					data: item,
-					success: function() {
-						console.log('success');
-					}
-				});
-			},
-			selectaddress(lat, lng) { //获取分布位置
-				uni.request({
-					type: "GET",
-					url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
-						"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
-					dataType: "json",
-					complete: ress => {
-						console.log(ress.data.regeocode.formatted_address)
-						if (ress.data.regeocode.formatted_address.length == 0) {
-							this.city = "暂无"
-						} else {
-							this.city = ress.data.regeocode.formatted_address
-						}
-					}
-				});
-			},
-		},
-		onLoad(option) {
-			this.$forceUpdate()
-			this.eqinfo.item = JSON.parse(option.shebei)
-			console.log(JSON.parse(option.shebei))
-			this.history()
-			this.selectaddress(this.eqinfo.item.lat, this.eqinfo.item.lng)
-		}
-	}
-</script>
-
-<style lang="scss">
-	.info {
-		width: 100%;
-		position: absolute;
-		top: 44px;
-
-		.info_item {
-			width: 90%;
-			margin: 0 auto;
-			height: 280rpx;
-			padding: 26rpx 50rpx;
-			position: relative;
-			box-sizing: border-box;
-
-			.bgi {
-				width: 100%;
-				height: 280rpx;
-				position: absolute;
-				top: 0;
-				left: 0;
-				z-index: -1;
-			}
-
-			p {
-				font-size: 24rpx;
-				color: #FFFFFF;
-				margin-bottom: 10rpx;
-
-				.tishi {
-					width: 30rpx;
-					height: 30rpx;
-					margin: 0rpx 0 0 20rpx;
-				}
-			}
-		}
-	}
-
-	.control {
-		width: 90%;
-		position: absolute;
-		top: 392rpx;
-		left: 5%;
-		display: flex;
-		justify-content: space-between;
-		text-align: center;
-		padding: 0 30rpx;
-		box-sizing: border-box;
-
-		.control_item {
-			width: 120rpx;
-			height: 120rpx;
-
-			image {
-				width: 70rpx;
-				height: 70rpx;
-			}
-
-			p {
-				font-size: 24rpx;
-			}
-		}
-	}
-
-	.realtime {
-		width: 100%;
-		position: absolute;
-		top: 520rpx;
-
-		.realtime_title {
-			font-weight: 700;
-			width: 90%;
-			margin: 0 auto;
-		}
-
-		.dataloading:after {
-			overflow: hidden;
-			display: inline-block;
-			vertical-align: bottom;
-			animation: ellipsis 2s infinite;
-			content: "\2026";
-		}
-
-		@keyframes ellipsis {
-			from {
-				width: 2px;
-			}
-
-			to {
-				width: 15px;
-			}
-		}
-
-		.realtime_tishi {
-			width: 90%;
-			margin: 0 auto;
-			text-align: center;
-			font-size: 32rpx;
-			padding-top: 40rpx;
-		}
-
-		.realtime_text {
-			width: 90%;
-			margin: 0 auto;
-
-			.realtime_text_item {
-				width: 100%;
-				display: flex;
-				justify-content: space-between;
-				flex-wrap: wrap;
-				margin-bottom: 50rpx;
-
-				.realtime_text_item_info {
-					width: 48%;
-					box-shadow: 0 0 10rpx #bcb9ca;
-					margin-top: 20rpx;
-					display: flex;
-					padding: 20rpx 20rpx;
-					box-sizing: border-box;
-
-					.item_info_img {
-						width: 30%;
-						text-align: center;
-						margin-right: 30rpx;
-						background-image: linear-gradient(to bottom,#5ee3ee,#3cbaef);
-						border-radius: 50%;
-						image {
-							width: 64rpx;
-							height: 64rpx;
-							margin-top: 10rpx;
-						}
-					}
-
-					.item_info_text {
-						font-size: 24rpx;
-
-					}
-				}
-			}
-		}
-
-	}
-</style>
+<template>
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative;top: 44px;">
+			<view style="position: fixed;z-index: 100;width: 100%;">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
+			</view>
+			<view class="info">
+				<view class="info_item">
+					<!-- <image
+						:src="eqinfo.item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png'"
+						mode="" class="bgi"></image> -->
+					<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png" mode="" class="bgi"></image>
+					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
+						ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
+						<image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
+							class="tishi"></image>
+					</p>
+					<p>设备名称:{{eqinfo.item.device_name}}</p>
+					<p>设备型号:水肥一体化</p>
+					<p>最近上报时间:{{eqinfo.item.uptime|timeFormat()}}</p>
+					<p>设备地址:{{city}}</p>
+				</view>
+			</view>
+			<view class="control">
+				<view class="control_item" v-if="$QueryPermission(196)" @click="control">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
+					<p>设备状态</p>
+				</view>
+				<view class="control_item" v-if="$QueryPermission(197)" @click="charts">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
+					<p>要素数据</p>
+				</view>
+				<!-- <view class="control_item" @click="repairs">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
+					<p>一键报修</p>
+				</view> -->
+			</view>
+			<view class="realtime">
+				<p class="realtime_title">实时数据</p>
+				<view class="realtime_tishi" v-if="olddatas.length==0 && dataloadingtf == false">
+					暂无数据
+				</view>
+				<view class="realtime_text" v-else>
+					<view class="realtime_text_item">
+						<view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
+							<view class="item_info_img">
+								<image :src="'http://www.hnyfwlw.com:8006/bigdata_pc/sf/dev/icon_'+item.icon+'.png'"
+									mode=""></image>
+							</view>
+							<view class="item_info_text">
+								<p>{{item.txt}}</p>
+								<p style="margin-top: 20rpx;">{{item.value}}</p>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="realtime_tishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import elelist from "../../static/json/eleList.json"
+	export default {
+		data() {
+			return {
+				eqinfo: {
+				},
+				olddata: {},
+				olddatas: [],
+				newdatesTF: false, //暂无数据显示隐藏
+				work: "",
+				zttf: false,
+				ystf: false,
+				city: "",
+				dataloadingtf: true, //加载中显示隐藏
+			}
+		},
+		methods: {
+			async history() { //设备列表
+				var newtime = +new Date() / 1000
+				var oldtime = newtime - 24 * 60 * 60
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=weather.weather.sf_status',
+					data: {
+						device_id: this.eqinfo.item.device_id
+					}
+				})
+				this.dataloadingtf = false
+				console.log(res)
+				this.olddatas = []
+				var dataarr = res.conf.eleName.split("/")
+				var elearr = res.conf.eleNum.split("/")
+				var numarr = JSON.stringify(res.dat.device_status).slice(2, -2)
+				numarr = numarr.split(",")
+				var numobj = {}
+				for (var i = 0; i < numarr.length; i++) {
+					numarr[i] = numarr[i].split(":")
+					var index = numarr[i][0].indexOf("e")==-1?numarr[i][0].indexOf("j"):numarr[i][0].indexOf("e")
+					numobj[numarr[i][0].slice(index, -1)] = Number(numarr[i][1])
+				}
+				console.log(numobj)
+				// for(var key in numarr){
+				// 	console.log(numarr[key])
+				// }
+				for (var i = 0; i < dataarr.length; i++) {
+					if(dataarr[i]!="-"){
+						var obj = {
+							txt: dataarr[i],
+							icon: elearr[i],
+							value: numobj['e'+(i+1)] + elelist[elearr[i]].unit
+						}
+						this.olddatas.push(obj)
+					}
+				}
+				console.log(this.olddatas)
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			repairs() {
+				console.log(this.eqinfo.item)
+				var device_id = this.eqinfo.item.device_id
+				uni.navigateTo({
+					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 13
+				})
+			},
+			control() { //设备控制
+				uni.navigateTo({
+					url: "./basestate?device_id=" + this.eqinfo.item.device_id
+				})
+			},
+			charts() { //历史数据
+				uni.navigateTo({
+					url: "./elementdata?device_id=" + this.eqinfo.item.device_id
+				})
+			},
+			copy(item) {
+				uni.setClipboardData({
+					data: item,
+					success: function() {
+						console.log('success');
+					}
+				});
+			},
+			selectaddress(lat, lng) { //获取分布位置
+				uni.request({
+					type: "GET",
+					url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
+						"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
+					dataType: "json",
+					complete: ress => {
+						console.log(ress.data.regeocode.formatted_address)
+						if (ress.data.regeocode.formatted_address.length == 0) {
+							this.city = "暂无"
+						} else {
+							this.city = ress.data.regeocode.formatted_address
+						}
+					}
+				});
+			},
+		},
+		onLoad(option) {
+			this.$forceUpdate()
+			this.eqinfo.item = JSON.parse(option.shebei)
+			console.log(JSON.parse(option.shebei))
+			this.history()
+			this.selectaddress(this.eqinfo.item.lat, this.eqinfo.item.lng)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.info {
+		width: 100%;
+		position: absolute;
+		top: 44px;
+
+		.info_item {
+			width: 90%;
+			margin: 0 auto;
+			height: 280rpx;
+			padding: 26rpx 50rpx;
+			position: relative;
+			box-sizing: border-box;
+
+			.bgi {
+				width: 100%;
+				height: 280rpx;
+				position: absolute;
+				top: 0;
+				left: 0;
+				z-index: -1;
+			}
+
+			p {
+				font-size: 24rpx;
+				color: #FFFFFF;
+				margin-bottom: 10rpx;
+
+				.tishi {
+					width: 30rpx;
+					height: 30rpx;
+					margin: 0rpx 0 0 20rpx;
+				}
+			}
+		}
+	}
+
+	.control {
+		width: 90%;
+		position: absolute;
+		top: 392rpx;
+		left: 5%;
+		display: flex;
+		justify-content: space-between;
+		text-align: center;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+
+		.control_item {
+			width: 120rpx;
+			height: 120rpx;
+
+			image {
+				width: 70rpx;
+				height: 70rpx;
+			}
+
+			p {
+				font-size: 24rpx;
+			}
+		}
+	}
+
+	.realtime {
+		width: 100%;
+		position: absolute;
+		top: 520rpx;
+
+		.realtime_title {
+			font-weight: 700;
+			width: 90%;
+			margin: 0 auto;
+		}
+
+		.dataloading:after {
+			overflow: hidden;
+			display: inline-block;
+			vertical-align: bottom;
+			animation: ellipsis 2s infinite;
+			content: "\2026";
+		}
+
+		@keyframes ellipsis {
+			from {
+				width: 2px;
+			}
+
+			to {
+				width: 15px;
+			}
+		}
+
+		.realtime_tishi {
+			width: 90%;
+			margin: 0 auto;
+			text-align: center;
+			font-size: 32rpx;
+			padding-top: 40rpx;
+		}
+
+		.realtime_text {
+			width: 90%;
+			margin: 0 auto;
+
+			.realtime_text_item {
+				width: 100%;
+				display: flex;
+				justify-content: space-between;
+				flex-wrap: wrap;
+				margin-bottom: 50rpx;
+
+				.realtime_text_item_info {
+					width: 48%;
+					box-shadow: 0 0 10rpx #bcb9ca;
+					margin-top: 20rpx;
+					display: flex;
+					padding: 20rpx 20rpx;
+					box-sizing: border-box;
+
+					.item_info_img {
+						width: 30%;
+						text-align: center;
+						margin-right: 30rpx;
+						background-image: linear-gradient(to bottom,#5ee3ee,#3cbaef);
+						border-radius: 50%;
+						image {
+							width: 64rpx;
+							height: 64rpx;
+							margin-top: 10rpx;
+						}
+					}
+
+					.item_info_text {
+						font-size: 24rpx;
+
+					}
+				}
+			}
+		}
+
+	}
+</style>

+ 79 - 67
util/api.js

@@ -1,72 +1,84 @@
 // const BASE_URL='http://8.136.98.49:8002'
 // let BASE_URL = 'http://192.168.1.112:8002'
 export const myRequest = (options) => {
-	let BASE_URL = uni.getStorageSync('http')
-	console.log(BASE_URL,'my request',process.env.NODE_ENV)
-	if (BASE_URL == '') {
-		// BASE_URL = 'http://114.55.0.7:8002'//测试
-		BASE_URL = process.env.NODE_ENV === 'development' ? "http://192.168.0.214:8003" : "http://8.136.98.49:8002"
-		// BASE_URL = 'http://192.168.1.77:8002'
-	}
-	// BASE_URL = 'http://192.168.1.52:8003'
-	// console.log(BASE_URL)
-	var session_key = ""
-	session_key = uni.getStorageSync('session_key')
-	let url = ""
-	let data = options.data || {}
+  let BASE_URL = uni.getStorageSync('http');
+  console.log(BASE_URL, 'my request', process.env.NODE_ENV);
+  if (BASE_URL == '') {
+    // BASE_URL = 'http://114.55.0.7:8002'//测试
+    BASE_URL =
+      process.env.NODE_ENV === 'development'
+        ? 'http://192.168.0.214:8003'
+        : 'http://8.136.98.49:8002';
+    // BASE_URL = 'http://192.168.1.77:8002'
+  }
 
-	if (options.url.split('=')[1]) {
-		url = options.url.split('=')[1]
-	} else {
-		url = options.url.split('api/')[1]
-	}
-	// console.log(url)
-	if (url != 'user.login.login_user' &&
-		url != 'pest.pests.insect_discern' &&
-		url != 'pest.pests.plant_discern' &&
-		url != 'pest.pests.pests_contrast' &&
-		url != 'pest.pests.pests_expert_img' &&
-		url != 'pest.pests.pests_img' &&
-		url != 'recognizationSys' &&
-		url != 'base.bases.base_photo' &&
-		url != 'pest.warning_record.rolemanage_img' &&
-		url != 'home.homes.personal_photo' &&
-		url != 'ascend.ascend_manage.product_info' &&
-		url != 'ascend.ascend_manage.quality_info' &&
-		url != 'ascend.ascend_manage.grow_info' &&
-		url != 'ascend.ascend_manage.all_ascend' &&
-		url != 'after_sale.after_sale_manage.device_check' &&
-		url != 'after_sale.after_sale_manage.aftersale_apply') {
-		data.token = session_key
-	}
+  BASE_URL = 'http://118.178.196.153:7000/iotprod-api/bigdata-api';
+  // BASE_URL = 'http://192.168.1.52:8003'
+  // console.log(BASE_URL)
+  var session_key = '';
+  session_key = uni.getStorageSync('session_key');
+  let url = '';
+  let data = options.data || {};
 
-	return new Promise((resolve, reject) => {
-		uni.request({
-			url: BASE_URL + options.url,
-			method: options.method || 'POST',
-			header: {
-				"Content-Type": "application/x-www-form-urlencoded",
-			},
-			data: data,
-			success: (res) => {
-				if (res.data.message) {
-					if (res.data.message == "识别无结果" ||res.data.message == "该设备未绑定SIM") {
-						resolve(res.data.data)
-					} else {
-						return uni.showToast({
-							title: res.data.message,
-							icon: "none"
-						})
-					}
-				}
-				resolve(res.data.data)
-			},
-			fail: (err) => {
-				uni.showToast({
-					title: '请求接口失败'
-				})
-				reject(err)
-			}
-		})
-	})
-}
+  if (options.url.split('=')[1]) {
+    url = options.url.split('=')[1];
+  } else {
+    url = options.url.split('api/')[1];
+  }
+  // console.log(url)
+  if (
+    url != 'user.login.login_user' &&
+    url != 'pest.pests.insect_discern' &&
+    url != 'pest.pests.plant_discern' &&
+    url != 'pest.pests.pests_contrast' &&
+    url != 'pest.pests.pests_expert_img' &&
+    url != 'pest.pests.pests_img' &&
+    url != 'recognizationSys' &&
+    url != 'base.bases.base_photo' &&
+    url != 'pest.warning_record.rolemanage_img' &&
+    url != 'home.homes.personal_photo' &&
+    url != 'ascend.ascend_manage.product_info' &&
+    url != 'ascend.ascend_manage.quality_info' &&
+    url != 'ascend.ascend_manage.grow_info' &&
+    url != 'ascend.ascend_manage.all_ascend' &&
+    url != 'after_sale.after_sale_manage.device_check' &&
+    url != 'after_sale.after_sale_manage.aftersale_apply'
+  ) {
+    data.token = session_key;
+  }
+
+  return new Promise((resolve, reject) => {
+    uni.request({
+      url: BASE_URL + options.url,
+      method: options.method || 'POST',
+      header: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      data: data,
+      success: (res) => {
+		  console.log(url,'response 12131313',url)
+        if (res.data.message) {
+          if (
+            res.data.message == '识别无结果' ||
+            res.data.message == '该设备未绑定SIM'
+          ) {
+            resolve(res.data.data);
+          } else {
+            return uni.showToast({
+              title: res.data.message,
+              icon: 'none',
+            });
+          }
+        }
+        resolve(res.data.data);
+      },
+      fail: (err) => {
+		  console.log(err,'response 12131313',url,data)
+        uni.showToast({
+          title: '请求接口失败',
+        });
+        reject(err);
+      },
+    });
+  });
+};