FenXiNspUniapp/pages/index/index.vue

1616 lines
43 KiB
Vue

<template>
<view class="container">
<uni-nav-bar :fixed="true" background-color="transparent" status-bar title="汾西小流域面源污染监测" />
<image src="../../static/home_top_bg.png" mode="" class="bgimg"></image>
<scroll-view class="content" scroll-y="true" :style="{height:contentheight + 'rpx'}">
<view class="top_address">
<view class="address_left" v-if="city">
<image src="../../static/home_icon_dingwei.png" mode=""></image>
<view class="left_shi">
{{ city }}
</view>
</view>
<view class="address_right" v-if="weather">
<view class="right_tq">
{{ weather }}
</view>
<image :src="weatherimg" mode=""></image>
</view>
</view>
<view class="pic">
<swiper class="pics" circular :indicator-dots="true" indicator-color="rgba(199, 199, 199, 0.3)"
indicator-active-color="rgba(197, 197, 197, 1)" :autoplay="autoplay" interval="3000"
:duration="duration">
<swiper-item class="swiper_items" v-for="(item,index) in bigswiperList" :key="index">
<image class="siwper_imgs" :src="baseUrl + '/applet/common/static/' + item.detailPics" mode="">
</image>
</swiper-item>
</swiper>
</view>
<view class="jgg">
<uni-grid :column="4" class="uni-grid" :showBorder="false" :highlight="false">
<uni-grid-item class="uni-grid-item" v-for="(item,index) in menuList" :key="index">
<view class="grid-item-box" @click="toList(item,index)">
<image :src="item.img" mode=""></image>
<text class="text" v-if="item.name">{{ item.name }}</text>
<view class="numberbj" v-if="index == 1 && bjnumber">
{{ cutMoneyFiter(bjnumber) }}
</view>
</view>
</uni-grid-item>
</uni-grid>
</view>
<view class="bottom_box">
<view class="bottom_top">
<view class="bottom_left">
<image src="../../static/home_title_img.png" mode=""></image>
</view>
<view class="bottom_right">
累计
<span class="num">{{ cutMoneyFiter(numbers) }}</span>
</view>
</view>
<view class="line"></view>
<swiper class="liebiao" next-margin="570rpx" :vertical="true" circular :autoplay="autoplay"
:indicator-dots="false" interval="3000" :duration="duration">
<swiper-item class="item" v-for="(item,index) in list" :key="index" @click="todetail(item,index)">
<view class="topline" :class="{'toplines':index == 0}"></view>
<view class="List">
<image class="imgs" src="../../static/home_img_zhuangshi_yuan.png" mode=""></image>
<view class="list_left">
<image src="../../static/home_zhuangshi_img.png" mode=""></image>
</view>
<view class="list_right">
<view class="list_right_top">
<view class="rit_top_lef" v-if="item.stationName">
{{ item.stationName }}
</view>
<view class="rit_top_rig" v-if="item.times">
{{ item.times[1] }}
</view>
</view>
<view class="list_right_bot">
<block>
<view class="bot_lef" :style="{background:item.color}">
{{ item.name }}
</view>
</block>
<view class="bot_mid">
<view class="bot_mid_left"
:class="{'bot_mid_lefts':item.type == 2 || item.type == 0}">
{{ item.value }}{{ item.unit }}
</view>
<!-- <image v-if="item.type == 1" src="../../static/home_shuju_shang.png" mode=""></image>
<image v-if="item.type == 2" src="../../static/home_shuju_xia.png" mode=""></image>
<view v-if="item.type == 0" class="" style="width: 42rpx;"> </view> -->
</view>
<view class="bot_rig" v-if="item.times">
{{ item.times[0] }}
</view>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
<view class="pagebot"></view>
</scroll-view>
</view>
</template>
<script>
import api from "@/api/api"
import configService from '@/common/service/config.service.js';
//高德SDKjs
// import amap from '@/common/amap-wx.130.js'; //自己js的所在的位置
export default {
data() {
return {
contentheight: 0,
pageheight: 0,
height: 0,
indicatorDots: true,
autoplay: true,
interval: 2000,
baseUrl: configService.apiUrl,
duration: 500,
pagelogin: '',
city: '',
numbers: 0,
wrwlist: [],
wrwcode: [],
colorList: ['#22BB8A', '#EE701C', '#52AC2A', '#2BADB9', '#D75A28', '#AD8F49', '#26A3CC', '#6C48C7',
'#22BB8A', '#415FBE', '#52AC2A', '#EE701C'
],
colorList1: ['#22BB8A', '#EE701C', '#52AC2A', '#2BADB9', '#D75A28', '#AD8F49', '#26A3CC', '#6C48C7',
'#22BB8A'
],
bigswiperList: [
// {
// img:require('../../static/banner1.png')
// },
// {
// img:require('../../static/banner.jpg')
// }
],
menuList: [{
name: '预警信息',
img: require('../../static/scd.png'),
path: '/packDetail/pages/sjdyj/index'
},
{
name: '统计分析',
img: require('../../static/home_icon_shuju.png'),
path: '/packDetail/pages/analysis/index'
},
{
name: '监测站点',
img: require('../../static/home_icon_jiance.png'),
path: '/packDetail/pages/Site/index'
},
{
name: '站点运维',
img: require('../../static/home_icon_yunwei.png'),
path: '/packDetail/pages/operations/index'
},
{
name: '视频监控',
img: require('../../static/home_icon_shipin.png'),
path: '/packDetail1/pages/device/index'
},
{
name: '土壤监测',
img: require('../../static/home_icon_shebei.png'),
path: '/packDetail/pages/vidio/index'
},
{
name: '农业废弃物',
img: require('../../static/home_icon_feiqiwu.png'),
path: '/packDetail/pages/waste/index'
},
{
name: '粪污台账',
img: require('../../static/home_icon_fenwu.png'),
path: '/packDetail/pages/fwtz/index'
},
],
list: [],
weather: '',
weatherimg: '',
bjnumber: '',
lastClickTime: 0,
throttleDelay: 1000 // 节流时间1秒
}
},
onLoad() {
// this.wrwlist = uni.getStorageSync('wrwlist')
console.log(1561)
uni.getSystemInfo({
success: res => {
var pxToRpxScale = 750 / res.windowWidth
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
var navigationHeight = 44 * pxToRpxScale
this.height = res.windowHeight * pxToRpxScale //将px 转换rpx
// console.log(navigationHeight,'111111111')
// console.log(this.height, ktxStatusHeight, navigationHeight)
this.contentheight = this.height - ktxStatusHeight - navigationHeight
this.pageheight = this.height - ktxStatusHeight - navigationHeight - 98
}
});
var QQMapWX = require('@/static/qqmap-wx-jssdk.min.js');
var amapFile = require('@/common/amap-wx.130.js')
// 实例化API核心类
var qqmapsdk = new QQMapWX({
key: 'WVDBZ-FGPRZ-JQMXB-ZIGM3-YADQV-NSF44' // 必填
});
var myAmapFun = new amapFile.AMapWX({
key: 'e1dc41b2d5363e7768023cdb6aaddb01'
});
var that = this
myAmapFun.getWeather({
type: 'live',
// city:code,
success: function(data) {
console.log(data) //天气数据
that.weather = data.temperature.data + '℃'
that.city = data.liveData.city;
var twtype = data.weather.data
if (twtype.indexOf('云') != -1) {
that.weatherimg = '/static/tianqi_icon_duoyun.png'
} else if (twtype == '晴') {
that.weatherimg = '/static/tianqi_icon_qingtian.png'
} else if (twtype == '小雨') {
that.weatherimg = '/static/tianqi_icon_xiaoyu.png'
} else if (twtype == '阴') {
that.weatherimg = '/static/tianqi_icon_yintian.png'
} else if (twtype == '中雨') {
that.weatherimg = '/static/tianqi_icon_zhongyu.png'
} else if (twtype == '大雨') {
that.weatherimg = '/static/tianqi_icon_dayu.png'
} else if (twtype == '雷阵雨') {
that.weatherimg = '/static/tianqi_icon_leizhengyu.png'
} else if (twtype.indexOf('雪') != -1) {
that.weatherimg = '/static/tianqi_icon_xuetian.png'
} else if (twtype.indexOf('暴雨') != -1) {
that.weatherimg = '/static/tianqi_icon_dayu.png'
} else if (twtype.indexOf('阵雨') != -1) {
that.weatherimg = '/static/tianqi_icon_dayu.png'
} else if (twtype.indexOf('雨') != -1) {
that.weatherimg = '/static/tianqi_icon_zhongyu.png'
} else if (twtype.indexOf('雷') != -1) {
that.weatherimg = '/static/tianqi_icon_leizhengyu.png'
} else if (twtype.indexOf('雾') != -1) {
that.weatherimg = '/static/tianqi_icon_wu.png'
} else if (twtype.indexOf('霾') != -1) {
that.weatherimg = '/static/tianqi_icon_wu.png'
} else if (twtype.indexOf('风') != -1) {
that.weatherimg = '/static/tianqi_icon_duoyun.png'
} else if (twtype.indexOf('沙') != -1 || twtype.indexOf('尘') != -1) {
that.weatherimg = '/static/tianqi_icon_duoyun.png'
}
},
fail: function(info) {
//失败回调
console.log(info)
},
complete: function(resa) {
console.log(resa)
}
})
},
onShow() {
var that = this
if (uni.getStorageSync('third_session')) {
uni.login({
success: function(res) {
console.log(res.code)
this.code = res.code
let params = {}
params.jsCode = this.code
console.log(params, 152)
api.wxlogin(params).then(res => {
console.log(res, 165)
if (res.data.code == 0) {
let userInfo = res.data.data;
// uni.setStorageSync('third_session', userInfo.thirdSession);
if (!userInfo.id) {
// uni.reLaunch({
// url:'/packDetail/pages/login/login'
// })
that.bigswiperList = [{
"id": "1692474977070829569",
"infoId": "1692474921957675010",
"detailCode": "图1",
"detailValue": "图",
"detailValue2": "1",
"propsValue1": null,
"propsValue2": null,
"detailPics": "temp/20230818174636_1692352452041.jpg",
"detailExtPics": null,
"detailNote": null,
"isShow": "1",
"sortNo": 1,
"tenantId": null,
"reVision": 0,
"createdBy": "hjadmin",
"createTime": "2023-08-18 17:54:14",
"updatedBy": null,
"isDel": 0,
"updatedTime": null
}, {
"id": "1692475023417888770",
"infoId": "1692474921957675010",
"detailCode": "图2",
"detailValue": "图",
"detailValue2": "2",
"propsValue1": null,
"propsValue2": null,
"detailPics": "temp/20230818174638_1692352462933.png",
"detailExtPics": null,
"detailNote": null,
"isShow": "1",
"sortNo": 1,
"tenantId": null,
"reVision": 0,
"createdBy": "hjadmin",
"createTime": "2023-08-18 17:54:25",
"updatedBy": null,
"isDel": 0,
"updatedTime": null
}]
that.wrwlist = [{
"unit": "℃",
"code": "dataAirTemp",
"color": "#22BB8A",
"icon": "sys/icon/shebei_icon_qixiang.png",
"description": "大气温度"
}, {
"unit": "%RH",
"code": "dataAirWet",
"color": "#EE701C",
"icon": "sys/icon/zhandian_icon_kongqishidu.png",
"description": "大气湿度"
}, {
"unit": "hPa",
"code": "dataAirPress",
"color": "#52AC2A",
"icon": "sys/icon/zhandian_icon_daqiyali.png",
"description": "大气压力"
}, {
"unit": "mm",
"code": "dataRainFall",
"color": "#2BADB9",
"icon": "sys/icon/zhandian_icon_jiangyuliang.png",
"description": "雨量"
}, {
"unit": "mm",
"code": "dataRainTotal",
"color": "#102B6A",
"icon": "sys/icon/zhandian_icon_jiangyuliang.png",
"description": "雨量累计"
}, {
"unit": "m/s",
"code": "dataWindSpeed",
"color": "#7CD6CF",
"icon": "sys/icon/zhandian_icon_fengsu.png",
"description": "风速"
}, {
"unit": "°",
"code": "dataWindDirection",
"color": "#26A3CC",
"icon": "sys/icon/zhandian_icon_fengxiang.png",
"description": "风向"
}, {
"unit": "MJ/m2",
"code": "dataSunTotal",
"color": "#6C48C7",
"icon": "sys/icon/zhandian_icon_taiyangquanfushe.png",
"description": "辐射累计"
}, {
"unit": "W/m2",
"code": "dataSunFallout",
"color": "#22BB8A",
"icon": "sys/icon/zhandian_icon_taiyangquanfushe.png",
"description": "太阳全辐射"
}, {
"unit": "%",
"code": "dataSoilWet",
"color": "#6495ED",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "20CM土壤湿度"
}, {
"unit": "%",
"code": "dataSoilWet2",
"color": "#4169E1",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "40CM土壤湿度"
}, {
"unit": "%",
"code": "dataSoilWet3",
"color": "#0000CD",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "60CM土壤湿度"
}, {
"unit": "℃",
"code": "dataSoilTemp",
"color": "#C71585",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "20CM土壤温度"
}, {
"unit": "℃",
"code": "dataSoilTemp2",
"color": "#FF1493",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "40CM土壤温度"
}, {
"unit": "℃",
"code": "dataSoilTemp3",
"color": "#FF69B4",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "60CM土壤温度"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl",
"color": "#92D0D0",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "20CM电导率"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl2",
"color": "#73A2A2",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "40CM电导率"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl3",
"color": "#567777",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "60CM电导率"
}, {
"unit": "",
"code": "dataSoilSalt",
"color": "#4F5555",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "土壤盐分"
}, {
"unit": "%",
"code": "dataSoilWetMark",
"color": "#6495ED",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "土壤湿度"
}, {
"unit": "℃",
"code": "dataSoilMark",
"color": "#C71585",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "土壤温度"
}, {
"unit": "uS/cm",
"code": "dataSoilDdlMark",
"color": "#92D0D0",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "电导率"
}, {
"unit": "mg/L",
"code": "dataWaterTp",
"color": "#C8CC00",
"icon": "sys/icon/shebei_icon_tp.png",
"description": "总磷"
}, {
"unit": "mg/L",
"code": "dataWaterTn",
"color": "#009DB2",
"icon": "sys/icon/shebei_icon_tn.png",
"description": "总氮"
}, {
"unit": "mg/L",
"code": "dataWaterNo",
"color": "#72BAA7",
"icon": "sys/icon/shebei_icon_no3n.png",
"description": "硝态氮"
}, {
"unit": "mg/L",
"code": "dataWaterNh",
"color": "#225A1F",
"icon": "sys/icon/shebei_icon_nh3n.png",
"description": "氨氮"
}, {
"unit": "mg/L",
"code": "dataWaterCod",
"color": "#FDB933",
"icon": "sys/icon/shebei_icon_cod.png",
"description": "化学需氧量"
}, {
"unit": "mg/m³",
"code": "dataOu",
"color": "#f47a75",
"icon": "sys/icon/zhandian_icon_ou.png",
"description": "臭气浓度"
}, {
"unit": "mg/m³",
"code": "dataNh3",
"color": "#d05c7c",
"icon": "sys/icon/zhandian_icon_nh3.png",
"description": "氨气"
}, {
"unit": "mg/m³",
"code": "dataH2s",
"color": "#d05c9f",
"icon": "sys/icon/zhandian_icon_h2s.png",
"description": "硫化氢"
}, {
"unit": "mg/m³",
"code": "dataTvoc",
"color": "#f06464",
"icon": "sys/icon/zhandian_icon_tvoc.png",
"description": "总挥发性有机物"
}, {
"unit": "台",
"code": "default",
"color": "#DEAB8A",
"icon": "",
"description": "默认"
}]
that.list = [{
"name": "总氮",
"unit": "mg/L",
"value": "2.0000",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "1.0061",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "硝态氮",
"unit": "mg/L",
"value": "5.2110",
"color": "#72BAA7",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "2.1114",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "0.9864",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "硝态氮",
"unit": "mg/L",
"value": "1.2373",
"color": "#72BAA7",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "49.6451",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "10.1785",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "氨氮",
"unit": "mg/L",
"value": "49.9502",
"color": "#225A1F",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "化学需氧量",
"unit": "mg/L",
"value": "501.5000",
"color": "#FDB933",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "50.6921",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "0.2719",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "氨氮",
"unit": "mg/L",
"value": "48.9038",
"color": "#225A1F",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "化学需氧量",
"unit": "mg/L",
"value": "498.3486",
"color": "#FDB933",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}]
if (that.list) {
for (var i = 0; i < that.list.length; i++) {
// console.log(Object.keys(this.list[i]),Object.keys(this.list[i]).length)
that.list[i].wrwcode = []
// console.log(this.wrwlist,'污染物shuzu')
for (var j = 0; j < that.wrwlist.length; j++) {
// Object.keys 获取字段名
for (var k = 0; k < Object.keys(this.list[i])
.length; k++) {
if (that.wrwlist[j].code == Object.keys(that.list[
i])[k]) {
this.list[i].wrwcode.push({
name: that.wrwlist[j].description,
icon: that.wrwlist[j].icon,
unit: that.wrwlist[j].unit,
color: that.wrwlist[j].color,
code: that.wrwlist[j].code
})
}
}
}
if (that.list[i].dataDateTime) {
that.list[i].times = null
// console.log(this.list[i].times)
}
}
that.numbers = that.list[0].dataCounts
}
} else {
that.getzdInfo()
that.getsssj()
that.getnumber()
that.getpicinfo()
}
}
})
}
});
} else if (!uni.getStorageSync('third_session')) {
// uni.reLaunch({
// url: '/pages/loginindex'
// })
that.bigswiperList = [{
"id": "1692474977070829569",
"infoId": "1692474921957675010",
"detailCode": "图1",
"detailValue": "图",
"detailValue2": "1",
"propsValue1": null,
"propsValue2": null,
"detailPics": "temp/20230818174636_1692352452041.jpg",
"detailExtPics": null,
"detailNote": null,
"isShow": "1",
"sortNo": 1,
"tenantId": null,
"reVision": 0,
"createdBy": "hjadmin",
"createTime": "2023-08-18 17:54:14",
"updatedBy": null,
"isDel": 0,
"updatedTime": null
}, {
"id": "1692475023417888770",
"infoId": "1692474921957675010",
"detailCode": "图2",
"detailValue": "图",
"detailValue2": "2",
"propsValue1": null,
"propsValue2": null,
"detailPics": "temp/20230818174638_1692352462933.png",
"detailExtPics": null,
"detailNote": null,
"isShow": "1",
"sortNo": 1,
"tenantId": null,
"reVision": 0,
"createdBy": "hjadmin",
"createTime": "2023-08-18 17:54:25",
"updatedBy": null,
"isDel": 0,
"updatedTime": null
}]
that.wrwlist = [{
"unit": "℃",
"code": "dataAirTemp",
"color": "#22BB8A",
"icon": "sys/icon/shebei_icon_qixiang.png",
"description": "大气温度"
}, {
"unit": "%RH",
"code": "dataAirWet",
"color": "#EE701C",
"icon": "sys/icon/zhandian_icon_kongqishidu.png",
"description": "大气湿度"
}, {
"unit": "hPa",
"code": "dataAirPress",
"color": "#52AC2A",
"icon": "sys/icon/zhandian_icon_daqiyali.png",
"description": "大气压力"
}, {
"unit": "mm",
"code": "dataRainFall",
"color": "#2BADB9",
"icon": "sys/icon/zhandian_icon_jiangyuliang.png",
"description": "雨量"
}, {
"unit": "mm",
"code": "dataRainTotal",
"color": "#102B6A",
"icon": "sys/icon/zhandian_icon_jiangyuliang.png",
"description": "雨量累计"
}, {
"unit": "m/s",
"code": "dataWindSpeed",
"color": "#7CD6CF",
"icon": "sys/icon/zhandian_icon_fengsu.png",
"description": "风速"
}, {
"unit": "°",
"code": "dataWindDirection",
"color": "#26A3CC",
"icon": "sys/icon/zhandian_icon_fengxiang.png",
"description": "风向"
}, {
"unit": "MJ/m2",
"code": "dataSunTotal",
"color": "#6C48C7",
"icon": "sys/icon/zhandian_icon_taiyangquanfushe.png",
"description": "辐射累计"
}, {
"unit": "W/m2",
"code": "dataSunFallout",
"color": "#22BB8A",
"icon": "sys/icon/zhandian_icon_taiyangquanfushe.png",
"description": "太阳全辐射"
}, {
"unit": "%",
"code": "dataSoilWet",
"color": "#6495ED",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "20CM土壤湿度"
}, {
"unit": "%",
"code": "dataSoilWet2",
"color": "#4169E1",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "40CM土壤湿度"
}, {
"unit": "%",
"code": "dataSoilWet3",
"color": "#0000CD",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "60CM土壤湿度"
}, {
"unit": "℃",
"code": "dataSoilTemp",
"color": "#C71585",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "20CM土壤温度"
}, {
"unit": "℃",
"code": "dataSoilTemp2",
"color": "#FF1493",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "40CM土壤温度"
}, {
"unit": "℃",
"code": "dataSoilTemp3",
"color": "#FF69B4",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "60CM土壤温度"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl",
"color": "#92D0D0",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "20CM电导率"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl2",
"color": "#73A2A2",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "40CM电导率"
}, {
"unit": "uS/cm",
"code": "dataSoilDdl3",
"color": "#567777",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "60CM电导率"
}, {
"unit": "",
"code": "dataSoilSalt",
"color": "#4F5555",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "土壤盐分"
}, {
"unit": "%",
"code": "dataSoilWetMark",
"color": "#6495ED",
"icon": "sys/icon/zhandian_icon_turangshidu.png",
"description": "土壤湿度"
}, {
"unit": "℃",
"code": "dataSoilMark",
"color": "#C71585",
"icon": "sys/icon/zhandian_icon_turangwendu.png",
"description": "土壤温度"
}, {
"unit": "uS/cm",
"code": "dataSoilDdlMark",
"color": "#92D0D0",
"icon": "sys/icon/zhandian_icon_ec.png",
"description": "电导率"
}, {
"unit": "mg/L",
"code": "dataWaterTp",
"color": "#C8CC00",
"icon": "sys/icon/shebei_icon_tp.png",
"description": "总磷"
}, {
"unit": "mg/L",
"code": "dataWaterTn",
"color": "#009DB2",
"icon": "sys/icon/shebei_icon_tn.png",
"description": "总氮"
}, {
"unit": "mg/L",
"code": "dataWaterNo",
"color": "#72BAA7",
"icon": "sys/icon/shebei_icon_no3n.png",
"description": "硝态氮"
}, {
"unit": "mg/L",
"code": "dataWaterNh",
"color": "#225A1F",
"icon": "sys/icon/shebei_icon_nh3n.png",
"description": "氨氮"
}, {
"unit": "mg/L",
"code": "dataWaterCod",
"color": "#FDB933",
"icon": "sys/icon/shebei_icon_cod.png",
"description": "化学需氧量"
}, {
"unit": "mg/m³",
"code": "dataOu",
"color": "#f47a75",
"icon": "sys/icon/zhandian_icon_ou.png",
"description": "臭气浓度"
}, {
"unit": "mg/m³",
"code": "dataNh3",
"color": "#d05c7c",
"icon": "sys/icon/zhandian_icon_nh3.png",
"description": "氨气"
}, {
"unit": "mg/m³",
"code": "dataH2s",
"color": "#d05c9f",
"icon": "sys/icon/zhandian_icon_h2s.png",
"description": "硫化氢"
}, {
"unit": "mg/m³",
"code": "dataTvoc",
"color": "#f06464",
"icon": "sys/icon/zhandian_icon_tvoc.png",
"description": "总挥发性有机物"
}, {
"unit": "台",
"code": "default",
"color": "#DEAB8A",
"icon": "",
"description": "默认"
}]
that.list = [{
"name": "总氮",
"unit": "mg/L",
"value": "2.0000",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "1.0061",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "硝态氮",
"unit": "mg/L",
"value": "5.2110",
"color": "#72BAA7",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:23",
"stationName": "农田1号站",
"stationCode": "S_1",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "2.1114",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "0.9864",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "硝态氮",
"unit": "mg/L",
"value": "1.2373",
"color": "#72BAA7",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:50",
"stationName": "农田2号站",
"stationCode": "S_2",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "49.6451",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "10.1785",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "氨氮",
"unit": "mg/L",
"value": "49.9502",
"color": "#225A1F",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "化学需氧量",
"unit": "mg/L",
"value": "501.5000",
"color": "#FDB933",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:33:36",
"stationName": "畜禽1号站",
"stationCode": "S_3",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总氮",
"unit": "mg/L",
"value": "50.6921",
"color": "#009DB2",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "总磷",
"unit": "mg/L",
"value": "0.2719",
"color": "#C8CC00",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "氨氮",
"unit": "mg/L",
"value": "48.9038",
"color": "#225A1F",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}, {
"name": "化学需氧量",
"unit": "mg/L",
"value": "498.3486",
"color": "#FDB933",
"trend": null,
"survItem": null,
"dataDateTime": "2025-05-23 19:00:00",
"stationName": "畜禽2号站",
"stationCode": "S_4",
"stationType": null,
"dataCounts": 1045510
}]
if (that.list) {
for (var i = 0; i < that.list.length; i++) {
// console.log(Object.keys(this.list[i]),Object.keys(this.list[i]).length)
that.list[i].wrwcode = []
// console.log(this.wrwlist,'污染物shuzu')
for (var j = 0; j < that.wrwlist.length; j++) {
// Object.keys 获取字段名
for (var k = 0; k < Object.keys(this.list[i]).length; k++) {
if (that.wrwlist[j].code == Object.keys(that.list[i])[k]) {
this.list[i].wrwcode.push({
name: that.wrwlist[j].description,
icon: that.wrwlist[j].icon,
unit: that.wrwlist[j].unit,
color: that.wrwlist[j].color,
code: that.wrwlist[j].code
})
}
}
}
if (that.list[i].dataDateTime) {
that.list[i].times = null
// console.log(this.list[i].times)
}
}
that.numbers = that.list[0].dataCounts
}
}
},
methods: {
isAathorize(url) {
var that = this
if (uni.getStorageSync('third_session')) {
uni.login({
success: function(res) {
that.code = res.code
let params = {}
params.jsCode = that.code
api.wxlogin(params).then(res => {
if (res.data.code == 0) {
let userInfo = res.data.data;
if (!userInfo.id) {
uni.reLaunch({
url: '/packDetail/pages/login/login'
})
} else {
uni.navigateTo({
url: url
})
}
}
})
}
});
} else if (!uni.getStorageSync('third_session')) {
uni.reLaunch({
url: '/pages/loginindex'
})
}
},
onstoptouchmove() {
return false;
},
todetail(item, index) {
const now = Date.now();
// 如果距离上次点击时间小于节流时间,则忽略此次点击
if (now - this.lastClickTime < this.throttleDelay) {
console.log('点击过于频繁,请稍后再试');
return;
}
// 更新最后点击时间
this.lastClickTime = now;
// 执行原逻辑
this.isAathorize('/packDetail/pages/Site/detail?item=' + encodeURIComponent(JSON.stringify(item)));
},
tologin() {
uni.reLaunch({
url: '/packDetail/pages/login/login'
})
},
getzdInfo() {
this.$http.get('/applet/wxclient/getPollutionDict').then(res => {
this.wrwlist = res.data.data
uni.setStorageSync('wrwlist', res.data.data)
})
},
getpicinfo() {
var infoType = 'applet_roll'
this.$http.post('/applet/wxclient/displayInfo?infoType=' + infoType).then(res => {
this.bigswiperList = res.data.data.effect_assess.detailList
})
},
getnumber() {
this.$http.get('/applet/survPestlightAlert/getLightAlertCount').then(res => {
this.bjnumber = res.data.data.alertCount
})
},
getsssj() {
this.$http.post('/applet/wxclient/getNewestData').then(res => {
this.list = res.data.data
if (this.list.length>0) {
for (var i = 0; i < this.list.length; i++) {
// console.log(Object.keys(this.list[i]),Object.keys(this.list[i]).length)
this.list[i].wrwcode = []
// console.log(this.wrwlist,'污染物shuzu')
for (var j = 0; j < this.wrwlist.length; j++) {
// Object.keys 获取字段名
for (var k = 0; k < Object.keys(this.list[i]).length; k++) {
if (this.wrwlist[j].code == Object.keys(this.list[i])[k]) {
this.list[i].wrwcode.push({
name: this.wrwlist[j].description,
icon: this.wrwlist[j].icon,
unit: this.wrwlist[j].unit,
color: this.wrwlist[j].color,
code: this.wrwlist[j].code
})
}
}
}
if (this.list[i].dataDateTime) {
this.list[i].times = this.list[i].dataDateTime.split(" ")
// console.log(this.list[i].times)
}
}
this.numbers = this.list[0].dataCounts
}
})
},
toList(item, index) {
this.isAathorize(item.path)
}
}
}
</script>
<style lang="scss">
page {
background-color: #F4F5F9;
height: 100%;
}
.container {
height: 100%;
}
.uni-nav-bar {
background-color: transparent;
border-color: transparent;
height: 44px;
}
.uni-nav-bar-text {
font-size: 32rpx !important;
font-family: Source Han Sans SC;
font-weight: bold;
color: #FFFFFF !important;
}
.uni-nav-bar__left,
.uni-nav-bar__right {
color: #FFFFFF;
}
.uni-navbar__content {
border: 0 none !important;
}
.bgimg {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: -99;
}
.content {
padding: 0 29rpx;
box-sizing: border-box;
}
.top_address {
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
}
.address_left {
display: flex;
align-items: center;
}
.address_left image {
width: 32rpx;
height: 32rpx;
margin-right: 6rpx;
}
.left_shi {
font-size: 28rpx;
font-family: Source Han Sans SC;
color: #FFFFFF;
}
.address_right {
font-size: 28rpx;
font-family: Source Han Sans SC;
color: #FFFFFF;
display: flex;
align-items: center;
}
.address_right image {
width: 38rpx;
height: 38rpx;
margin-left: 14rpx;
}
.pic {
width: 100%;
height: 342rpx;
background: #DFE6E8;
background: rgba(223, 230, 232, 0.4);
border-radius: 28rpx;
overflow: hidden;
transform: translateY(0);
}
.pics {
width: 100%;
height: 100%;
overflow: hidden;
border-radius: 28rpx;
transform: translateY(0);
}
.swiper_items image {
width: 100%;
height: 100%;
border-radius: 28rpx;
}
.jgg {
background: #FFFFFF;
border-radius: 36rpx;
margin-top: 40rpx;
padding: 37rpx 20rpx;
padding-bottom: 0;
box-sizing: border-box;
margin-bottom: 32rpx;
}
.uni-grid-item {
height: 200rpx;
}
.uni-grid-item image {
width: 124rpx;
height: 124rpx;
}
.text {
font-size: 24rpx;
font-family: Source Han Sans SC;
font-weight: 400;
color: #333333;
margin-top: 14rpx;
}
.grid-item-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.numberbj {
height: 40rpx;
min-width: 40rpx;
padding: 0 12rpx;
background-color: red;
border: 2rpx solid #fff;
border-radius: 40rpx;
z-index: 99;
position: absolute;
color: #fff;
font-size: 20rpx;
line-height: 40rpx;
text-align: center;
top: -5rpx;
right: 5rpx;
}
.grid-item-box-row {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.grid-dot {
position: absolute;
top: 5px;
right: 15px;
}
.bottom_box {
background: #FFFFFF;
border-radius: 36rpx;
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 28rpx;
}
.bottom_top {
height: 94rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.bottom_left image {
width: 358rpx;
height: 32rpx;
}
.bottom_right {
font-size: 24rpx;
font-family: Source Han Sans SC;
color: #B3C1D1;
}
.num {
font-size: 34rpx;
font-family: DIN Next LT Pro;
color: #2AC166;
margin: 0 9rpx;
}
.line {
height: 2rpx;
background: #EBF2FB;
}
.topline {
margin-left: 24rpx;
height: 24rpx;
border-left: 1rpx solid #EBF2FB;
}
.List {
margin-left: 24rpx;
box-sizing: border-box;
border-left: 1rpx solid #EBF2FB;
position: relative;
display: flex;
align-items: center;
padding-left: 20rpx;
height: 120rpx;
}
.imgs {
width: 37rpx;
height: 37rpx;
position: absolute;
top: 44%;
left: -20rpx;
transform: translateY(-44%);
}
.list_left {
height: 100%;
}
.list_left image {
width: 13rpx;
height: 100%;
}
.list_right {
height: 100%;
background-color: #F6F6F6;
border-radius: 0rpx 12rpx 12rpx 0rpx;
padding-left: 24rpx;
padding-right: 24rpx;
width: 100%;
padding-top: 6rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
padding-bottom: 18rpx;
}
.list_right_top {
display: flex;
justify-content: space-between;
}
.rit_top_lef {
font-size: 28rpx;
font-family: Source Han Sans SC;
color: #333333;
width: 85%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.rit_top_rig {
font-size: 25rpx;
font-family: DIN Next LT Pro;
font-weight: 400;
color: #999999;
}
.list_right_bot {
display: flex;
align-items: center;
justify-content: space-between;
}
.bot_lef {
padding: 6rpx 22rpx 6rpx 21rpx;
// background: #22BB8A;
border-radius: 4rpx;
font-size: 24rpx;
font-family: Source Han Sans SC;
color: #FFFFFF;
}
.bot_mid {
display: flex;
align-items: center;
flex: 1;
justify-content: flex-end;
}
.bot_mid_left {
font-size: 28rpx;
font-family: DIN Next LT Pro;
font-weight: 400;
color: #FF4242;
}
.bot_mid_lefts {
color: #2FCD81;
}
.gg {
font-size: 24rpx;
font-family: DIN Next LT Pro;
font-weight: 500;
color: #308DFF;
margin-left: 10rpx;
}
.bot_mid image {
width: 32rpx;
height: 32rpx;
margin-left: 10rpx;
}
.bot_rig {
font-size: 25rpx;
font-family: DIN Next LT Pro;
font-weight: 400;
color: #999999;
margin-left: 39rpx;
}
.toplines {
border: none;
}
.pagebot {
height: 59rpx;
}
.liebiao {
height: 713rpx;
}
</style>