Bladeren bron

fix: 修复多个页面功能问题及样式调整

修复CBD设备详情页切换标签时未触发点击事件的问题
调整环境监测页面图片路径错误及样式问题
优化设备详情页图片显示逻辑,根据不同设备型号显示不同图片
修复历史数据页面表格宽度问题及样式调整
调整首页位置获取逻辑,移除重复代码
修复banner页面返回按钮点击区域及样式问题
allen 1 dag geleden
bovenliggende
commit
885be9f5cf

+ 7 - 2
pages/banner/index.vue

@@ -1,11 +1,13 @@
 <template>
   <view class="banner-ad">
-    <view class="device-detail__header">
+    <view
+      class="device-detail__header"
+      @click="handleBack"
+    >
       <u-icon
         size="36"
         class="arrow-left"
         name="arrow-left"
-        @click="handleBack"
       ></u-icon>
     </view>
     <image :src="bannerURL" mode="" class="banner-image"></image>
@@ -35,8 +37,11 @@ export default {
     position: absolute;
     top: 32rpx;
     left: 32rpx;
+    width:88rpx;
+    height: 48rpx;
     z-index: 999;
     color:#fff;
+    margin-top: 64rpx;
   }
   .banner-image{
     width: 100%;

+ 1 - 1
pages/cb/equip-detail/equip-detail.vue

@@ -55,7 +55,7 @@
       </view>
       <view v-if="type == 4">
         <text space="emsp">诱芯更新时间</text>
-        <text style="margin: 0 10px">{{ equipInfo.xy_uptime }}</text>
+        <text style="margin: 0 10px">{{formatTime(equipInfo.xy_uptime * 1000)}}</text>
       </view>
       <view v-if="type == 4">
         <text space="emsp">诱芯到期时间</text>

+ 78 - 7
pages/cbd/components/deviceData.vue

@@ -60,7 +60,7 @@
         </view>
         <view class="data-column-right">
           <view class="device-image-container">
-            <image class="device-image" src="https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cbd.png" mode="aspectFit"></image>
+            <image class="device-image" :src="formatDevImg" mode="aspectFit"></image>
           </view>
         </view>
       </view>
@@ -86,7 +86,7 @@
       <view class="chart-content">
         <view class="chart-canvas-container" v-if="!show" :key="chartKey">
           <!-- <div id="tempChart" class="chart-canvas"></div> -->
-		      <qiun-data-charts type="line" :chartData="chartData" :canvas2d="true" :inScrollView="true" :opts="opts" :ontouch="true"/>
+		      <qiun-data-charts type="line" :chartData="chartData" :canvas2d="true" :inScrollView="true" :opts="opts" :ontouch="true" v-show="xData.length"/>
         </view>
       </view>
     </view>
@@ -189,7 +189,7 @@
           </view>
           <view class="sim-item">
             <text class="sim-label">已使用:</text>
-            <text class="sim-value"><text style="color: #0BBC58">{{ deviceInfoStatic.used }}</text>/{{ deviceInfoStatic.total }}</text>
+            <text class="sim-value"><text style="color: #0BBC58">{{ deviceInfoStatic.used || ''}}</text>/{{ deviceInfoStatic.total || '' }}</text>
           </view>
           <view class="sim-item">
             <text class="sim-value">
@@ -221,15 +221,18 @@
       </view>
       <view slot="expanded">
         <view class="general-images">
-          <view class="general-image edit-border" @click="editData">
+          <view class="general-image edit-border" :class="{'edit-border2':isShowPhoto}" @click="editData">
             <image :src="editBorder" class="image-icon"></image>
           </view>
-          <view class="general-image sim-border" @click="simData">
+          <view class="general-image sim-border" :class="{'sim-border2':isShowPhoto}" @click="simData">
             <image :src="simBorder" class="image-icon"></image>
           </view>
-          <view class="general-image setting-border" @click="openSettings">
+          <view class="general-image setting-border" :class="{'setting-border2':isShowPhoto}" @click="openSettings">
             <image :src="settingBorder" class="image-icon"></image>
           </view>
+          <view class="general-image photo-border" @click="openPhoto" v-if="isShowPhoto">
+            <image :src="photoBorder" class="image-icon"></image>
+          </view>
         </view>
       </view>
     </floatButton>
@@ -246,6 +249,7 @@ import general from '../assets/general.png';
 import editBorder from '../assets/editBorder.png';
 import settingBorder from '../assets/settingBorder.png';
 import simBorder from '../assets/simBorder.png';
+import photoBorder from '../assets/photoBorder.png';
 let chartInstance = null;
 
 export default {
@@ -294,11 +298,16 @@ export default {
       general,
       editBorder,
       settingBorder,
+      photoBorder,
       simBorder,
+      devImage:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cbd.png',
+      baseDevice:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image',
+      devImg:'',
       activeTab: 0,
       edit,
       sim,
       show:false,
+      isShowPhoto:false,
       show1:true,
       equipStateDict:{},
       chartTabs: [
@@ -352,6 +361,11 @@ export default {
   mounted(){
     this.equipStateDict = Circulation
   },
+  computed: {
+    formatDevImg() {
+      return `https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/${this.devImg}.png`;
+    },
+  },
   watch:{
     polylineList:{
       handler(newVal, oldVal){
@@ -364,6 +378,32 @@ export default {
       deep:true,
       immediate:true,
     },
+    deviceInfo:{
+      handler(newVal, oldVal){
+        console.log(newVal.device_model,'device_modeldevice_modeldevice_model')
+        if (newVal.device_model == '11'){
+          this.devImg = 'cbd4.1'
+          this.isShowPhoto = true
+        } else if(newVal.device_model == '12'){
+          this.devImg = 'cbd1'
+          this.isShowPhoto = false
+        } else if(newVal.device_model == '13'){
+          this.devImg = 'cbd5'
+          this.isShowPhoto = true
+        } else if(newVal.device_model == '14'){
+          this.devImg = 'cbd6'
+          this.isShowPhoto = true
+        } else if(newVal.device_model == '15'){
+          this.devImg = 'gkcbd1'
+          this.isShowPhoto = false
+        } else{
+          this.devImg = 'cbd'
+          this.isShowPhoto = true
+        }
+      },
+      deep:true,
+      immediate:true,
+    },
     deviceHistoryList:{
       handler(newVal, oldVal){
         this.historyData = []
@@ -378,6 +418,20 @@ export default {
     },
   },
   methods: {
+    async openPhoto(){
+       const res = await this.$myRequest({
+        url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
+        method: 'POST',
+        data: {
+          device_type_id: this.deviceInfo.type,
+          d_id: this.deviceInfo.d_id,
+          cmd: 'takephoto',
+        },
+      });
+      if(res){
+        this.$u.toast('拍照成功')
+      }
+    },
     editData(){
       uni.navigateTo({
         url: '/pages/afterSale/addafter?d_id=' + this.deviceInfo.d_id +'&device_id='+this.deviceInfo.id + '&device_type=' + this.deviceInfo.type,
@@ -631,8 +685,9 @@ export default {
       });
     },
     updateChartsData(){
+      const categories = this.xData.length ? this.xData : [];
       const lineData = {
-        categories: this.xData,
+        categories,
         series: [
           {
             name: this.chartTabs[this.activeChartTab].name,
@@ -766,6 +821,22 @@ export default {
     top: -40rpx;
     left: -180rpx;
   }
+  .edit-border2{
+    top: 60rpx;
+    left: -70rpx;
+  }
+  .sim-border2{
+    top: -75rpx;
+    left: -150rpx;
+  }
+  .setting-border2{
+    top: 20rpx;
+    left: -150rpx;
+  }
+  .photo-border{
+    top: -135rpx;
+    left: -70rpx;
+  }
 }
 /* 主要数据面板 */
 .main-data-panel {

+ 1 - 0
pages/cbd/detail.vue

@@ -183,6 +183,7 @@ export default {
         this.disableShow = false;
         if(showStatus){
           this.activeTab = 'viewImage';
+          this.handleTabClick('viewImage');
         }
       }else{
         this.disableShow = true;

+ 5 - 1
pages/deviceDetails/weatherStation/eleDetail.vue

@@ -506,7 +506,9 @@ export default {
   padding: 0 32rpx;
   padding-top: 98rpx;
 }
-
+.nav-title{
+  text-align: center;
+}
 .date-picker {
   display: flex;
   align-items: center;
@@ -606,6 +608,7 @@ export default {
       padding-left: 16rpx;
       margin-left: 16rpx;
       cursor: pointer;
+      display: none;
     }
   }
   /* 展开后的要素容器样式 */
@@ -648,6 +651,7 @@ export default {
     position: relative;
     padding: 10rpx;
     overflow: hidden;
+    z-index: 0;
     .chart {
       width: 100%;
       height: 336rpx;

+ 6 - 7
pages/environment/gsequipment.vue

@@ -32,7 +32,7 @@
 			<view class="newdatas">
 				<view class="newdatas_title">
 					<span>实时数据</span>
-					<p @click="tohistory" v-if="$QueryPermission(189)">历史数据>>></p>
+					<p @click="tohistory">历史数据>>></p>
 				</view>
 				<view class="newdatas_land" v-for="item,index in newdataobj.temp" :key="index">
 					<p class="newdatas_land_title">{{newdataobj.depth[index]}}cm</p>
@@ -40,7 +40,7 @@
 						<view class="newdatas_land_box">
 							<view class="imgbox">
 								<image
-									:src="$imageURL+'/bigdata_app/image/environment/tubular/trs'+(index+1)+'.png'"
+									:src="$imageURL+'//bigdata_app/image/environment/tubular/trs'+(index+1)+'.png'"
 									mode="" class="img"></image>
 							</view>
 							<view class="infobox">
@@ -51,7 +51,7 @@
 						<view class="newdatas_land_box">
 							<view class="imgbox">
 								<image
-									:src="$imageURL+'/bigdata_app/image/environment/tubular/trw'+(index+1)+'.png'"
+									:src="$imageURL+'//bigdata_app/image/environment/tubular/trw'+(index+1)+'.png'"
 									mode="" class="img"></image>
 							</view>
 							<view class="infobox">
@@ -62,7 +62,7 @@
 						<view class="newdatas_land_box" v-if="newdataobj.ecs[index]">
 							<view class="imgbox">
 								<image
-									:src="$imageURL+'/bigdata_app/image/environment/tubular/ddl'+(index+1)+'.png'"
+									:src="$imageURL+'//bigdata_app/image/environment/tubular/ddl'+(index+1)+'.png'"
 									mode="" class="img"></image>
 							</view>
 							<view class="infobox">
@@ -318,17 +318,16 @@
 					margin-top: 20rpx;
 					display: flex;
 					align-items: center;
-
+					
 					.imgbox {
 						width: 60rpx;
 						height: 60rpx;
-
+					
 						.img {
 							width: 60rpx;
 							height: 60rpx;
 						}
 					}
-
 					.infobox {
 						font-size: 28rpx;
 

+ 408 - 493
pages/environment/gshistory.vue

@@ -1,519 +1,434 @@
 <template>
-  <view>
-    <view class="status_bar"></view>
-    <view class="" style="position: relative; top: 44px">
-      <view
-        style="
-          position: fixed;
-          z-index: 10000000;
-          width: 100%;
-          background-color: #000000;
-        "
-      >
-        <uni-nav-bar
-          @clickLeft="clickLeft"
-          left-icon="back"
-          left-text="返回"
-          title="历史数据"
-        ></uni-nav-bar>
-      </view>
-    </view>
-    <view class="his_box">
-      <view class="selecttimes" @click="tiemshow = !tiemshow">
-        <view class="timesbox">
-          <image
-            :src="$imageURL+'/bigdata_app/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
-            mode=""
-          ></image>
-          <p>{{ timetab(begintime) }}</p>
-          <p class="or">~</p>
-          <p>{{ timetab(end) }}</p>
-          <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
-        </view>
-        <u-calendar
-          v-model="tiemshow"
-          mode="range"
-          @change="tiemchange"
-          range-color="#999"
-          btn-type="success"
-          active-bg-color="#0BBC58"
-          range-bg-color="rgba(11,188,88,0.13)"
-        ></u-calendar>
-      </view>
-      <view class="shuju_one">
-        <view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
-          暂无数据
-        </view>
-        <view class="canvastishi" v-if="dataloadingtf">
-          <p class="dataloading">加载中</p>
-        </view>
-        <canvas
-          v-show="!tiemshow"
-          canvas-id="canvasColumnA"
-          id="canvasColumnA"
-          class="charts"
-          @touchstart="touchLineA($event)"
-          @touchmove="moveLineA($event)"
-          @touchend="touchEndLineA($event)"
-          disable-scroll="true"
-          :style="{
-            width: cWidth * pixelRatio + 'px',
-            height: cHeight * pixelRatio + 'px',
-            transform: 'scale(' + 1 / pixelRatio + ')',
-            'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
-            'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
-          }"
-        ></canvas>
-      </view>
-      <view class="condition">
-        <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
-          <table class="table">
-            <tr class="tr">
-              <th class="th" v-for="(item, index) in thdata" :key="'a' + index">
-                {{ item }}
-              </th>
-            </tr>
-            <tr
-              class="tr"
-              v-for="(items, indexs) in historylistdata"
-              :key="'b' + indexs"
-              v-if="!forbidden"
-            >
-              <td class="td">{{ items.uptime | timeFormat() }}</td>
-              <!-- <td class="td">{{ items.ats }}</td>
-              <td class="td">{{ items.at }}</td> -->
-              <td
-                class="td"
-                v-for="(item, index) in items.temp"
-                :key="'c' + index"
-              >
-                {{ item }}
-              </td>
-              <td
-                class="td"
-                v-for="(item, index) in items.swc"
-                :key="'d' + index"
-              >
-                {{ item }}
-              </td>
-              <td
-                class="td"
-                v-for="(item, index) in items.ecs"
-                :key="'e' + index"
-              >
-                {{ item }}
-              </td>
-              <!-- <td class="td">{{ items.atm }}</td> -->
-            </tr>
-            <tr class="tr" v-if="forbidden">
-              <td class="td" v-for="item in 13">暂无数据</td>
-            </tr>
-          </table>
-        </scroll-view>
-        <view class="pagenumber">
-          <button @click="prev">上一页</button>
-          <view class="pagenumber_page"> 第 {{ page }} 页 </view>
-          <view class="pagenumber_page"> 共 {{ pagesum }} 页 </view>
-          <button @click="next">下一页</button>
-        </view>
-      </view>
-    </view>
-  </view>
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative;top: 40px;">
+			<view style="position: fixed;z-index: 10000000;width: 100%;background-color: #000000;">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="历史数据"></uni-nav-bar>
+			</view>
+		</view>
+		<view class="" style="position: relative;top: 100px;">
+			<view class="selecttimes" @click="tiemshow=!tiemshow">
+				<view class="timesbox">
+					<image
+						:src="$imageURL+'/bigdata_app/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
+						mode=""></image>
+					<p>{{timetab(begintime)}}</p>
+					<p class="or">~</p>
+					<p>{{timetab(end)}}</p>
+					<u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
+				</view>
+				<u-calendar v-model="tiemshow" mode="range" @change="tiemchange"
+					range-color="#999"
+					btn-type="success"
+					active-bg-color="#0BBC58"
+					range-bg-color="rgba(11,188,88,0.13)"></u-calendar>
+			</view>
+			<view class="shuju_one">
+				<view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
+					暂无数据
+				</view>
+				<view class="canvastishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+				<canvas v-show="!tiemshow" canvas-id="canvasColumnA" id="canvasColumnA" class="charts" @touchstart="touchLineA($event)"
+					@touchmove="moveLineA($event)" @touchend="touchEndLineA($event)" disable-scroll=true
+					:style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"></canvas>
+			</view>
+			<view class="condition">
+				<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+					<table class="table" :style="{width:300*thdata.length+'rpx'}">
+						<tr class="tr">
+							<th class="th" v-for="(item,index) in thdata" :key="'a'+index">{{item}}</th>
+						</tr>
+						<tr class="tr" v-for="(items,indexs) in historylistdata" :key="'b'+indexs" v-if="!forbidden">
+							<td class="td">{{items.upl_time|timeFormat()}}</td>
+							<td class="td">{{items.ats}}</td>
+							<td class="td">{{items.at}}</td>
+							<td class="td" v-for="(item,index) in items.temp" :key="'c'+index">{{item}}</td>
+							<td class="td" v-for="(item,index) in items.swc" :key="'d'+index">{{item}}</td>
+							<td class="td">{{items.atm}}</td>
+						</tr>
+						<tr class="tr" v-if="forbidden">
+							<td class="td" v-for="item in 13">暂无数据</td>
+						</tr>
+					</table>
+				</scroll-view>
+				<view class="pagenumber">
+					<button @click="prev">上一页</button>
+					<view class="pagenumber_page">
+						第 {{page}} 页
+					</view>
+					<view class="pagenumber_page">
+						共 {{pagesum}} 页
+					</view>
+					<button @click="next">下一页</button>
+				</view>
+			</view>
+		</view>
+	</view>
 </template>
 
 <script>
-import uCharts from '../../components/js_sdk/u-charts/u-charts/u-charts.js';
-var canvaColumnA = null;
-export default {
-  data() {
-    return {
-      tiemshow: false, //时间筛选弹框
-      begintime: '', //开始时间
-      end: '', //结束时间
-      dataloadingtf: true,
-      canvastishiTF: false,
-      device_id: '', //设备ID
-      thdata: [
-        '上传时间',
-        // "空气湿度(%RH)",
-        // "空气温度(℃)",
-        '10cm土壤温度(%RH)',
-        '20cm土壤温度(%RH)',
-        '30cm土壤温度(%RH)',
-        '10cm土壤湿度(%RH)',
-        '20cm土壤湿度(%RH)',
-        '30cm土壤湿度(%RH)',
-        // "大气压强(Pa)",
-      ], //表格抬头
-      forbidden: false,
-      historylistdata: [], //历史数据
-      pagesum: 1,
-      page: 1,
-      cWidth: '',
-      cHeight: '',
-      pixelRatio: 1,
-    };
-  },
-  methods: {
-    tiemchange(e) {
-      //切换时间
-      this.begintime = parseInt(+new Date(e.startDate) / 1000);
-      this.end = parseInt(+new Date(e.endDate) / 1000);
-      this.histprydatas();
-    },
-    timetab(e) {
-      //时间转换
-      e = new Date(e * 1000);
-      var year = e.getFullYear();
-      var month =
-        e.getMonth() + 1 < 10 ? '0' + (e.getMonth() + 1) : e.getMonth() + 1;
-      var day = e.getDate() < 10 ? '0' + e.getDate() : e.getDate();
-      var time = year + '/' + month + '/' + day;
-      return time;
-    },
-    async histprydatas() {
-      //历史数据
-      this.dataloadingtf = true;
-      const res = await this.$myRequest({
-        url: '/api/api_gateway?method=weather.weather.nd_data',
-        data: {
-          device_id: this.device_id,
-          page: this.page,
-          begin: this.begintime,
-          end: this.end,
-        },
-      });
-      this.dataloadingtf = false;
-      console.log(res.nums);
-      this.pagesum = Math.ceil(res.nums / 10) || 1;
-      this.historylistdata = res.dat_list;
-      for (var i = 0; i < this.historylistdata.length; i++) {
-        this.historylistdata[i].temp = this.historylistdata[i].temp.split(',');
-        this.historylistdata[i].swc = this.historylistdata[i].swc.split(',');
-        this.historylistdata[i].ecs = this.historylistdata[i].ecs.split(',');
-      }
-      var arr1 = [];
-      var arr2 = [];
-      var xtitle = [];
-      var obj = [
-        {
-          name: '空气温度',
-          data: [],
-          color: '#00E29D',
-        },
-        {
-          name: '空气湿度',
-          data: [],
-          color: '#6CBBFF',
-        },
-      ];
-      var arr3 = [];
-      var k = 0;
-      for (var i = 0; i < res.dat_char.length; i++) {
-        var times = new Date(res.dat_char[i].uptime * 1000);
-        xtitle.unshift(
-          times.getMonth() +
-            1 +
-            '/' +
-            times.getDate() +
-            '-' +
-            times.getHours() +
-            ':' +
-            times.getMinutes()
-        );
-        arr1.unshift(res.dat_char[i].at == '' ? '0' : res.dat_char[i].at); //空气温度
-        arr2.unshift(res.dat_char[i].ats == '' ? '0' : res.dat_char[i].ats); //空气湿度
-        res.dat_char[i].temp = res.dat_char[i].temp.split(',');
-        res.dat_char[i].swc = res.dat_char[i].swc.split(',');
-        res.dat_char[i].ecs = res.dat_char[i].ecs.split(',');
-        for (var j = 0; j < res.dat_char[i].temp.length; j++) {
-          arr3.unshift(
-            res.dat_char[i].temp[j] == '' ? '0' : res.dat_char[i].temp[j]
-          ); //10cm土壤温度
-        }
-        this.thdata.length = 1;
-        res.depth.split(',').forEach((dep, index) => {
-          this.thdata.push(`${dep}cm土壤温度(℃)`);
-          res.dat_char[i].temp.forEach((items, indexs) => {
-            var tempdata = [];
-            var tempdatas = [];
-            var ecsarr = [];
-            tempdata.push(Number(items));
-            tempdatas.push(Number(res.dat_char[i].swc[indexs]));
-            if (res.dat_char[i].ecs[indexs]) {
-              ecsarr.push(Number(res.dat_char[i].ecs[indexs]));
-            }
-            var temparrs = {
-              name: dep + 'cm土壤温度(℃)',
-              data: tempdata,
-            };
-            var temparr = {
-              name: dep + 'cm土壤湿度(%RH)',
-              data: tempdatas,
-            };
-            var ecsparr = {
-              name: dep + 'cm电导率(ms/cm)',
-              data: ecsarr,
-            };
-            obj.push(temparr);
-            obj.push(temparrs);
-            if (ecsarr.length > 0) {
-              obj.push(ecsparr);
-            }
-          });
-        });
-        res.depth.split(',').forEach((dep, index) => {
-          this.thdata.push(`${dep}cm土壤湿度(%RH)`);
-        });
-        res.depth.split(',').forEach((dep, index) => {
-          this.thdata.push(`${dep}cm电导率(ms/cm)`);
-        });
-      }
-      obj[0].data = arr1;
-      obj[1].data = arr2;
-      var listArr = [];
-      obj.forEach(function (el, index) {
-        for (var i = 0; i < listArr.length; i++) {
-          // 对比相同的字段key,相同放入对应的数组中
-          if (listArr[i].name == el.name && el.data !== undefined) {
-            listArr[i].data.unshift(el.data[0]);
-            return;
-          }
-        }
-        // 第一次对比没有参照,放入参照
-        listArr.push({
-          name: el.name,
-          data: el.data,
-        });
-      });
-      console.log(listArr);
-      if (listArr.length == 0) {
-        this.canvastishiTF = false;
-      } else {
-        this.canvastishiTF = true;
-      }
-      this.showColumn('canvasColumnA', xtitle, listArr);
-      // console.log(this.historylistdata)
-    },
-    prev() {
-      //上一页
-      if (this.page > 1) {
-        this.page--;
-        this.histprydatas();
-      }
-    },
-    next() {
-      //下一页
-      if (this.page < this.pagesum) {
-        this.page++;
-        this.histprydatas();
-      }
-    },
-    clickLeft() {
-      uni.navigateBack({
-        delta: 1,
-      });
-    },
-    showColumn(id, xtitle, xinfo) {
-      var _self = this;
-      const ctx = uni.createCanvasContext(id, this);
-      canvaColumnA = new uCharts({
-        context: ctx,
-        type: 'line',
-        legend: {
-          position: 'top',
-        },
-        fontSize: 11,
-        background: '#FFFFFF',
-        pixelRatio: 1,
-        animation: true,
-        dataLabel: false,
-        categories: xtitle,
-        series: xinfo,
-        enableScroll: true, //开启图表拖拽功能
-        xAxis: {
-          disableGrid: true,
-          type: 'grid',
-          gridType: 'dash',
-          itemCount: 4, //x轴单屏显示数据的数量,默认为5个
-          scrollShow: true, //新增是否显示滚动条,默认false
-          // scrollAlign: 'left', //滚动条初始位置
-          scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
-          scrollColor: '#DEE7F7', //默认为 #A6A6A6
-        },
-        yAxis: {},
-        width: _self.cWidth * 1,
-        height: _self.cHeight * 1,
-        extra: {
-          line: {
-            type: 'curve',
-          },
-        },
-      });
-    },
-    touchLineA(e) {
-      console.log(e);
-      canvaColumnA.scrollStart(e);
-    },
-    moveLineA(e) {
-      canvaColumnA.scroll(e);
-    },
-    touchEndLineA(e) {
-      canvaColumnA.scrollEnd(e);
-      //下面是toolTip事件,如果滚动后不需要显示,可不填写
-      canvaColumnA.showToolTip(e, {
-        format: function (item, category) {
-          return category + ' ' + item.name + ':' + item.data;
-        },
-      });
-    },
-  },
-  onLoad(option) {
-    this.cWidth = uni.upx2px(650);
-    this.cHeight = uni.upx2px(500);
-    this.device_id = option.id;
-    this.end = parseInt(+new Date() / 1000);
-    this.begintime = parseInt(this.end - 24 * 60 * 60);
-    this.histprydatas();
-  },
-};
+	import uCharts from '../../components/js_sdk/u-charts/u-charts/u-charts.js';
+	var canvaColumnA = null;
+	export default {
+		data() {
+			return {
+				tiemshow: false, //时间筛选弹框
+				begintime: "", //开始时间
+				end: "", //结束时间
+				dataloadingtf: true,
+				canvastishiTF: false,
+				device_id: '', //设备ID
+				thdata: ["上传时间", "空气湿度(%RH)", "空气温度(℃)", "10cm土壤温度(%RH)", "20cm土壤温度(%RH)", "30cm土壤温度(%RH)", "10cm土壤湿度(%RH)", "20cm土壤湿度(%RH)", "30cm土壤湿度(%RH)",
+					"大气压强(Pa)"
+				], //表格抬头
+				forbidden: false,
+				historylistdata: [], //历史数据
+				pagesum: 1,
+				page: 1,
+				cWidth: '',
+				cHeight: '',
+				pixelRatio: 1,
+			}
+		},
+		methods: {
+			tiemchange(e) { //切换时间
+				this.begintime = parseInt(+new Date(e.startDate) / 1000)
+				this.end = parseInt(+new Date(e.endDate) / 1000)
+				this.histprydatas()
+			},
+			timetab(e) { //时间转换
+				e = new Date(e * 1000)
+				var year = e.getFullYear()
+				var month = e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1
+				var day = e.getDate() < 10 ? "0" + e.getDate() : e.getDate()
+				var time = year + "/" + month + "/" + day
+				return time
+			},
+			async histprydatas() { //历史数据
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=weather.weather.nd_data',
+					data: {
+						device_id: this.device_id,
+						page: this.page,
+						begin: this.begintime,
+						end: this.end
+					}
+				})
+				this.dataloadingtf = false
+				console.log(res.nums)
+				this.pagesum = Math.ceil(res.nums / 10) || 1
+				this.historylistdata = res.dat_list
+				for (var i = 0; i < this.historylistdata.length; i++) {
+					this.historylistdata[i].temp = this.historylistdata[i].temp.split(",")
+					this.historylistdata[i].swc = this.historylistdata[i].swc.split(",")
+					this.historylistdata[i].ecs = this.historylistdata[i].ecs.split(",");
+				}
+				var arr1 = []
+				var arr2 = []
+				var xtitle = []
+				var obj = [{
+					name: '空气温度',
+					data: [],
+					color: '#00E29D'
+				}, {
+					name: '空气湿度',
+					data: [],
+					color: '#6CBBFF'
+				}]
+				var arr3 = []
+				var k = 0
+				for (var i = 0; i < res.dat_char.length; i++) {
+					var times = new Date(res.dat_char[i].upl_time * 1000)
+					xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times
+						.getMinutes())
+					arr1.unshift(res.dat_char[i].at == "" ? "0" : res.dat_char[i].at) //空气温度
+					arr2.unshift(res.dat_char[i].ats == "" ? "0" : res.dat_char[i].ats) //空气湿度
+					res.dat_char[i].temp = res.dat_char[i].temp.split(",")
+					res.dat_char[i].swc = res.dat_char[i].swc.split(",")
+					res.dat_char[i].ecs = res.dat_char[i].ecs.split(",")
+					for (var j = 0; j < res.dat_char[i].temp.length; j++) {
+						arr3.unshift(res.dat_char[i].temp[j] == "" ? "0" : res.dat_char[i].temp[j]) //10cm土壤温度
+					}
+					this.thdata.length = 1;
+					res.depth.split(',').forEach((dep, index) => {
+						this.thdata.push(`${dep}cm土壤温度(℃)`)
+						res.dat_char[i].temp.forEach((items, indexs) => {
+							var tempdata = [];
+							var tempdatas = [];
+							var ecsarr = [];
+							tempdata.push(Number(items));
+							tempdatas.push(Number(res.dat_char[i].swc[indexs]));
+							if((res.dat_char[i]).ecs[indexs]) {
+								ecsarr.push(Number(res.dat_char[i].ecs[indexs]));
+							}
+							var temparrs = {
+								name: dep + "cm土壤温度(℃)",
+								data: tempdata,
+							};
+							var temparr = {
+								name: dep + "cm土壤湿度(%RH)",
+								data: tempdatas,
+							};
+							var ecsparr = {
+								name: dep + "cm电导率(ms/cm)",
+								data: ecsarr,
+							};
+							obj.push(temparr);
+							obj.push(temparrs);
+							if(ecsarr.length > 0) {
+								obj.push(ecsparr);
+							}
+						});
+					})
+					res.depth.split(',').forEach((dep, index) => {
+						this.thdata.push(`${dep}cm土壤湿度(%RH)`)
+					})
+					res.depth.split(',').forEach((dep, index) => {
+						this.thdata.push(`${dep}cm电导率(ms/cm)`)
+					})
+				}
+				obj[0].data = arr1
+				obj[1].data = arr2
+				var listArr = [];
+				obj.forEach(function(el, index) {
+					for (var i = 0; i < listArr.length; i++) {
+						// 对比相同的字段key,相同放入对应的数组中
+						if (listArr[i].name == el.name && el.data !== undefined) {
+							listArr[i].data.unshift(el.data[0]);
+							return;
+						}
+					}
+					// 第一次对比没有参照,放入参照
+					listArr.push({
+						name: el.name,
+						data: el.data,
+					});
+				});
+				console.log(listArr)
+				if(listArr.length==0){
+					this.canvastishiTF = false
+				}else{
+					this.canvastishiTF = true
+				}
+				this.showColumn("canvasColumnA", xtitle, listArr)
+				// console.log(this.historylistdata)
+			},
+			prev() { //上一页
+				if (this.page > 1) {
+					this.page--
+					this.histprydatas()
+				}
+			},
+			next() { //下一页
+				if (this.page < this.pagesum) {
+					this.page++
+					this.histprydatas()
+				}
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			showColumn(id, xtitle, xinfo) {
+				var _self = this
+				const ctx = uni.createCanvasContext(id, this);
+				canvaColumnA = new uCharts({
+					context: ctx,
+					type: 'line',
+					legend: {
+						position: "top"
+					},
+					fontSize: 11,
+					background: '#FFFFFF',
+					pixelRatio: 1,
+					animation: true,
+					dataLabel: false,
+					categories: xtitle,
+					series: xinfo,
+					enableScroll: true, //开启图表拖拽功能
+					xAxis: {
+						disableGrid: true,
+						type: 'grid',
+						gridType: 'dash',
+						itemCount: 4, //x轴单屏显示数据的数量,默认为5个
+						scrollShow: true, //新增是否显示滚动条,默认false
+						// scrollAlign: 'left', //滚动条初始位置
+						scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
+						scrollColor: '#DEE7F7', //默认为 #A6A6A6
+					},
+					yAxis: {},
+					width: _self.cWidth * 1,
+					height: _self.cHeight * 1,
+					extra: {
+						line: {
+							type: 'curve'
+						}
+					}
+				});
+			},
+			touchLineA(e) {
+				console.log(e)
+				canvaColumnA.scrollStart(e);
+			},
+			moveLineA(e) {
+				canvaColumnA.scroll(e);
+			},
+			touchEndLineA(e) {
+				canvaColumnA.scrollEnd(e);
+				//下面是toolTip事件,如果滚动后不需要显示,可不填写
+				canvaColumnA.showToolTip(e, {
+					format: function(item, category) {
+						return category + ' ' + item.name + ':' + item.data
+					}
+				});
+			},
+		},
+		onLoad(option) {
+			this.cWidth = uni.upx2px(650);
+			this.cHeight = uni.upx2px(500);
+			this.device_id = option.id
+			this.end = parseInt(+new Date() / 1000)
+			this.begintime = parseInt(this.end - 24 * 60 * 60)
+			this.histprydatas()
+		}
+	}
 </script>
 
 <style lang="scss">
-.his_box {
-  width: 100%;
-  top: 200rpx;
-  position: relative;
-}
+	.selecttimes {
+		width: 90%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding: 10rpx 20rpx;
+		box-sizing: border-box;
+		margin: 0 auto;
+		font-size: 28rpx;
 
-.selecttimes {
-  width: 90%;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  padding: 10rpx 20rpx;
-  box-sizing: border-box;
-  margin: 0 auto;
-  font-size: 28rpx;
+		.timesbox {
+			display: flex;
+			justify-content: space-around;
 
-  .timesbox {
-    display: flex;
-    justify-content: space-around;
+			image {
+				width: 30rpx;
+				height: 30rpx;
+				margin-top: 6rpx;
+			}
 
-    image {
-      width: 30rpx;
-      height: 30rpx;
-      margin-top: 6rpx;
-    }
+			.icon {
+				color: #949494;
+				text-align: right;
+				margin-left: 30rpx;
 
-    .icon {
-      color: #949494;
-      text-align: right;
-      margin-left: 30rpx;
-    }
-  }
+			}
+		}
 
-  ::v-deep .u-calendar__action {
-    display: flex;
-    justify-content: space-around;
+		/deep/.u-calendar__action {
+			display: flex;
+			justify-content: space-around;
 
-    .u-calendar__action__text {
-      line-height: 25px;
-    }
-  }
-}
+			.u-calendar__action__text {
+				line-height: 25px;
+			}
+		}
+	}
 
-.shuju_one {
-  width: 90%;
-  margin: 20px auto;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  padding-top: 20rpx;
-  height: 550rpx;
+	.shuju_one {
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+		height: 550rpx;
+		margin: 20rpx auto;
+		.canvastishi {
+			font-size: 32rpx;
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			margin-left: -64rpx;
+			margin-top: -21rpx;
 
-  .canvastishi {
-    font-size: 32rpx;
-    position: absolute;
-    top: 50%;
-    left: 50%;
-    margin-left: -64rpx;
-    margin-top: -21rpx;
+			.dataloading:after {
+				overflow: hidden;
+				display: inline-block;
+				vertical-align: bottom;
+				animation: ellipsis 2s infinite;
+				content: "\2026";
+			}
 
-    .dataloading:after {
-      overflow: hidden;
-      display: inline-block;
-      vertical-align: bottom;
-      animation: ellipsis 2s infinite;
-      content: '\2026';
-    }
+			@keyframes ellipsis {
+				from {
+					width: 2px;
+				}
 
-    @keyframes ellipsis {
-      from {
-        width: 2px;
-      }
+				to {
+					width: 15px;
+				}
+			}
+		}
+	}
 
-      to {
-        width: 15px;
-      }
-    }
-  }
-}
+	.condition {
+		display: flex;
+		flex-wrap: wrap;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin-bottom: 30rpx;
+		margin: 20rpx auto;
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
 
-.condition {
-  display: flex;
-  flex-wrap: wrap;
-  width: 90%;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  margin: 0 auto 30rpx;
+			.tr {
+				display: flex;
+				overflow: hidden;
 
-  .scroll-X {
-    width: 95%;
-    margin: 20rpx auto;
+				.th,
+				.td {
+					display: inline-block;
+					padding: 5rpx;
+					width: 300rpx;
+					text-align: center;
+					height: 52rpx;
+					line-height: 52rpx;
+					border: 2rpx solid #F1F1F1;
+				}
+			}
 
-    .tr {
-      display: flex;
-      overflow: hidden;
+			.tr:nth-child(2n-1) {
+				background-color: #f5fff8;
+			}
 
-      .th,
-      .td {
-        display: inline-block;
-        padding: 5rpx;
-        width: 300rpx;
-        text-align: center;
-        height: 52rpx;
-        line-height: 52rpx;
-        border: 2rpx solid #f1f1f1;
-      }
-    }
+			.tr:first-child {
+				background-color: #57c878;
+				color: #fff;
+			}
+		}
 
-    .tr:nth-child(2n-1) {
-      background-color: #f5fff8;
-    }
+		.pagenumber {
+			display: flex;
+			margin: 20rpx auto;
 
-    .tr:first-child {
-      background-color: #57c878;
-      color: #fff;
-    }
-  }
+			button {
+				width: 150rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+				background-color: #57c878;
+				color: #FFFFFF;
+			}
 
-  .pagenumber {
-    display: flex;
-    margin: 20rpx auto;
-
-    button {
-      width: 150rpx;
-      height: 50rpx;
-      line-height: 50rpx;
-      font-size: 26rpx;
-      text-align: center;
-      background-color: #57c878;
-      color: #ffffff;
-    }
-
-    .pagenumber_page {
-      width: 100rpx;
-      height: 50rpx;
-      line-height: 50rpx;
-      font-size: 26rpx;
-      text-align: center;
-    }
-  }
-}
+			.pagenumber_page {
+				width: 100rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+			}
+		}
+	}
 </style>

+ 2 - 2
pages/equipList2/index.vue

@@ -341,7 +341,7 @@
 						break;
 					case 6:
 						uni.navigateTo({
-							url: '/pages/webview/webview?device_id=' +
+							url: '/pages/webview?device_id=' +
 								item.id +
 								'&accessToken=' +
 								this.accessToken,
@@ -350,7 +350,7 @@
         	case 44:
           uni.navigateTo({
             url:
-              '/pages/webviewdgp/webviewdgp?device_id=' +
+              '/pages/webviewdgp?device_id=' +
               item.id +
               '&accessToken=' +
               uni.getStorageSync('session_key') +

+ 6 - 18
pages/index/index.vue

@@ -114,7 +114,7 @@
 					</view> -->
 				</view>
 			</view>
-			<view class="banner-ad">
+			<view class="banner-ad" @click="tabs">
 				<view class="ad-text">
 					<view class="title">
 						<!-- 松墨天牛拍照性诱智能监测 -->
@@ -122,7 +122,7 @@
 					<view class="sub-title">
 						<!-- AI慧眼识天牛    智守青山护松林 -->
 					</view>
-					<view class="btn" @click="tabs">
+					<view class="btn">
 						查看详情
 					</view>
 				</view>
@@ -139,7 +139,7 @@
 	import ImagePopup from './components/ImagePopup.vue';
 	export default {
 		components: {
-			ImagePopup
+			ImagePopup,
 		},
 		// // 分享给朋友
 		// onShareAppMessage() {
@@ -212,7 +212,7 @@
 			},
 		},
 		methods: {
-			handlePopupClose() {
+			handlePopupClose(){
 				console.log('弹窗已关闭')
 			},
 			tabs(){
@@ -414,26 +414,14 @@
 			Debounce(() => {
 				this.getUserlogin();
 			}, 500)();
-			uni.getLocation({
-				type: 'wgs84 ',
-				success: (res) => {
-					this.getcity(res.longitude, res.latitude);
-				},
-			});
-			// this.checkLocationPermission(true); // 首次加载弹框提醒
+			this.checkLocationPermission(true); // 首次加载弹框提醒
 		},
 		onShow() {
 			this.loadTF = false;
 			Debounce(() => {
 				this.getUserlogin();
 			}, 500)();
-			uni.getLocation({
-				type: 'wgs84 ',
-				success: (res) => {
-					this.getcity(res.longitude, res.latitude);
-				},
-			});
-			// this.checkLocationPermission();
+			this.checkLocationPermission();
 		},
 	};
 </script>

+ 2 - 2
util/neutral.js

@@ -1,6 +1,6 @@
 export default {
-  // isneutral:true,//云飞智控
-  isneutral: false, //智控
+  isneutral:true,//云飞智控
+  // isneutral: false, //智控
   developAPI:'https://uat.hnyfwlw.com',//测试环境访问地址
   // productAPI:'http://8.136.98.49:8002',//生产环境
   productAPI:'https://web.hnyfwlw.com',//生产环境