Compare commits
24 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
597540f977 | |
|
|
feac3406f9 | |
|
|
1337f99702 | |
|
|
8350978c5e | |
|
|
816306b598 | |
|
|
81a0a7ba3d | |
|
|
fa44229ed2 | |
|
|
ce1dc5b5a7 | |
|
|
2f87639314 | |
|
|
5fb3ab000f | |
|
|
4083d013a6 | |
|
|
409d761bbc | |
|
|
eae5281682 | |
|
|
e2333f8caa | |
|
|
6f4f11be3a | |
|
|
bbf08640b4 | |
|
|
246f34358c | |
|
|
314b871493 | |
|
|
d2194a55c8 | |
|
|
eb7c194ea9 | |
|
|
7ec7cea507 | |
|
|
54fbe9b3e9 | |
|
|
6674ed8584 | |
|
|
8447475eb9 |
12
App.vue
12
App.vue
|
|
@ -190,20 +190,12 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
if(!uni.getStorageSync('third_session')){
|
console.log('App onLoad!')
|
||||||
uni.reLaunch({
|
|
||||||
url:'/packDetail/pages/login/login'
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
uni.reLaunch({
|
|
||||||
url:'/pages/index/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
console.log('App Hide1')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
49
api/api.js
49
api/api.js
|
|
@ -1,5 +1,6 @@
|
||||||
import { http } from '@/common/service/service.js'
|
import { http } from '@/common/service/service.js'
|
||||||
import configService from '@/common/service/config.service.js';
|
import configService from '@/common/service/config.service.js';
|
||||||
|
import indexData from "@/pages/index/indexData";
|
||||||
const apiService = {
|
const apiService = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,7 +38,55 @@ const apiService = {
|
||||||
}else{
|
}else{
|
||||||
return configService.staticDomainURL + "/" + avatar;
|
return configService.staticDomainURL + "/" + avatar;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 检查登录并执行:api.checkLogin(()=>{}, () => {});
|
||||||
|
checkLogin(successCallback,failCallback){
|
||||||
|
let that = this;
|
||||||
|
if (uni.getStorageSync('userInfo') && uni.getStorageSync('third_session')) {
|
||||||
|
if(successCallback){
|
||||||
|
successCallback();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
uni.login({
|
||||||
|
success: function(res) {
|
||||||
|
let params = {}
|
||||||
|
params.jsCode = res.code
|
||||||
|
that.wxlogin(params).then(res => {
|
||||||
|
that.loginCallback(res, successCallback, failCallback);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loginCallback(res, successCallback, failCallback){
|
||||||
|
let that = this;
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
let userInfo = res.data.data;
|
||||||
|
if (!userInfo.id) {
|
||||||
|
console.error('登录失败',userInfo)
|
||||||
|
that.loginFail();
|
||||||
|
if(failCallback){
|
||||||
|
failCallback();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('登录成功',userInfo)
|
||||||
|
uni.setStorageSync('userInfo', userInfo);
|
||||||
|
uni.setStorageSync('third_session', userInfo.thirdSession);
|
||||||
|
if(successCallback){
|
||||||
|
successCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.loginFail();
|
||||||
|
if(failCallback){
|
||||||
|
failCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loginFail () {
|
||||||
|
uni.removeStorageSync('third_session')
|
||||||
|
uni.removeStorageSync('userInfo');
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default apiService;
|
export default apiService;
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,12 @@ let apiUrl = configService.apiUrl;
|
||||||
|
|
||||||
const http = new Request()
|
const http = new Request()
|
||||||
http.setConfig((config) => { /* 设置全局配置 */
|
http.setConfig((config) => { /* 设置全局配置 */
|
||||||
config.baseUrl = apiUrl /* 根域名不同 */
|
config.baseUrl = apiUrl; /* 根域名不同 */
|
||||||
config.header = {
|
config.header = {
|
||||||
...config.header
|
...config.header
|
||||||
}
|
};
|
||||||
|
console.log(config)
|
||||||
|
// config.headers['X-Access-Token'] = localStorage.getItem("token")
|
||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -45,8 +47,8 @@ http.interceptor.request((config, cancel) => { /* 请求之前拦截器 */
|
||||||
// 'X-Access-Token':getTokenStorage()
|
// 'X-Access-Token':getTokenStorage()
|
||||||
'app-id' : uni.getAccountInfoSync().miniProgram.appId,
|
'app-id' : uni.getAccountInfoSync().miniProgram.appId,
|
||||||
"client-type" : "MA",
|
"client-type" : "MA",
|
||||||
'third-session' : uni.getStorageSync('third_session'),
|
'third-session' : uni.getStorageSync('third_session')||'123',
|
||||||
'X-Tenant-Id' : '1001'
|
'X-Tenant-Id' : '1004'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (!token) { // 如果token不存在,调用cancel 会取消本次请求,但是该函数的catch() 仍会执行
|
if (!token) { // 如果token不存在,调用cancel 会取消本次请求,但是该函数的catch() 仍会执行
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name" : "汾西小流域面源污染监测",
|
"name" : "农业面源污染监测系统",
|
||||||
"appid" : "__UNI__44A8AB0",
|
"appid" : "__UNI__A58A5D7",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "2.2.22",
|
"versionName" : "2.2.22",
|
||||||
"versionCode" : 233,
|
"versionCode" : 233,
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
"quickapp" : {},
|
"quickapp" : {},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"appid" : "wx54f76f700fe3a498",
|
"appid" : "wx2fb61322f3042141",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false,
|
"urlCheck" : false,
|
||||||
"es6" : true,
|
"es6" : true,
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="jczb_bot">
|
<view class="jczb_bot">
|
||||||
<view>
|
<view>
|
||||||
<view class="jccontent" v-if="orientlist.length != 0">
|
<view class="jccontent" v-if="orientlist && orientlist.length != 0">
|
||||||
<view class="titles">
|
<view class="titles">
|
||||||
重要污染物监测
|
重要污染物监测
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="jccontent" v-if="livelist.length != 0">
|
<view class="jccontent" v-if="livelist && livelist.length != 0">
|
||||||
<view class="titles">
|
<view class="titles">
|
||||||
重要污染物监测
|
重要污染物监测
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -260,14 +260,12 @@
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.item = JSON.parse(decodeURIComponent(options.item));
|
this.item = JSON.parse(decodeURIComponent(options.item));
|
||||||
console.log("...........",this.item)
|
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: res => {
|
success: res => {
|
||||||
var pxToRpxScale = 750 / res.windowWidth
|
var pxToRpxScale = 750 / res.windowWidth
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -293,6 +291,7 @@
|
||||||
this.livelist = res.data.data.liveSurvData
|
this.livelist = res.data.data.liveSurvData
|
||||||
this.stinklist = res.data.data.stinkSurvData
|
this.stinklist = res.data.data.stinkSurvData
|
||||||
this.survCamera = res.data.data.survCamera
|
this.survCamera = res.data.data.survCamera
|
||||||
|
this.survItemList = res.data.data.stationInfo.survColorItems
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
})
|
})
|
||||||
|
|
@ -306,6 +305,7 @@
|
||||||
let items = item.deployCode.split('-')
|
let items = item.deployCode.split('-')
|
||||||
var obj = {
|
var obj = {
|
||||||
url: "https://m.ilhzn.cn/#/pages/cameraView/ysyCamera",
|
url: "https://m.ilhzn.cn/#/pages/cameraView/ysyCamera",
|
||||||
|
// url: "https://m.ilhzn.cn/#/pages/cameraView/cameraView",
|
||||||
deployDes: item.deployDes + '-' + '',
|
deployDes: item.deployDes + '-' + '',
|
||||||
ysToken: this.token,
|
ysToken: this.token,
|
||||||
deviceIotUrl: item.deviceUrl
|
deviceIotUrl: item.deviceUrl
|
||||||
|
|
@ -327,7 +327,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
tosjdetail(item,index){
|
tosjdetail(item,index){
|
||||||
console.log(item,'gegwg')
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/packDetail/pages/Site/sjdetail?item=' + encodeURIComponent(JSON.stringify(item)) + '&stationCode='+this.details.stationCode + '&stationName=' + this.details.stationName
|
url:'/packDetail/pages/Site/sjdetail?item=' + encodeURIComponent(JSON.stringify(item)) + '&stationCode='+this.details.stationCode + '&stationName=' + this.details.stationName
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
<view class="list_item_top">
|
<view class="list_item_top">
|
||||||
<view class="list_item_left">
|
<view class="list_item_left">
|
||||||
<image v-if="item.stationType == 'livestock'" src="../../static/zhandian_icon_xuqin.png" mode=""></image>
|
<image v-if="item.stationType == 'livestock'" src="../../static/zhandian_icon_xuqin.png" mode=""></image>
|
||||||
|
<image v-else-if="item.stationType == 'watershed'" src="../../static/zhandian_icon_xuqin.png" mode=""></image>
|
||||||
<image v-else src="../../static/zd.png" mode=""></image>
|
<image v-else src="../../static/zd.png" mode=""></image>
|
||||||
<view class="item_right" v-if="item.stationName">
|
<view class="item_right" v-if="item.stationName">
|
||||||
<view class="right_top">
|
<view class="right_top">
|
||||||
|
|
@ -86,6 +87,7 @@
|
||||||
pageNo:1,
|
pageNo:1,
|
||||||
pageSize:4,
|
pageSize:4,
|
||||||
isRefresher: false, //下拉刷新状态
|
isRefresher: false, //下拉刷新状态
|
||||||
|
isLoading: false, // 添加加载状态锁
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
@ -95,7 +97,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -111,71 +112,69 @@
|
||||||
refresherpullingFun() {
|
refresherpullingFun() {
|
||||||
this.isRefresher= true
|
this.isRefresher= true
|
||||||
},
|
},
|
||||||
getList(){
|
getList(isRefresh = false) {
|
||||||
let params = {}
|
// 防止重复请求
|
||||||
params.pageNo = this.pageNo
|
if (this.isLoading) return
|
||||||
params.pageSize = this.pageSize
|
this.isLoading = true
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中'
|
let params = {
|
||||||
});
|
pageNo: this.pageNo,
|
||||||
|
pageSize: this.pageSize
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有首次加载才显示全局loading
|
||||||
|
if (this.pageNo === 1 && !isRefresh) {
|
||||||
|
uni.showLoading({ title: '加载中' })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 首次加载清空列表,下拉刷新时不清空
|
||||||
|
if (this.pageNo === 1 && !isRefresh) {
|
||||||
this.List = []
|
this.List = []
|
||||||
this.$http.get('/applet/survStationInfo/page',{params:params}).then(res =>{
|
}
|
||||||
if(res.data.code == 0){
|
|
||||||
var data = res.data.data.records
|
this.$http.get('/applet/survStationInfo/page', { params }).then(res => {
|
||||||
|
this.isLoading = false
|
||||||
|
uni.hideLoading()
|
||||||
|
this.isRefresher = false
|
||||||
|
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
let data = res.data.data.records || []
|
||||||
|
if (this.pageNo === 1) {
|
||||||
|
this.List = data
|
||||||
|
} else {
|
||||||
this.List = this.List.concat(data)
|
this.List = this.List.concat(data)
|
||||||
for(var i=0;i<this.List.length;i++){
|
|
||||||
if(this.List[i].deviceCount >= 10000 && this.List[i].deviceCount < 100000000){
|
|
||||||
this.List[i].deviceCount = (this.List[i].deviceCount /10000).toFixed(1) + '万'
|
|
||||||
}
|
}
|
||||||
if(this.List[i].deviceCount >= 100000000){
|
|
||||||
this.List[i].deviceCount = (this.List[i].deviceCount /100000000).toFixed(1) + '亿'
|
// 格式化数据
|
||||||
|
this.formatData()
|
||||||
|
|
||||||
|
// 更新分页状态
|
||||||
|
this.updatePaginationStatus(res.data.data.total)
|
||||||
}
|
}
|
||||||
if(this.List[i].survObj.length >= 10000 && this.List[i].survObj.length < 100000000){
|
}).catch(err => {
|
||||||
this.List[i].survObj.length = (this.List[i].survObj.length /10000).toFixed(1) + '万'
|
this.isLoading = false
|
||||||
}
|
uni.hideLoading()
|
||||||
if(this.List[i].survObj.length >= 100000000){
|
|
||||||
this.List[i].survObj.length = (this.List[i].survObj.length /100000000).toFixed(1) + '亿'
|
|
||||||
}
|
|
||||||
if(this.List[i].survDataCount >= 10000 && this.List[i].survDataCount < 100000000){
|
|
||||||
this.List[i].survDataCount = (this.List[i].survDataCount /10000).toFixed(1) + '万'
|
|
||||||
}
|
|
||||||
if(this.List[i].survDataCount >= 100000000){
|
|
||||||
this.List[i].survDataCount = (this.List[i].survDataCount /100000000).toFixed(1) + '亿'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(this.List,'35415')
|
|
||||||
if(res.data.data.total != 0){
|
|
||||||
this.allNum = Number(res.data.data.total)/Number(this.pageSize)+'';
|
|
||||||
console.log(this.allNum,'总页数')
|
|
||||||
if(this.allNum.indexOf('.') == -1) {
|
|
||||||
this.allNum = this.allNum;
|
|
||||||
console.log(this.allNum,'if')
|
|
||||||
} else {
|
|
||||||
this.allNum = parseInt(Number(this.allNum)+1);
|
|
||||||
console.log(this.allNum,'else')
|
|
||||||
}
|
|
||||||
console.log(this.pageNo,this.allNum,'156156')
|
|
||||||
if(this.pageNo == this.allNum) {
|
|
||||||
this.isLastpage = true;
|
|
||||||
this.loadStatus='nomore'
|
|
||||||
console.log(this.isLastpage,'true','nomore')
|
|
||||||
} else {
|
|
||||||
this.isLastpage = false;
|
|
||||||
// this.isLoadMore=true
|
|
||||||
this.loadStatus = 'more'
|
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.isLastpage = true;
|
|
||||||
this.loadStatus='nomore'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uni.hideLoading();
|
|
||||||
this.isRefresher = false
|
this.isRefresher = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
formatData() {
|
||||||
|
// 将数据格式化逻辑提取出来
|
||||||
|
this.List.forEach(item => {
|
||||||
|
item.deviceCount = this.formatNumber(item.deviceCount)
|
||||||
|
item.survObj.length = this.formatNumber(item.survObj.length)
|
||||||
|
item.survDataCount = this.formatNumber(item.survDataCount)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
formatNumber(num) {
|
||||||
|
if (num >= 100000000) {
|
||||||
|
return (num / 100000000).toFixed(1) + '亿'
|
||||||
|
} else if (num >= 10000) {
|
||||||
|
return (num / 10000).toFixed(1) + '万'
|
||||||
|
}
|
||||||
|
return num || 0
|
||||||
|
},
|
||||||
lower() {
|
lower() {
|
||||||
console.log("最后一页了,取消下拉功能");
|
|
||||||
// 最后一页了,取消下拉功能
|
// 最后一页了,取消下拉功能
|
||||||
if (this.isLastpage) {
|
if (this.isLastpage) {
|
||||||
return
|
return
|
||||||
|
|
@ -185,7 +184,6 @@
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
num = num+1;
|
num = num+1;
|
||||||
},1000)
|
},1000)
|
||||||
console.log(this.intervalId,num)
|
|
||||||
this.pageNo = this.pageNo + 1;
|
this.pageNo = this.pageNo + 1;
|
||||||
let params = {}
|
let params = {}
|
||||||
params.pageNo = this.pageNo
|
params.pageNo = this.pageNo
|
||||||
|
|
@ -198,12 +196,10 @@
|
||||||
if(this.pageNo == this.allNum) {
|
if(this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus='nomore'
|
this.loadStatus='nomore'
|
||||||
console.log(this.isLastpage,'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<uni-nav-bar :fixed="true" left-icon="left" background-color="#0F6EFF" @clickLeft="back()" status-bar
|
<uni-nav-bar :fixed="true" left-icon="left" background-color="#0F6EFF" @clickLeft="back()" status-bar
|
||||||
:title="details.name"/>
|
:title="details.name"/>
|
||||||
<view class="contant">
|
<view class="contant" v-if="details.icon || details.name">
|
||||||
<view class="list_item">
|
<view class="list_item">
|
||||||
<view class="list_item_top">
|
<view class="list_item_top">
|
||||||
<view class="list_item_left">
|
<view class="list_item_left">
|
||||||
<image :src="details.icon" mode=""></image>
|
<image :src="baseUrl + '/' + details.icon" mode=""></image>
|
||||||
<view class="item_right">
|
<view class="item_right">
|
||||||
<view class="right_top" v-if="details.name">
|
<view class="right_top" v-if="details.name">
|
||||||
监测指标-{{details.name}}
|
监测指标-{{details.name}}
|
||||||
|
|
@ -64,12 +64,14 @@
|
||||||
<script>
|
<script>
|
||||||
import uniEcCanvas from '../../components/uni-ec-canvas/uni-ec-canvas.vue'
|
import uniEcCanvas from '../../components/uni-ec-canvas/uni-ec-canvas.vue'
|
||||||
import * as echarts from '../../components/uni-ec-canvas/echarts.js'
|
import * as echarts from '../../components/uni-ec-canvas/echarts.js'
|
||||||
|
import configService from "@/common/service/config.service";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
uniEcCanvas,
|
uniEcCanvas,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
baseUrl:configService.staticDomainURL,
|
||||||
items: {},
|
items: {},
|
||||||
details: {},
|
details: {},
|
||||||
list: [],
|
list: [],
|
||||||
|
|
@ -130,8 +132,6 @@
|
||||||
value: (Math.floor(Object.values(data[i])[k] * 100) / 100).toFixed(2),
|
value: (Math.floor(Object.values(data[i])[k] * 100) / 100).toFixed(2),
|
||||||
dataDateTime:data[i].dataDateTime
|
dataDateTime:data[i].dataDateTime
|
||||||
})
|
})
|
||||||
console.log(data[i].codelist, '数据')
|
|
||||||
console.log(data, '数据全部')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -139,26 +139,19 @@
|
||||||
}
|
}
|
||||||
// this.list = data
|
// this.list = data
|
||||||
this.list = this.list.concat(data)
|
this.list = this.list.concat(data)
|
||||||
// console.log(this.list, '数据all')
|
|
||||||
if(res.data.data.total != 0){
|
if(res.data.data.total != 0){
|
||||||
this.allNum = Number(res.data.data.total)/Number(this.pageSize)+'';
|
this.allNum = Number(res.data.data.total)/Number(this.pageSize)+'';
|
||||||
console.log(this.allNum,'总页数')
|
|
||||||
if(this.allNum.indexOf('.') == -1) {
|
if(this.allNum.indexOf('.') == -1) {
|
||||||
this.allNum = this.allNum;
|
this.allNum = this.allNum;
|
||||||
console.log(this.allNum,'if')
|
|
||||||
} else {
|
} else {
|
||||||
this.allNum = parseInt(Number(this.allNum)+1);
|
this.allNum = parseInt(Number(this.allNum)+1);
|
||||||
console.log(this.allNum,'else')
|
|
||||||
}
|
}
|
||||||
console.log(this.pageNo,this.allNum,'156156')
|
|
||||||
if(this.pageNo == this.allNum) {
|
if(this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus='nomore'
|
this.loadStatus='nomore'
|
||||||
console.log(this.isLastpage,'true','nomore')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
@ -167,7 +160,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
lower() {
|
lower() {
|
||||||
console.log("最后一页了,取消下拉功能");
|
|
||||||
// 最后一页了,取消下拉功能
|
// 最后一页了,取消下拉功能
|
||||||
if (this.isLastpage) {
|
if (this.isLastpage) {
|
||||||
return
|
return
|
||||||
|
|
@ -177,7 +169,6 @@
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
num = num+1;
|
num = num+1;
|
||||||
},1000)
|
},1000)
|
||||||
console.log(this.intervalId,num)
|
|
||||||
this.pageNo = this.pageNo + 1;
|
this.pageNo = this.pageNo + 1;
|
||||||
let params = {}
|
let params = {}
|
||||||
params.pollutionCode = this.details.code
|
params.pollutionCode = this.details.code
|
||||||
|
|
@ -199,8 +190,6 @@
|
||||||
value: (Math.floor(Object.values(data[i])[k] * 100) / 100).toFixed(2),
|
value: (Math.floor(Object.values(data[i])[k] * 100) / 100).toFixed(2),
|
||||||
dataDateTime:data[i].dataDateTime
|
dataDateTime:data[i].dataDateTime
|
||||||
})
|
})
|
||||||
console.log(data[i].codelist, '数据')
|
|
||||||
console.log(data, '数据全部')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -212,12 +201,10 @@
|
||||||
if(this.pageNo == this.allNum) {
|
if(this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus='nomore'
|
this.loadStatus='nomore'
|
||||||
console.log(this.isLastpage,'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container" ref="pageContainer">
|
||||||
<!-- <image src="../../static/sjfx.png" mode="" class="bgimg"></image> -->
|
<!-- <image src="../../static/sjfx.png" mode="" class="bgimg"></image> -->
|
||||||
<view class="pj">
|
<view class="pj">
|
||||||
<view class="pjtitle">
|
<view class="pjtitle">
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="sxbox wrwCov">
|
<view class="sxbox wrwCov">
|
||||||
<view class="leftsxbox">
|
<view class="leftsxbox">
|
||||||
<picker @change="bindPickerChange" :value="index" :range="array">
|
<picker @change="bindPickerChange" :value="index" :range="stationNameList">
|
||||||
<view class="uni-input">{{array[index]}}
|
<view class="uni-input">{{stationNameList[index]}}
|
||||||
<image src="../../static/data_btn_sanjiao_xia.png"></image>
|
<image src="../../static/data_btn_sanjiao_xia.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
|
|
@ -43,21 +43,29 @@
|
||||||
<!-- 年月日选择器 -->
|
<!-- 年月日选择器 -->
|
||||||
<view class="uni-form-item uni-column">
|
<view class="uni-form-item uni-column">
|
||||||
<radio-group class="radio-group" @change="radioChange">
|
<radio-group class="radio-group" @change="radioChange">
|
||||||
<label class="radio-label" v-for="(item, index) in timList" :key="item.value">
|
<label class="radio-label" v-for="(item, index) in timList" :key="item.value" :class="{ 'checked': current === index }">
|
||||||
<radio :value="item.value" :checked="index === current" class="radio-item" />
|
<radio :value="item.value" :checked="index === current" class="radio-item" color="#0f6efe" />
|
||||||
<view class="radio-text">{{item.name}}</view>
|
<view class="radio-text">{{item.name}}</view>
|
||||||
</label>
|
</label>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
</view>
|
</view>
|
||||||
<view class="qstcontent">
|
<view class="qstcontent" id="chartContainer" ref="chartContainer">
|
||||||
|
<!-- 有数据时显示图表 -->
|
||||||
<qiun-data-charts
|
<qiun-data-charts
|
||||||
|
:key="chartKey"
|
||||||
|
v-if="hasChartData && chartData.series && chartData.series.length > 0"
|
||||||
type="line"
|
type="line"
|
||||||
:opts="opts"
|
:opts="opts"
|
||||||
:chartData="chartData"
|
:chartData="chartData"
|
||||||
:enableScroll="true"
|
:enableScroll="true"
|
||||||
:ontouch="true"
|
:ontouch="true"
|
||||||
canvas2d
|
canvas2d
|
||||||
|
@finished="onChartFinished"
|
||||||
/>
|
/>
|
||||||
|
<!-- 无数据时显示占位 -->
|
||||||
|
<view v-else class="empty-chart">
|
||||||
|
<text class="empty-text">暂无数据</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="znyj">
|
<view class="znyj">
|
||||||
|
|
@ -71,8 +79,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="sxbox">
|
<view class="sxbox">
|
||||||
<view class="leftsxbox">
|
<view class="leftsxbox">
|
||||||
<picker @change="bindPickerChange1" :value="index1" :range="array1">
|
<picker @change="bindPickerChange1" :value="index1" :range="deviceNameList">
|
||||||
<view class="uni-input1">{{array1[index1]}}
|
<view class="uni-input1">{{deviceNameList[index1]}}
|
||||||
<image src="../../static/data_btn_sanjiao_xia.png"></image>
|
<image src="../../static/data_btn_sanjiao_xia.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
|
|
@ -126,16 +134,30 @@
|
||||||
height: 0,
|
height: 0,
|
||||||
scorllheight: 0,
|
scorllheight: 0,
|
||||||
zt: '',
|
zt: '',
|
||||||
date: new Date().getFullYear(),
|
date: new Date().getFullYear().toString(),
|
||||||
array: [],
|
|
||||||
index: 0, // 改为0,默认选择第一个
|
// ===== 趋势图相关数据 =====
|
||||||
index1: 0,
|
stationNameList: [], // 站点名称列表(用于趋势图选择器)
|
||||||
array1: [],
|
stationList: [], // 站点完整列表 [{label, value: stationCode}]
|
||||||
arrays: [],
|
index: 0, // 趋势图选中的站点索引
|
||||||
|
stationCode: '', // 当前选中的站点编码(趋势图接口参数)
|
||||||
|
|
||||||
|
// ===== 预警相关数据 =====
|
||||||
|
deviceNameList: ['全部监测设备'], // 设备名称列表(用于预警选择器)
|
||||||
|
deviceList: [{ // 设备完整列表 [{label, value: deployId}]
|
||||||
|
label: '全部监测设备',
|
||||||
|
value: ''
|
||||||
|
}],
|
||||||
|
index1: 0, // 预警选中的设备索引
|
||||||
|
deployId: '', // 当前选中的设备部署ID(预警接口参数)
|
||||||
|
|
||||||
list: [],
|
list: [],
|
||||||
tabList: ['站点名称', '告警指标', '指标值', '告警时间'],
|
tabList: ['站点名称', '告警指标', '指标值', '告警时间'],
|
||||||
pjlist: [],
|
pjlist: [],
|
||||||
chartData: {},
|
chartData: {
|
||||||
|
categories: [],
|
||||||
|
series: []
|
||||||
|
},
|
||||||
opts: {
|
opts: {
|
||||||
color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
|
color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
|
||||||
padding: [15,10,0,15],
|
padding: [15,10,0,15],
|
||||||
|
|
@ -182,15 +204,9 @@
|
||||||
top: 0,
|
top: 0,
|
||||||
total: 0,
|
total: 0,
|
||||||
yearStr: null,
|
yearStr: null,
|
||||||
stationName1: '',
|
|
||||||
stationCode1: null,
|
|
||||||
stationCode: '', // 趋势图站点编码
|
|
||||||
arrays1: [],
|
|
||||||
zxtdata: [],
|
|
||||||
timList: [{
|
timList: [{
|
||||||
value: 'yearMonth',
|
value: 'yearMonth',
|
||||||
name: '年',
|
name: '年'
|
||||||
checked: 'true'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'monthDays',
|
value: 'monthDays',
|
||||||
|
|
@ -202,11 +218,16 @@
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
current: 0,
|
current: 0,
|
||||||
dateqs: new Date().getFullYear().toString(), // 改为字符串
|
dateqs: new Date().getFullYear().toString(),
|
||||||
datetwo: currentDate,
|
datetwo: currentDate,
|
||||||
riqinumber: 'yearMonth',
|
riqinumber: 'yearMonth',
|
||||||
startDate: '', // 添加起始日期
|
startDate: '2000-01-01',
|
||||||
endDate: '', // 添加结束日期
|
endDate: '2030-12-31',
|
||||||
|
// 新增:加载状态和数据状态
|
||||||
|
isLoadingTrend: false,
|
||||||
|
hasChartData: false,
|
||||||
|
chartKey: 0,
|
||||||
|
isChartRendered: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
@ -219,88 +240,79 @@
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.index = 0
|
||||||
// 设置日期范围
|
this.index1 = 0
|
||||||
const currentYear = new Date().getFullYear();
|
|
||||||
this.startDate = `${currentYear - 10}-01-01`;
|
|
||||||
this.endDate = `${currentYear + 10}-12-31`;
|
|
||||||
|
|
||||||
// 先获取评价数据
|
|
||||||
this.getpj()
|
this.getpj()
|
||||||
// 获取站点列表(内部会调用趋势图)
|
this.getStationList() // 获取站点列表(趋势图用)
|
||||||
this.importWyw()
|
this.getDeviceList() // 获取设备列表(预警用)
|
||||||
// 获取预警设备列表
|
|
||||||
this.getazsurvMulchRecord()
|
|
||||||
// 获取预警列表
|
|
||||||
this.getyjList()
|
this.getyjList()
|
||||||
},
|
},
|
||||||
methods: {
|
// 页面显示时重置滚动
|
||||||
// 获取站点列表
|
onShow() {
|
||||||
importWyw() {
|
this.$nextTick(() => {
|
||||||
this.array = []
|
this.resetAllScroll()
|
||||||
this.arrays = []
|
|
||||||
this.arrays1 = [{
|
|
||||||
label: '全部监测设备',
|
|
||||||
value: ''
|
|
||||||
}]
|
|
||||||
this.$http.get('/applet/survStationInfo/list').then(res => {
|
|
||||||
const dataList = res.data.data || []
|
|
||||||
for (var i = 0; i < dataList.length; i++) {
|
|
||||||
this.arrays.push({
|
|
||||||
label: dataList[i].stationName,
|
|
||||||
value: dataList[i].stationCode
|
|
||||||
})
|
|
||||||
this.arrays1.push({
|
|
||||||
label: dataList[i].stationName,
|
|
||||||
value: dataList[i].stationCode
|
|
||||||
})
|
|
||||||
this.array.push(dataList[i].stationName)
|
|
||||||
}
|
|
||||||
// 设置默认第一个站点
|
|
||||||
if (this.array.length > 0) {
|
|
||||||
this.stationCode = this.arrays[0].value
|
|
||||||
// 调用趋势图获取数据
|
|
||||||
this.qushicov()
|
|
||||||
} else {
|
|
||||||
console.warn('没有获取到站点数据')
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.error('获取站点列表失败:', err)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取监测站点设备数据
|
methods: {
|
||||||
getazsurvMulchRecord() {
|
// 格式化数字
|
||||||
this.arrays = []
|
cutMoneyFiter(val) {
|
||||||
this.array1 = ['全部监测设备']
|
if (!val && val !== 0) return 0
|
||||||
this.arrays1 = [{
|
return val
|
||||||
|
},
|
||||||
|
|
||||||
|
// ===== 获取站点列表(趋势图专用) =====
|
||||||
|
getStationList() {
|
||||||
|
this.stationNameList = []
|
||||||
|
this.stationList = []
|
||||||
|
this.$http.get('/applet/survStationInfo/list').then(res => {
|
||||||
|
const data = res.data.data || []
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
this.stationList.push({
|
||||||
|
label: data[i].stationName,
|
||||||
|
value: data[i].stationCode // 站点编码
|
||||||
|
})
|
||||||
|
this.stationNameList.push(data[i].stationName)
|
||||||
|
}
|
||||||
|
// 站点数据加载完成后,获取趋势数据
|
||||||
|
if (this.stationList.length > 0) {
|
||||||
|
this.stationCode = this.stationList[0]?.value || ''
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.qushicov()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('获取站点列表失败', err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// ===== 获取设备列表(预警专用) =====
|
||||||
|
getDeviceList() {
|
||||||
|
this.deviceNameList = ['全部监测设备']
|
||||||
|
this.deviceList = [{
|
||||||
label: '全部监测设备',
|
label: '全部监测设备',
|
||||||
value: ''
|
value: ''
|
||||||
}]
|
}]
|
||||||
this.$http.get('/applet/survDeviceDeploy/survDeviceList').then(res => {
|
this.$http.get('/applet/survDeviceDeploy/survDeviceList').then(res => {
|
||||||
const dataList = res.data.data || []
|
const data = res.data.data || []
|
||||||
for (var i = 0; i < dataList.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
this.arrays.push({
|
this.deviceList.push({
|
||||||
label: dataList[i].fullDeviceName,
|
label: data[i].fullDeviceName,
|
||||||
value: dataList[i].id
|
value: data[i].id // 设备部署ID
|
||||||
})
|
})
|
||||||
this.arrays1.push({
|
this.deviceNameList.push(data[i].fullDeviceName)
|
||||||
label: dataList[i].fullDeviceName,
|
|
||||||
value: dataList[i].id
|
|
||||||
})
|
|
||||||
this.array1.push(dataList[i].fullDeviceName)
|
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('获取设备列表失败:', err)
|
console.log('获取设备列表失败', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取预警列表
|
|
||||||
|
// ===== 获取预警列表 =====
|
||||||
getyjList() {
|
getyjList() {
|
||||||
let params = {
|
let params = {}
|
||||||
pageNo: this.pageNo,
|
params.pageNo = this.pageNo
|
||||||
pageSize: this.pageSize,
|
params.pageSize = this.pageSize
|
||||||
deployId: this.stationCode1,
|
params.deployId = this.deployId // 使用设备部署ID
|
||||||
yearStr: this.yearStr
|
params.yearStr = this.yearStr
|
||||||
}
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
});
|
});
|
||||||
|
|
@ -309,7 +321,7 @@
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
var data = res.data.data.records || []
|
var data = res.data.data.records
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
data[i].times = data[i].alertTime.replace(" ", ":").replace(/\:/g, "-").split("-");
|
data[i].times = data[i].alertTime.replace(" ", ":").replace(/\:/g, "-").split("-");
|
||||||
data[i].nian = data[i].times[0];
|
data[i].nian = data[i].times[0];
|
||||||
|
|
@ -322,11 +334,18 @@
|
||||||
if (data[i].alertContent && data[i].alertContent.indexOf('监测数据名称:') != -1) {
|
if (data[i].alertContent && data[i].alertContent.indexOf('监测数据名称:') != -1) {
|
||||||
data[i].alertContent = data[i].alertContent.replace('监测数据名称:', '')
|
data[i].alertContent = data[i].alertContent.replace('监测数据名称:', '')
|
||||||
}
|
}
|
||||||
|
if (typeof data[i].alertContent === 'string') {
|
||||||
|
data[i].alertContent = [{
|
||||||
|
name: '告警',
|
||||||
|
val: data[i].alertContent,
|
||||||
|
unit: ''
|
||||||
|
}]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.list = this.list.concat(data)
|
this.list = this.list.concat(data)
|
||||||
this.total = res.data.data.total || 0
|
this.total = res.data.data.total
|
||||||
if (this.total != 0) {
|
if (res.data.data.total != 0) {
|
||||||
this.allNum = Number(this.total) / Number(this.pageSize) + '';
|
this.allNum = Number(res.data.data.total) / Number(this.pageSize) + '';
|
||||||
if (this.allNum.indexOf('.') == -1) {
|
if (this.allNum.indexOf('.') == -1) {
|
||||||
this.allNum = this.allNum;
|
this.allNum = this.allNum;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -348,10 +367,11 @@
|
||||||
this.isRefresher = false
|
this.isRefresher = false
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
console.error('获取预警列表失败:', err)
|
console.log('获取预警列表失败', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 分页加载
|
|
||||||
|
// ===== 分页加载 =====
|
||||||
lower() {
|
lower() {
|
||||||
if (this.isLastpage) {
|
if (this.isLastpage) {
|
||||||
return
|
return
|
||||||
|
|
@ -362,17 +382,16 @@
|
||||||
num = num + 1;
|
num = num + 1;
|
||||||
}, 1000)
|
}, 1000)
|
||||||
this.pageNo = this.pageNo + 1;
|
this.pageNo = this.pageNo + 1;
|
||||||
let params = {
|
let params = {}
|
||||||
pageNo: this.pageNo,
|
params.pageNo = this.pageNo
|
||||||
pageSize: this.pageSize,
|
params.pageSize = this.pageSize
|
||||||
deployId: this.stationCode1,
|
params.deployId = this.deployId // 使用设备部署ID
|
||||||
yearStr: this.yearStr
|
params.yearStr = this.yearStr
|
||||||
}
|
|
||||||
this.$http.get('/applet/wxclient/alertRecord', {
|
this.$http.get('/applet/wxclient/alertRecord', {
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
var data = res.data.data.records || []
|
var data = res.data.data.records
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
data[i].times = data[i].alertTime.replace(" ", ":").replace(/\:/g, "-").split("-");
|
data[i].times = data[i].alertTime.replace(" ", ":").replace(/\:/g, "-").split("-");
|
||||||
data[i].nian = data[i].times[0];
|
data[i].nian = data[i].times[0];
|
||||||
|
|
@ -385,9 +404,16 @@
|
||||||
if (data[i].alertContent && data[i].alertContent.indexOf('监测数据名称:') != -1) {
|
if (data[i].alertContent && data[i].alertContent.indexOf('监测数据名称:') != -1) {
|
||||||
data[i].alertContent = data[i].alertContent.replace('监测数据名称:', '')
|
data[i].alertContent = data[i].alertContent.replace('监测数据名称:', '')
|
||||||
}
|
}
|
||||||
|
if (typeof data[i].alertContent === 'string') {
|
||||||
|
data[i].alertContent = [{
|
||||||
|
name: '告警',
|
||||||
|
val: data[i].alertContent,
|
||||||
|
unit: ''
|
||||||
|
}]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.list = this.list.concat(data)
|
this.list = this.list.concat(data)
|
||||||
if (this.total != 0) {
|
if (res.data.data.total != 0) {
|
||||||
if (this.pageNo == this.allNum) {
|
if (this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus = 'nomore'
|
this.loadStatus = 'nomore'
|
||||||
|
|
@ -401,13 +427,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('加载更多失败:', err)
|
console.log('加载更多预警失败', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取评价
|
|
||||||
|
// ===== 获取评价 =====
|
||||||
getpj() {
|
getpj() {
|
||||||
this.$http.post('/applet/wxclient/displayInfo?infoType=' + 'effect_assess').then(res => {
|
this.$http.post('/applet/wxclient/displayInfo?infoType=' + 'effect_assess').then(res => {
|
||||||
let data = res.data.data.effect_assess.detailList || []
|
let data = res.data.data.effect_assess.detailList
|
||||||
this.pjlist = data
|
this.pjlist = data
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
if (data[i].detailCode == '综合评价') {
|
if (data[i].detailCode == '综合评价') {
|
||||||
|
|
@ -415,93 +442,235 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('获取评价数据失败:', err)
|
console.log('获取评价失败', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 选择年月日
|
|
||||||
|
// ===== 选择年月日 =====
|
||||||
radioChange(e) {
|
radioChange(e) {
|
||||||
this.riqinumber = e.detail.value
|
this.riqinumber = e.detail.value
|
||||||
this.current = this.timList.findIndex(item => item.value === e.detail.value)
|
this.timList.forEach((item, index) => {
|
||||||
// 重新调用趋势图
|
if (item.value === e.detail.value) {
|
||||||
|
this.current = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let currentDate = new Date()
|
||||||
|
let year = currentDate.getFullYear()
|
||||||
|
let month = String(currentDate.getMonth() + 1).padStart(2, '0')
|
||||||
|
let day = String(currentDate.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
|
if (this.riqinumber === 'yearMonth') {
|
||||||
|
this.dateqs = String(year)
|
||||||
|
} else if (this.riqinumber === 'monthDays') {
|
||||||
|
this.dateqs = year + '-' + month
|
||||||
|
} else {
|
||||||
|
this.dateqs = year + '-' + month + '-' + day
|
||||||
|
}
|
||||||
this.qushicov()
|
this.qushicov()
|
||||||
},
|
},
|
||||||
// 趋势时间切换
|
|
||||||
|
// ===== 趋势时间选择 =====
|
||||||
bindDateqsChange(e) {
|
bindDateqsChange(e) {
|
||||||
let selectedDate = e.detail.value;
|
let selectedDate = e.detail.value
|
||||||
// 根据选择的维度格式化日期
|
if (this.riqinumber === 'yearMonth') {
|
||||||
if (this.riqinumber === 'monthDays') {
|
this.dateqs = selectedDate.slice(0, 4)
|
||||||
this.dateqs = selectedDate.slice(0, 7); // YYYY-MM
|
} else if (this.riqinumber === 'monthDays') {
|
||||||
} else if (this.riqinumber === 'yearMonth') {
|
this.dateqs = selectedDate.slice(0, 7)
|
||||||
this.dateqs = selectedDate.slice(0, 4); // YYYY
|
|
||||||
} else {
|
} else {
|
||||||
this.dateqs = selectedDate; // YYYY-MM-DD
|
this.dateqs = selectedDate
|
||||||
}
|
}
|
||||||
// 重新获取趋势数据
|
this.qushicov()
|
||||||
this.qushicov();
|
|
||||||
},
|
},
|
||||||
// 趋势接口
|
|
||||||
|
// ===== 图表渲染完成回调 =====
|
||||||
|
onChartFinished() {
|
||||||
|
this.isChartRendered = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetAllScroll()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// ===== 重置所有滚动位置 =====
|
||||||
|
resetAllScroll() {
|
||||||
|
// 1. 重置页面滚动
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: 0,
|
||||||
|
duration: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
// 2. H5 环境下直接操作 DOM
|
||||||
|
// #ifdef H5
|
||||||
|
setTimeout(() => {
|
||||||
|
// 重置页面滚动
|
||||||
|
window.scrollTo(0, 0)
|
||||||
|
|
||||||
|
// 重置所有可滚动容器
|
||||||
|
const scrollableElements = document.querySelectorAll('.scroll-view, .qstcontent, .container, .qiun-data-charts')
|
||||||
|
scrollableElements.forEach(el => {
|
||||||
|
if (el.scrollTop !== undefined && el.scrollTop !== 0) {
|
||||||
|
el.scrollTop = 0
|
||||||
|
}
|
||||||
|
if (el.scrollLeft !== undefined && el.scrollLeft !== 0) {
|
||||||
|
el.scrollLeft = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 重置图表内部的 canvas 滚动
|
||||||
|
const chartContainer = document.querySelector('.qstcontent .qiun-data-charts')
|
||||||
|
if (chartContainer) {
|
||||||
|
chartContainer.scrollLeft = 0
|
||||||
|
chartContainer.scrollTop = 0
|
||||||
|
// 重置 canvas 父容器
|
||||||
|
const canvasWrapper = chartContainer.querySelector('.qiun-charts')
|
||||||
|
if (canvasWrapper) {
|
||||||
|
canvasWrapper.scrollLeft = 0
|
||||||
|
canvasWrapper.scrollTop = 0
|
||||||
|
}
|
||||||
|
// 重置 canvas 本身
|
||||||
|
const canvas = chartContainer.querySelector('canvas')
|
||||||
|
if (canvas && canvas.parentElement) {
|
||||||
|
canvas.parentElement.scrollLeft = 0
|
||||||
|
canvas.parentElement.scrollTop = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 150)
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 3. 小程序环境下使用 API
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
setTimeout(() => {
|
||||||
|
const query = uni.createSelectorQuery().in(this)
|
||||||
|
query.select('#chartContainer').boundingClientRect()
|
||||||
|
query.exec((res) => {
|
||||||
|
if (res && res[0]) {
|
||||||
|
// 尝试滚动到容器顶部
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: 0,
|
||||||
|
duration: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 150)
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
|
||||||
|
// ===== 趋势接口 =====
|
||||||
qushicov() {
|
qushicov() {
|
||||||
// 检查是否有站点编码
|
if (this.isLoadingTrend) return
|
||||||
|
|
||||||
|
// 确保有站点编码
|
||||||
if (!this.stationCode) {
|
if (!this.stationCode) {
|
||||||
console.warn('站点编码为空,无法获取趋势数据')
|
if (this.stationList.length > 0) {
|
||||||
|
this.stationCode = this.stationList[0].value
|
||||||
|
} else {
|
||||||
|
console.log('等待站点数据加载...')
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.stationList.length > 0) {
|
||||||
|
this.stationCode = this.stationList[0].value
|
||||||
|
this.qushicov()
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.dateqs) {
|
||||||
|
this.dateqs = new Date().getFullYear().toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isLoadingTrend = true
|
||||||
|
let data = {
|
||||||
|
summrayMode: this.riqinumber || 'yearMonth',
|
||||||
|
startTime: this.dateqs,
|
||||||
|
stationCode: this.stationCode, // 站点编码
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('请求趋势数据参数:', data)
|
||||||
|
|
||||||
|
// 清空数据
|
||||||
|
this.chartData = {
|
||||||
|
categories: [],
|
||||||
|
series: []
|
||||||
|
}
|
||||||
|
this.hasChartData = false
|
||||||
|
|
||||||
|
this.$http.post('/applet/survDeviceDeploy/waterIntegrateStatistic', data)
|
||||||
|
.then(iem => {
|
||||||
|
let lynum = iem.data.data
|
||||||
|
console.log('趋势数据返回:', lynum)
|
||||||
|
|
||||||
|
if (!lynum || !lynum.tableHead || !lynum.tableData2 || lynum.tableHead.length === 0) {
|
||||||
|
console.log('趋势数据为空')
|
||||||
|
this.chartData = {
|
||||||
|
categories: [],
|
||||||
|
series: []
|
||||||
|
}
|
||||||
|
this.hasChartData = false
|
||||||
|
this.chartKey = Date.now()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = {
|
this.processChartData(lynum)
|
||||||
summrayMode: this.riqinumber,
|
this.hasChartData = true
|
||||||
startTime: this.dateqs,
|
// 数据加载完成后更新 key,强制重新渲染图表
|
||||||
stationCode: this.stationCode,
|
this.chartKey = Date.now()
|
||||||
|
|
||||||
|
// 重置滚动
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetAllScroll()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log('趋势数据请求失败', err)
|
||||||
|
this.chartData = {
|
||||||
|
categories: [],
|
||||||
|
series: []
|
||||||
}
|
}
|
||||||
|
this.hasChartData = false
|
||||||
|
this.chartKey = Date.now()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isLoadingTrend = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
uni.showLoading({
|
// ===== 处理图表数据 =====
|
||||||
title: '加载趋势数据...'
|
processChartData(lynum) {
|
||||||
});
|
let categories = []
|
||||||
|
let displayCategories = []
|
||||||
this.$http.post('/applet/survDeviceDeploy/waterIntegrateStatistic', data).then(iem => {
|
let series = []
|
||||||
let lynum = iem.data.data
|
let allValues = []
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
let categories = [];
|
|
||||||
let displayCategories = [];
|
|
||||||
let series = [];
|
|
||||||
let allValues = [];
|
|
||||||
|
|
||||||
if (lynum.tableHead && lynum.tableHead.length > 0) {
|
|
||||||
categories = lynum.tableIndex || [];
|
|
||||||
|
|
||||||
|
categories = lynum.tableIndex || []
|
||||||
if (categories.length > 0) {
|
if (categories.length > 0) {
|
||||||
const first = categories[0];
|
const middle = Math.floor(categories.length / 2)
|
||||||
const middle = categories[Math.floor(categories.length / 2)];
|
|
||||||
const last = categories[categories.length - 1];
|
|
||||||
|
|
||||||
displayCategories = categories.map((item, index) => {
|
displayCategories = categories.map((item, index) => {
|
||||||
if (index === 0 || index === Math.floor(categories.length / 2) || index === categories.length - 1) {
|
if (index === 0 || index === middle || index === categories.length - 1) {
|
||||||
return item;
|
return item
|
||||||
}
|
}
|
||||||
return '';
|
return ''
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
lynum.tableHead.forEach((header, index) => {
|
lynum.tableHead.forEach((header, index) => {
|
||||||
const seriesData = lynum.tableData2.map(row => {
|
const seriesData = (lynum.tableData2 || []).map(row => {
|
||||||
const value = row[index] === "0" ? 0 : parseFloat(row[index]) || 0;
|
const value = row[index] === "0" ? 0 : parseFloat(row[index]) || 0
|
||||||
allValues.push(value);
|
allValues.push(value)
|
||||||
return value;
|
return value
|
||||||
});
|
})
|
||||||
|
|
||||||
series.push({
|
series.push({
|
||||||
name: header.eleDesc || header,
|
name: header.eleDesc || header.name || '指标',
|
||||||
data: seriesData
|
data: seriesData
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
// 动态计算Y轴范围
|
|
||||||
if (allValues.length > 0) {
|
if (allValues.length > 0) {
|
||||||
const maxValue = Math.max(...allValues);
|
const maxValue = Math.max(...allValues)
|
||||||
const minValue = Math.min(...allValues);
|
const minValue = Math.min(...allValues)
|
||||||
const padding = maxValue * 0.1;
|
const padding = (maxValue - minValue) * 0.1 || 10
|
||||||
const yAxisMax = maxValue + padding;
|
const yAxisMax = maxValue + padding
|
||||||
const yAxisMin = Math.max(0, minValue - padding);
|
const yAxisMin = Math.max(0, minValue - padding)
|
||||||
|
|
||||||
this.opts = {
|
this.opts = {
|
||||||
...this.opts,
|
...this.opts,
|
||||||
|
|
@ -511,73 +680,52 @@
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
min: yAxisMin,
|
min: yAxisMin,
|
||||||
max: yAxisMax
|
max: yAxisMax || 100
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = {
|
this.chartData = {
|
||||||
categories: displayCategories,
|
categories: displayCategories,
|
||||||
series: series
|
series: series
|
||||||
};
|
}
|
||||||
this.chartData = JSON.parse(JSON.stringify(res));
|
console.log('图表数据更新:', this.chartData)
|
||||||
uni.hideLoading();
|
|
||||||
}, 500);
|
|
||||||
}).catch(err => {
|
|
||||||
uni.hideLoading();
|
|
||||||
console.error('获取趋势数据失败:', err)
|
|
||||||
// 显示错误提示
|
|
||||||
uni.showToast({
|
|
||||||
title: '获取趋势数据失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 折线图切换站点
|
|
||||||
|
// ===== 折线图切换站点 =====
|
||||||
bindPickerChange: function(e) {
|
bindPickerChange: function(e) {
|
||||||
this.index = e.detail.value
|
this.index = e.detail.value
|
||||||
this.stationName = this.array[this.index]
|
if (this.stationList[this.index]) {
|
||||||
for (var i = 0; i < this.arrays.length; i++) {
|
this.stationCode = this.stationList[this.index].value
|
||||||
if (this.stationName == this.arrays[i].label) {
|
|
||||||
this.stationCode = this.arrays[i].value
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 切换站点后重新获取趋势数据
|
|
||||||
this.qushicov()
|
this.qushicov()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 预警切换站点
|
|
||||||
|
// ===== 预警切换设备 =====
|
||||||
bindPickerChange1: function(e) {
|
bindPickerChange1: function(e) {
|
||||||
this.index1 = e.detail.value
|
this.index1 = e.detail.value
|
||||||
this.stationName1 = this.array1[this.index1]
|
if (this.deviceList[this.index1]) {
|
||||||
for (var i = 0; i < this.arrays.length; i++) {
|
this.deployId = this.deviceList[this.index1].value // 设备部署ID
|
||||||
if (this.stationName1 == this.arrays1[i].label) {
|
|
||||||
this.stationCode1 = this.arrays1[i].value
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.stationName1 == '全部监测设备') {
|
|
||||||
this.stationCode1 = null
|
|
||||||
}
|
}
|
||||||
this.pageNo = 1
|
this.pageNo = 1
|
||||||
this.getyjList()
|
this.getyjList()
|
||||||
},
|
},
|
||||||
// 预警切换日期
|
|
||||||
|
// ===== 预警切换日期 =====
|
||||||
bindDateChange: function(e) {
|
bindDateChange: function(e) {
|
||||||
this.yearStr = e.detail.value
|
this.yearStr = e.detail.value
|
||||||
this.date = e.detail.value
|
this.date = e.detail.value
|
||||||
this.pageNo = 1
|
this.pageNo = 1
|
||||||
this.getyjList()
|
this.getyjList()
|
||||||
},
|
},
|
||||||
|
|
||||||
getDate(type) {
|
getDate(type) {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth() + 1;
|
let month = date.getMonth() + 1;
|
||||||
let day = date.getDate();
|
let day = date.getDate();
|
||||||
|
|
||||||
if (type === 'start') {
|
if (type === 'start') {
|
||||||
year = year - 10;
|
year = year - 10;
|
||||||
} else if (type === 'end') {
|
} else if (type === 'end') {
|
||||||
|
|
@ -586,11 +734,6 @@
|
||||||
month = month > 9 ? month : '0' + month;
|
month = month > 9 ? month : '0' + month;
|
||||||
day = day > 9 ? day : '0' + day;
|
day = day > 9 ? day : '0' + day;
|
||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`;
|
||||||
},
|
|
||||||
// 格式化数字(如果组件中有使用)
|
|
||||||
cutMoneyFiter(val) {
|
|
||||||
if (!val) return 0
|
|
||||||
return val
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -702,6 +845,8 @@
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
width: 98%;
|
width: 98%;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-ec-canvas {
|
.uni-ec-canvas {
|
||||||
|
|
@ -973,6 +1118,7 @@
|
||||||
.pagebot {
|
.pagebot {
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择年月日
|
// 选择年月日
|
||||||
.radio-group {
|
.radio-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -1031,4 +1177,36 @@
|
||||||
width: 44rpx;
|
width: 44rpx;
|
||||||
height: 44rpx;
|
height: 44rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 空状态样式
|
||||||
|
.empty-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: #f8f9fc;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
font-family: Source Han Sans SC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置图表滚动
|
||||||
|
.qstcontent {
|
||||||
|
.qiun-data-charts {
|
||||||
|
overflow: hidden !important;
|
||||||
|
|
||||||
|
.qiun-charts {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -178,7 +178,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -207,7 +206,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby3)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -217,17 +215,14 @@
|
||||||
},
|
},
|
||||||
// 选择养殖品种
|
// 选择养殖品种
|
||||||
change1(e){
|
change1(e){
|
||||||
console.log(e)
|
|
||||||
this.details.breedVariety = e.detail.value
|
this.details.breedVariety = e.detail.value
|
||||||
},
|
},
|
||||||
// 选择治污模式
|
// 选择治污模式
|
||||||
change2(e){
|
change2(e){
|
||||||
console.log(e)
|
|
||||||
this.details.controlMode = e.detail.value
|
this.details.controlMode = e.detail.value
|
||||||
},
|
},
|
||||||
// 选择利用模式
|
// 选择利用模式
|
||||||
change3(e){
|
change3(e){
|
||||||
console.log(e)
|
|
||||||
this.details.useMode = e.detail.value
|
this.details.useMode = e.detail.value
|
||||||
},
|
},
|
||||||
// 提交
|
// 提交
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -155,7 +154,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby3)
|
|
||||||
}
|
}
|
||||||
for(var i=0;i<this.hobby3.length;i++){
|
for(var i=0;i<this.hobby3.length;i++){
|
||||||
if(this.details.useMode){
|
if(this.details.useMode){
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -208,7 +207,6 @@
|
||||||
text:res.data.data[i].itemText,
|
text:res.data.data[i].itemText,
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
console.log(this.hobby3)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -218,17 +216,14 @@
|
||||||
},
|
},
|
||||||
// 选择养殖品种
|
// 选择养殖品种
|
||||||
change1(e){
|
change1(e){
|
||||||
console.log(e)
|
|
||||||
this.details.breedVariety = e.detail.value
|
this.details.breedVariety = e.detail.value
|
||||||
},
|
},
|
||||||
// 选择治污模式
|
// 选择治污模式
|
||||||
change2(e){
|
change2(e){
|
||||||
console.log(e)
|
|
||||||
this.details.controlMode = e.detail.value
|
this.details.controlMode = e.detail.value
|
||||||
},
|
},
|
||||||
// 选择利用模式
|
// 选择利用模式
|
||||||
change3(e){
|
change3(e){
|
||||||
console.log(e)
|
|
||||||
this.details.useMode = e.detail.value
|
this.details.useMode = e.detail.value
|
||||||
},
|
},
|
||||||
// 提交
|
// 提交
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height - 182
|
this.scorllheight = this.height - 182
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -142,14 +141,12 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height - 182
|
this.scorllheight = this.height - 182
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let pages = getCurrentPages();
|
let pages = getCurrentPages();
|
||||||
let currPage = pages[pages.length - 1]; //当前页面
|
let currPage = pages[pages.length - 1]; //当前页面
|
||||||
this.reload = currPage.data.reload
|
this.reload = currPage.data.reload
|
||||||
console.log(this.reload,'Ge')
|
|
||||||
if(this.reload){
|
if(this.reload){
|
||||||
this.farmName = ''
|
this.farmName = ''
|
||||||
this.breedVariety = ''
|
this.breedVariety = ''
|
||||||
|
|
@ -175,7 +172,6 @@
|
||||||
value:res.data.data[i].itemValue
|
value:res.data.data[i].itemValue
|
||||||
})
|
})
|
||||||
this.array.push(res.data.data[i].itemText)
|
this.array.push(res.data.data[i].itemText)
|
||||||
console.log(this.array)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -210,24 +206,18 @@
|
||||||
this.List = this.List.concat(data)
|
this.List = this.List.concat(data)
|
||||||
if(res.data.data.total != 0){
|
if(res.data.data.total != 0){
|
||||||
this.allNum = Number(res.data.data.total)/Number(this.pageSize)+'';
|
this.allNum = Number(res.data.data.total)/Number(this.pageSize)+'';
|
||||||
console.log(this.allNum,'总页数')
|
|
||||||
if(this.allNum.indexOf('.') == -1) {
|
if(this.allNum.indexOf('.') == -1) {
|
||||||
this.allNum = this.allNum;
|
this.allNum = this.allNum;
|
||||||
console.log(this.allNum,'if')
|
|
||||||
} else {
|
} else {
|
||||||
this.allNum = parseInt(Number(this.allNum)+1);
|
this.allNum = parseInt(Number(this.allNum)+1);
|
||||||
console.log(this.allNum,'else')
|
|
||||||
}
|
}
|
||||||
console.log(this.pageNo,this.allNum,'156156')
|
|
||||||
if(this.pageNo == this.allNum) {
|
if(this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus='nomore'
|
this.loadStatus='nomore'
|
||||||
console.log(this.isLastpage,'true','nomore')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
@ -240,7 +230,6 @@
|
||||||
},
|
},
|
||||||
// 分页加载
|
// 分页加载
|
||||||
lower() {
|
lower() {
|
||||||
console.log("最后一页了,取消下拉功能");
|
|
||||||
// 最后一页了,取消下拉功能
|
// 最后一页了,取消下拉功能
|
||||||
if (this.isLastpage) {
|
if (this.isLastpage) {
|
||||||
return
|
return
|
||||||
|
|
@ -250,7 +239,6 @@
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
num = num+1;
|
num = num+1;
|
||||||
},1000)
|
},1000)
|
||||||
console.log(this.intervalId,num)
|
|
||||||
this.pageNo = this.pageNo + 1;
|
this.pageNo = this.pageNo + 1;
|
||||||
let params = {}
|
let params = {}
|
||||||
params.pageNo = this.pageNo
|
params.pageNo = this.pageNo
|
||||||
|
|
@ -266,12 +254,10 @@
|
||||||
if(this.pageNo == this.allNum) {
|
if(this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus='nomore'
|
this.loadStatus='nomore'
|
||||||
console.log(this.isLastpage,'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage,'false')
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
@ -281,7 +267,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
bindPickerChange: function(e) {
|
bindPickerChange: function(e) {
|
||||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
||||||
this.index = e.detail.value
|
this.index = e.detail.value
|
||||||
this.breedVariety = this.arrays[this.index].value
|
this.breedVariety = this.arrays[this.index].value
|
||||||
this.breedVariety1 = this.arrays[this.index].text
|
this.breedVariety1 = this.arrays[this.index].text
|
||||||
|
|
@ -312,12 +297,10 @@
|
||||||
},
|
},
|
||||||
// 操作
|
// 操作
|
||||||
caozuo(item){
|
caozuo(item){
|
||||||
console.log(item)
|
|
||||||
var that = this
|
var that = this
|
||||||
uni.showActionSheet({
|
uni.showActionSheet({
|
||||||
itemList: ['编辑', '删除'],
|
itemList: ['编辑', '删除'],
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
|
||||||
if((res.tapIndex + 1) == 1){
|
if((res.tapIndex + 1) == 1){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/packDetail/pages/fwtz/edit?item='+ encodeURIComponent(JSON.stringify(item))
|
url:'/packDetail/pages/fwtz/edit?item='+ encodeURIComponent(JSON.stringify(item))
|
||||||
|
|
@ -328,8 +311,6 @@
|
||||||
content: '是否删除数据?',
|
content: '是否删除数据?',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
console.log('用户点击确定');
|
|
||||||
console.log(item.id,1)
|
|
||||||
that.$http.delete(that.deleteUrl+'?id='+item.id).then(res =>{
|
that.$http.delete(that.deleteUrl+'?id='+item.id).then(res =>{
|
||||||
if(res.data.code == 0){
|
if(res.data.code == 0){
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text class="botmTetx">Copyright <text style="font-size: 30rpx;padding:0rpx 7rpx;"> © </text> 汾西县农业农村局</text>
|
<!-- <text class="botmTetx">Copyright <text style="font-size: 30rpx;padding:0rpx 7rpx;"> © </text> 河津市现代农业发展中心</text> -->
|
||||||
<!-- <view class="loginpage">
|
<!-- <view class="loginpage">
|
||||||
<image class="bigimg" src="../../static/dls.jpg" mode=""></image>
|
<image class="bigimg" src="../../static/dls.jpg" mode=""></image>
|
||||||
<view class="padding text-center margin-top">
|
<view class="padding text-center margin-top">
|
||||||
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
thirdLoginInfo: "",
|
thirdLoginInfo: "",
|
||||||
thirdLoginState: false,
|
thirdLoginState: false,
|
||||||
bindingPhoneModal: false,
|
bindingPhoneModal: false,
|
||||||
login: false,
|
login: true,
|
||||||
thirdUserUuid: '',
|
thirdUserUuid: '',
|
||||||
url: {
|
url: {
|
||||||
bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone'
|
bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone'
|
||||||
|
|
@ -97,30 +97,28 @@ export default {
|
||||||
this.CustomTop = this.Custom.top
|
this.CustomTop = this.Custom.top
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
var that = this
|
// 检查是否已登录
|
||||||
uni.login({
|
const token = uni.getStorageSync('constant');
|
||||||
success: function (res) {
|
if (token) {
|
||||||
console.log(res.code)
|
// 已登录,直接跳转首页
|
||||||
that.code = res.code
|
|
||||||
let params = {}
|
|
||||||
params.jsCode = that.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);
|
|
||||||
console.log(that.login, '状态')
|
|
||||||
if (userInfo.id) {
|
|
||||||
that.login = false
|
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
});
|
||||||
} else if (!userInfo.id) {
|
return;
|
||||||
that.login = true
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
// 未登录才执行微信登录流程
|
||||||
|
var that = this;
|
||||||
|
uni.login({
|
||||||
|
success: function (res) {
|
||||||
|
that.code = res.code;
|
||||||
|
let params = {};
|
||||||
|
params.jsCode = that.code;
|
||||||
|
api.wxlogin(params).then(res => {
|
||||||
|
let userInfo = res.data.data;
|
||||||
|
uni.setStorageSync('third_session', userInfo.thirdSession);
|
||||||
|
// 注意:这里不要自动跳转,只存储 session
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -150,7 +148,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
TypeInput(e) {
|
TypeInput(e) {
|
||||||
console.log(e, 415)
|
|
||||||
// 只能输入数字的验证;
|
// 只能输入数字的验证;
|
||||||
const inputType = /[\W]/g //想限制什么类型在这里换换正则就可以了
|
const inputType = /[\W]/g //想限制什么类型在这里换换正则就可以了
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
|
|
@ -158,7 +155,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
tologins() {
|
tologins() {
|
||||||
console.log(this.userInfoLoginDTO.password, this.userInfoLoginDTO.userName, '密码用户')
|
|
||||||
if (!this.userInfoLoginDTO.userName) {
|
if (!this.userInfoLoginDTO.userName) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请输入账号',
|
title: '请输入账号',
|
||||||
|
|
@ -176,23 +172,21 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$http.post('/applet/userInfo/logins', this.userInfoLoginDTO).then(res => {
|
this.$http.post('/applet/userInfo/logins', this.userInfoLoginDTO).then(res => {
|
||||||
if (res.data.code == 0) {
|
api.loginCallback(res, ()=>{
|
||||||
uni.setStorageSync('constant', res.data.data)
|
uni.setStorageSync('constant', res.data.data)
|
||||||
uni.setStorageSync('password', this.userInfoLoginDTO.password)
|
uni.setStorageSync('password', this.userInfoLoginDTO.password)
|
||||||
uni.setStorageSync('userName', this.userInfoLoginDTO.userName)
|
uni.setStorageSync('userName', this.userInfoLoginDTO.userName)
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
} else {
|
}, ()=>{
|
||||||
uni.removeStorageSync('constant')
|
uni.removeStorageSync('constant')
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
// this.userInfoLoginDTO.password = ''
|
});
|
||||||
// this.userInfoLoginDTO.userName = ''
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -206,7 +200,7 @@ export default {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%);
|
transform: translate(-50%);
|
||||||
color: #999;
|
color: #999;
|
||||||
width: 52%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
.login-paddingtop {
|
.login-paddingtop {
|
||||||
padding-top: 100upx;
|
padding-top: 100upx;
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height - 120
|
this.scorllheight = this.height - 120
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -199,21 +198,17 @@
|
||||||
this.$set(item, 'checked', true)
|
this.$set(item, 'checked', true)
|
||||||
})
|
})
|
||||||
this.checkList = this.alllist
|
this.checkList = this.alllist
|
||||||
console.log(this.checkList,156)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
checkSelectItem(e, item) {
|
checkSelectItem(e, item) {
|
||||||
console.log(item,156)
|
|
||||||
// 如果是取消选中,就把checked置为false,如果是选中,就给添加一个checked=true
|
// 如果是取消选中,就把checked置为false,如果是选中,就给添加一个checked=true
|
||||||
if (item.checked == true) {
|
if (item.checked == true) {
|
||||||
this.$set(item, 'checked', false)
|
this.$set(item, 'checked', false)
|
||||||
this.checkList = this.checkList.filter(items => (items.value !== item.value))
|
this.checkList = this.checkList.filter(items => (items.value !== item.value))
|
||||||
console.log(this.checkList,'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.$set(item, 'checked', true)
|
this.$set(item, 'checked', true)
|
||||||
this.checkList.push(item)
|
this.checkList.push(item)
|
||||||
console.log(this.checkList,'false')
|
|
||||||
}
|
}
|
||||||
// 过滤出数组中checked为true的项目,如果和原alllist长度相等,就全选显示
|
// 过滤出数组中checked为true的项目,如果和原alllist长度相等,就全选显示
|
||||||
let newArr = this.alllist.filter(item => (item.checked == true))
|
let newArr = this.alllist.filter(item => (item.checked == true))
|
||||||
|
|
@ -222,7 +217,6 @@
|
||||||
} else {
|
} else {
|
||||||
this.checkTrue = false;
|
this.checkTrue = false;
|
||||||
}
|
}
|
||||||
console.log(this.checkList,41561456)
|
|
||||||
},
|
},
|
||||||
submit(){
|
submit(){
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 顶部选项卡 -->
|
<!-- 顶部选项卡 -->
|
||||||
<view class="topScroll">
|
<!-- <view class="topScroll">
|
||||||
<scroll-view scroll-x="true" class="scroll">
|
<scroll-view scroll-x="true" class="scroll">
|
||||||
<view class="scroll-item" v-for="(item,index) in topItems" :key="index" @click="chooseClick(item,index)"
|
<view class="scroll-item" v-for="(item,index) in topItems" :key="index" @click="chooseClick(item,index)"
|
||||||
:class="{'scroll-item2':isActive == index}">
|
:class="{'scroll-item2':isActive == index}">
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<!-- 监测站告警 -->
|
<!-- 监测站告警 -->
|
||||||
<block v-if="isActive == 0">
|
<block v-if="isActive == 0">
|
||||||
|
|
@ -135,12 +135,13 @@
|
||||||
arrays: [],
|
arrays: [],
|
||||||
isRefresher: false, //下拉刷新状态
|
isRefresher: false, //下拉刷新状态
|
||||||
reload: '',
|
reload: '',
|
||||||
topItems: [{
|
topItems: [
|
||||||
dictLabel: '监测站告警'
|
// {
|
||||||
},
|
// dictLabel: '监测站告警'
|
||||||
{
|
// },
|
||||||
dictLabel: '异常趋势图'
|
// {
|
||||||
}
|
// dictLabel: '异常趋势图'
|
||||||
|
// }
|
||||||
],
|
],
|
||||||
value: 0,
|
value: 0,
|
||||||
rangeList: [],
|
rangeList: [],
|
||||||
|
|
@ -938,8 +939,8 @@
|
||||||
.zwsj {
|
.zwsj {
|
||||||
height: calc(100vh - 100rpx);
|
height: calc(100vh - 100rpx);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
// align-items: center;
|
||||||
justify-content: center;
|
// justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inzwsj {
|
.inzwsj {
|
||||||
|
|
@ -947,8 +948,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.zwsjimg {
|
.zwsjimg {
|
||||||
width: 200rpx;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 240rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zwsjtext {
|
.zwsjtext {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
this.contentheight = this.height - ktxStatusHeight - navigationHeight - 150
|
this.contentheight = this.height - ktxStatusHeight - navigationHeight - 150
|
||||||
console.log(this.contentheight,123132)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -105,7 +104,6 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
radioChange(value){
|
radioChange(value){
|
||||||
console.log(value)
|
|
||||||
this.constant.sex = value.detail.value
|
this.constant.sex = value.detail.value
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<uni-nav-bar :fixed="true" left-icon="left" background-color="#0F6EFF" @clickLeft="back()" status-bar :title="item.stationName"/>
|
<uni-nav-bar :fixed="true" left-icon="left" background-color="#0F6EFF" @clickLeft="back()" status-bar :title="item.deployDes"/>
|
||||||
<view class="liebiaos">
|
<view class="liebiaos">
|
||||||
<view class="list_item">
|
<view class="list_item">
|
||||||
<view class="list_item_top">
|
<view class="list_item_top">
|
||||||
|
|
@ -128,7 +128,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log(JSON.parse(decodeURIComponent(options.item)))
|
|
||||||
this.item = JSON.parse(decodeURIComponent(options.item));
|
this.item = JSON.parse(decodeURIComponent(options.item));
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -97,15 +96,14 @@
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
});
|
});
|
||||||
|
|
||||||
// 使用 Promise.all 同时发起两个请求
|
// 只请求第一个接口
|
||||||
Promise.all([
|
this.$http.get('/applet/survStationInfo/deviceList')
|
||||||
this.$http.get('/applet/survStationInfo/deviceList'),
|
.then(res => {
|
||||||
this.$http.get('/applet/survStationInfo/fdeviceList')
|
const data1 = res?.data?.data || [];
|
||||||
]).then(([res1, res2]) => {
|
this.list = data1;
|
||||||
// 合并两个数组
|
|
||||||
this.list = res1.data.data.concat(res2.data.data);
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}).catch(error => {
|
})
|
||||||
|
.catch(error => {
|
||||||
console.error('请求失败:', error);
|
console.error('请求失败:', error);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<image v-if="it[0].stationType == 'livestock'" src="../../static/zhandian_icon_xuqin.png" mode=""></image>
|
<image v-if="it[0].stationType == 'livestock'" src="../../static/zhandian_icon_xuqin.png" mode=""></image>
|
||||||
<view class="item_right">
|
<view class="item_right">
|
||||||
<view class="right_top">
|
<view class="right_top">
|
||||||
{{it[0].stationName}}
|
{{it[0].stationName?it[0].stationName:'无设备信息'}}
|
||||||
</view>
|
</view>
|
||||||
<view class="right_bot">
|
<view class="right_bot">
|
||||||
<image src="../../static/shebei_icon_shebei.png" mode=""></image>
|
<image src="../../static/shebei_icon_shebei.png" mode=""></image>
|
||||||
|
|
@ -84,7 +84,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -101,7 +100,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
todetail(item,index){
|
todetail(item,index){
|
||||||
console.log(item,12)
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/packDetail/pages/vidio/detail?item=' + encodeURIComponent(JSON.stringify(item))
|
url:'/packDetail/pages/vidio/detail?item=' + encodeURIComponent(JSON.stringify(item))
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
|
|
@ -23,7 +23,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<text class="botmTetx">Copyright <text style="font-size: 30rpx;padding:0rpx 7rpx;"> © </text> 汾西县农业农村局</text>
|
<!-- <text class="botmTetx">Copyright <text style="font-size: 30rpx;padding:0rpx 7rpx;"> © </text> 河津市现代农业发展中心</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -112,6 +112,6 @@
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%);
|
transform: translate(-50%);
|
||||||
color: #999;
|
color: #999;
|
||||||
width: 52%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bot_box">
|
<view class="bot_box" :class="{'single-item': item.depUrlArr && item.depUrlArr.length === 1}">
|
||||||
<view class="bot_left" v-for="(it,i) in item.depUrlArr" :key="i" @click="todetail(it,i,item)">
|
<view class="bot_left" v-for="(it,i) in item.depUrlArr" :key="i" @click="todetail(it,i,item)">
|
||||||
<view class="botleft_bot">
|
<view class="botleft_bot">
|
||||||
<view class="">
|
<view class="">
|
||||||
|
|
@ -71,7 +71,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale //将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale //将px 转换rpx
|
||||||
console.log(this.height, ktxStatusHeight, navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -85,7 +84,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale //将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale //将px 转换rpx
|
||||||
console.log(this.height, ktxStatusHeight, navigationHeight)
|
|
||||||
this.scorllheight = this.height
|
this.scorllheight = this.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -112,24 +110,18 @@
|
||||||
this.List = this.List.concat(data)
|
this.List = this.List.concat(data)
|
||||||
if (data.length != 0) {
|
if (data.length != 0) {
|
||||||
this.allNum = Number(data.length) / Number(this.pageSize) + '';
|
this.allNum = Number(data.length) / Number(this.pageSize) + '';
|
||||||
console.log(this.allNum, '总页数')
|
|
||||||
if (this.allNum.indexOf('.') == -1) {
|
if (this.allNum.indexOf('.') == -1) {
|
||||||
this.allNum = this.allNum;
|
this.allNum = this.allNum;
|
||||||
console.log(this.allNum, 'if')
|
|
||||||
} else {
|
} else {
|
||||||
this.allNum = parseInt(Number(this.allNum) + 1);
|
this.allNum = parseInt(Number(this.allNum) + 1);
|
||||||
console.log(this.allNum, 'else')
|
|
||||||
}
|
}
|
||||||
console.log(this.pageNo, this.allNum, '156156')
|
|
||||||
if (this.pageNo == this.allNum) {
|
if (this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus = 'nomore'
|
this.loadStatus = 'nomore'
|
||||||
console.log(this.isLastpage, 'true', 'nomore')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage, 'false')
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
@ -141,7 +133,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
lower() {
|
lower() {
|
||||||
console.log("最后一页了,取消下拉功能");
|
|
||||||
// 最后一页了,取消下拉功能
|
// 最后一页了,取消下拉功能
|
||||||
if (this.isLastpage) {
|
if (this.isLastpage) {
|
||||||
return
|
return
|
||||||
|
|
@ -151,7 +142,6 @@
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
num = num + 1;
|
num = num + 1;
|
||||||
}, 1000)
|
}, 1000)
|
||||||
console.log(this.intervalId, num)
|
|
||||||
this.pageNo = this.pageNo + 1;
|
this.pageNo = this.pageNo + 1;
|
||||||
let params = {}
|
let params = {}
|
||||||
params.pageNo = this.pageNo
|
params.pageNo = this.pageNo
|
||||||
|
|
@ -166,12 +156,10 @@
|
||||||
if (this.pageNo == this.allNum) {
|
if (this.pageNo == this.allNum) {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
this.loadStatus = 'nomore'
|
this.loadStatus = 'nomore'
|
||||||
console.log(this.isLastpage, 'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = false;
|
this.isLastpage = false;
|
||||||
// this.isLoadMore=true
|
// this.isLoadMore=true
|
||||||
this.loadStatus = 'more'
|
this.loadStatus = 'more'
|
||||||
console.log(this.isLastpage, 'false')
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isLastpage = true;
|
this.isLastpage = true;
|
||||||
|
|
@ -234,6 +222,7 @@
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
padding: 20rpx 0;
|
padding: 20rpx 0;
|
||||||
color: #8b95ea;
|
color: #8b95ea;
|
||||||
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top_box {
|
.top_box {
|
||||||
|
|
@ -253,6 +242,21 @@
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 当只有一个子元素时的样式优化 */
|
||||||
|
.bot_box.single-item {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bot_box.single-item .bot_left {
|
||||||
|
width: 100%;
|
||||||
|
height: 370rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bot_box.single-item .bot_left .botleft_top {
|
||||||
|
width: 100%;
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.bot_left {
|
.bot_left {
|
||||||
width: 48%;
|
width: 48%;
|
||||||
border: 4rpx solid #f0f0f0;
|
border: 4rpx solid #f0f0f0;
|
||||||
|
|
|
||||||
|
|
@ -2326,7 +2326,6 @@
|
||||||
uni.sendSocketMessage({
|
uni.sendSocketMessage({
|
||||||
data: JSON.stringify(param)
|
data: JSON.stringify(param)
|
||||||
});
|
});
|
||||||
console.log('websocket发送给服务端的消息:', param);
|
|
||||||
socketTask.close({
|
socketTask.close({
|
||||||
code: 1000,
|
code: 1000,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|
@ -2337,7 +2336,6 @@
|
||||||
|
|
||||||
// push
|
// push
|
||||||
pusherStateChange: function (e) {
|
pusherStateChange: function (e) {
|
||||||
console.log('>>> live-pusher onPushStateChange:', e.detail.code);
|
|
||||||
const code = e.detail.code;
|
const code = e.detail.code;
|
||||||
let content = '';
|
let content = '';
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
@ -2440,13 +2438,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
stopPush() {
|
stopPush() {
|
||||||
console.log('停止推流');
|
|
||||||
this.pushVideoContext.stop();
|
this.pushVideoContext.stop();
|
||||||
this.pushVideo=false
|
this.pushVideo=false
|
||||||
},
|
},
|
||||||
|
|
||||||
startPush() {
|
startPush() {
|
||||||
console.log('开始推流,推流地址为:', this.pushUrl);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '开始推流,推流地址为:'
|
title: '开始推流,推流地址为:'
|
||||||
});
|
});
|
||||||
|
|
@ -2458,7 +2454,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
error(e) {
|
error(e) {
|
||||||
console.log('live-player', e);
|
|
||||||
console.error('live-player error:', e.detail.errMsg);
|
console.error('live-player error:', e.detail.errMsg);
|
||||||
if (e.detail.errCode == 10001) {
|
if (e.detail.errCode == 10001) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,13 @@
|
||||||
var player = null;
|
var player = null;
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
console.log(1111111111111111111111)
|
|
||||||
// this.initPlayer()
|
// this.initPlayer()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('mounted...');
|
|
||||||
|
|
||||||
if (typeof window.EZUIKit !== 'undefined') {
|
if (typeof window.EZUIKit !== 'undefined') {
|
||||||
|
|
||||||
console.log('defined EZUIKit...');
|
|
||||||
this.initPlayer();
|
this.initPlayer();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
console.log('undefined EZUIKit...');
|
|
||||||
// 动态引入较大类库避免影响页面展示
|
// 动态引入较大类库避免影响页面展示
|
||||||
const script = document.createElement('script')
|
const script = document.createElement('script')
|
||||||
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
|
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
|
||||||
|
|
@ -62,7 +56,6 @@
|
||||||
windowWidth,
|
windowWidth,
|
||||||
windowHeight
|
windowHeight
|
||||||
} = uni.getSystemInfoSync();
|
} = uni.getSystemInfoSync();
|
||||||
console.log('initPlayer...');
|
|
||||||
return
|
return
|
||||||
fetch('https://zy.sxzooh.com/zh-api/applet/ysyun/getYsToken')
|
fetch('https://zy.sxzooh.com/zh-api/applet/ysyun/getYsToken')
|
||||||
// .then(response => response.json())
|
// .then(response => response.json())
|
||||||
|
|
|
||||||
|
|
@ -226,10 +226,8 @@ export default {
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
livePlayerContext = uni.createLivePlayerContext('livePlayer');
|
livePlayerContext = uni.createLivePlayerContext('livePlayer');
|
||||||
console.log('获取参数', options);
|
|
||||||
// 获取当前页面栈
|
// 获取当前页面栈
|
||||||
const currentPage = getCurrentPages();
|
const currentPage = getCurrentPages();
|
||||||
console.log(currentPage.nv_length);
|
|
||||||
|
|
||||||
// 获取url携带的参数
|
// 获取url携带的参数
|
||||||
const { accessToken, deviceSerial, channelNo, date, switch1Checked } = options;
|
const { accessToken, deviceSerial, channelNo, date, switch1Checked } = options;
|
||||||
|
|
@ -238,7 +236,6 @@ export default {
|
||||||
this.deviceSerial=deviceSerial,
|
this.deviceSerial=deviceSerial,
|
||||||
this.channelNo=channelNo,
|
this.channelNo=channelNo,
|
||||||
this.page=currentPage.nv_length
|
this.page=currentPage.nv_length
|
||||||
console.log(date);
|
|
||||||
// 通过分享今日指定日期
|
// 通过分享今日指定日期
|
||||||
if (date) {
|
if (date) {
|
||||||
this.date=date,
|
this.date=date,
|
||||||
|
|
@ -261,10 +258,8 @@ export default {
|
||||||
*/
|
*/
|
||||||
onShareAppMessage: function (res) {
|
onShareAppMessage: function (res) {
|
||||||
const { accessToken, deviceSerial, channelNo, date, switch1Checked } = this;
|
const { accessToken, deviceSerial, channelNo, date, switch1Checked } = this;
|
||||||
console.log(switch1Checked);
|
|
||||||
if (res.from === 'button') {
|
if (res.from === 'button') {
|
||||||
// 来自页面内转发按钮
|
// 来自页面内转发按钮
|
||||||
console.log(res.target);
|
|
||||||
this.panelStatus=0
|
this.panelStatus=0
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
@ -298,7 +293,6 @@ export default {
|
||||||
|
|
||||||
// 获取存储类型
|
// 获取存储类型
|
||||||
switch1Change: function (e) {
|
switch1Change: function (e) {
|
||||||
console.log('当前存储类型', e.detail);
|
|
||||||
if (e.detail.value == false) {
|
if (e.detail.value == false) {
|
||||||
this.switchText='云存储',
|
this.switchText='云存储',
|
||||||
this.switch1Checked=false,
|
this.switch1Checked=false,
|
||||||
|
|
@ -327,10 +321,8 @@ export default {
|
||||||
// 获取当前操作系统类型
|
// 获取当前操作系统类型
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('当前操作系统:', res.system);
|
|
||||||
const sys = res.system;
|
const sys = res.system;
|
||||||
type = sys.split(' ');
|
type = sys.split(' ');
|
||||||
console.log(type);
|
|
||||||
if (type[0] == 'iOS') {
|
if (type[0] == 'iOS') {
|
||||||
that.toDay=date.replace(/\-/g, '/')
|
that.toDay=date.replace(/\-/g, '/')
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -351,7 +343,6 @@ export default {
|
||||||
// 获取时间轴
|
// 获取时间轴
|
||||||
getTimeLine: function () {
|
getTimeLine: function () {
|
||||||
const { recType, date, accessToken, deviceSerial, channelNo, timelineTimer, currentTimer } = this;
|
const { recType, date, accessToken, deviceSerial, channelNo, timelineTimer, currentTimer } = this;
|
||||||
console.log('获取到的accessToken, accessToken', accessToken);
|
|
||||||
var that = this;
|
var that = this;
|
||||||
let currentDate = null;
|
let currentDate = null;
|
||||||
let timestampCurrent = null;
|
let timestampCurrent = null;
|
||||||
|
|
@ -381,7 +372,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('获取播放时间片段', res.data);
|
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
if (res.data.data != null) {
|
if (res.data.data != null) {
|
||||||
var result = res.data.data;
|
var result = res.data.data;
|
||||||
|
|
@ -408,7 +398,6 @@ export default {
|
||||||
et: et
|
et: et
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log('availArr:', availArr);
|
|
||||||
this.dateLine=availArr
|
this.dateLine=availArr
|
||||||
} else {
|
} else {
|
||||||
this.dialogNodataTitle='暂无数据',
|
this.dialogNodataTitle='暂无数据',
|
||||||
|
|
@ -447,7 +436,6 @@ export default {
|
||||||
let stTime = e.detail.stTime;
|
let stTime = e.detail.stTime;
|
||||||
let etTime = e.detail.etTime;
|
let etTime = e.detail.etTime;
|
||||||
const { type, date, accessToken, deviceSerial, channelNo, videoSrc } = this;
|
const { type, date, accessToken, deviceSerial, channelNo, videoSrc } = this;
|
||||||
console.log('当前播放时间', stTime, etTime);
|
|
||||||
let startTime = null;
|
let startTime = null;
|
||||||
let stopTime = null;
|
let stopTime = null;
|
||||||
startTime = date + ' ' + stTime;
|
startTime = date + ' ' + stTime;
|
||||||
|
|
@ -481,7 +469,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('获取到的播放地址:', res.data);
|
|
||||||
if (res.data.code == '200' && res.data.data && res.data.data.url) {
|
if (res.data.code == '200' && res.data.data && res.data.data.url) {
|
||||||
const playUrl = res.data.data.url;
|
const playUrl = res.data.data.url;
|
||||||
this.videoSrc=playUrl
|
this.videoSrc=playUrl
|
||||||
|
|
@ -489,7 +476,6 @@ export default {
|
||||||
this.handleStop();
|
this.handleStop();
|
||||||
// 开始播放
|
// 开始播放
|
||||||
this.handlePlay();
|
this.handlePlay();
|
||||||
console.log('当前播放地址:', this.videoSrc);
|
|
||||||
} else if (res.data.code == '20007') {
|
} else if (res.data.code == '20007') {
|
||||||
debugger;
|
debugger;
|
||||||
this.dialogTitle='获取播放地址失败',
|
this.dialogTitle='获取播放地址失败',
|
||||||
|
|
@ -519,7 +505,6 @@ export default {
|
||||||
this.dialogTitle='获取播放地址失败',
|
this.dialogTitle='获取播放地址失败',
|
||||||
this.dialogContent=res.data.msg,
|
this.dialogContent=res.data.msg,
|
||||||
this.dialogShow=true
|
this.dialogShow=true
|
||||||
console.log('获取rtmp播放地址失败');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -549,7 +534,6 @@ export default {
|
||||||
_this.fullScreen=true
|
_this.fullScreen=true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('开启全屏');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unfullScreen() {
|
unfullScreen() {
|
||||||
|
|
@ -559,7 +543,6 @@ export default {
|
||||||
_this.fullScreen=false
|
_this.fullScreen=false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('开启全屏');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ToggleObjectFit() {
|
ToggleObjectFit() {
|
||||||
|
|
@ -576,7 +559,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePlay(callback) {
|
handlePlay(callback) {
|
||||||
console.log('handelPlay', this.playVideo, this.isHD);
|
|
||||||
this.checkNetWork();
|
this.checkNetWork();
|
||||||
livePlayerContext.play({
|
livePlayerContext.play({
|
||||||
success: () => {
|
success: () => {
|
||||||
|
|
@ -594,7 +576,6 @@ export default {
|
||||||
title: '网络异常',
|
title: '网络异常',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
console.log('开始播放失败');
|
|
||||||
this.videoNetWorkError=true
|
this.videoNetWorkError=true
|
||||||
this.showVideoControls=false
|
this.showVideoControls=false
|
||||||
this.videoLoadingStatus=100
|
this.videoLoadingStatus=100
|
||||||
|
|
@ -603,7 +584,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
handleStop(callback) {
|
handleStop(callback) {
|
||||||
console.log('stop');
|
|
||||||
const { list } = this;
|
const { list } = this;
|
||||||
livePlayerContext.stop({
|
livePlayerContext.stop({
|
||||||
success: () => {
|
success: () => {
|
||||||
|
|
@ -622,7 +602,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
autoHideControl() {
|
autoHideControl() {
|
||||||
console.log('showHdSelect', this.showHDSelect);
|
|
||||||
const _this = this;
|
const _this = this;
|
||||||
clearTimeout(this.autoHideTimer);
|
clearTimeout(this.autoHideTimer);
|
||||||
this.autoHideTimer = setTimeout(() => {
|
this.autoHideTimer = setTimeout(() => {
|
||||||
|
|
@ -640,7 +619,6 @@ export default {
|
||||||
|
|
||||||
handleHD(e) {
|
handleHD(e) {
|
||||||
var showHDSelect = this.showHDSelect;
|
var showHDSelect = this.showHDSelect;
|
||||||
console.log('handleHD', showHDSelect);
|
|
||||||
this.showHDSelect=!showHDSelect
|
this.showHDSelect=!showHDSelect
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -658,7 +636,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
statechange(e) {
|
statechange(e) {
|
||||||
console.log('live-player code:', e.detail.code, e.detail);
|
|
||||||
const { code } = e.detail;
|
const { code } = e.detail;
|
||||||
let { videoLoadingStatus, list, panelStatus } = this;
|
let { videoLoadingStatus, list, panelStatus } = this;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
@ -726,7 +703,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
error(e) {
|
error(e) {
|
||||||
console.log('live-player', e);
|
|
||||||
console.error('live-player error:', e.detail.errMsg);
|
console.error('live-player error:', e.detail.errMsg);
|
||||||
if (e.detail.errCode == 10001) {
|
if (e.detail.errCode == 10001) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -738,7 +714,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
onVideoTap(e) {
|
onVideoTap(e) {
|
||||||
console.log('点击视频');
|
|
||||||
const { deviceOffline, showVideoControls, panelStatus, videoNetWorkError } = this;
|
const { deviceOffline, showVideoControls, panelStatus, videoNetWorkError } = this;
|
||||||
if (deviceOffline || panelStatus === 4 || videoNetWorkError) {
|
if (deviceOffline || panelStatus === 4 || videoNetWorkError) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -755,10 +730,8 @@ export default {
|
||||||
screenShoot(e) {
|
screenShoot(e) {
|
||||||
const { playVideo, videoLoadingStatus } = this;
|
const { playVideo, videoLoadingStatus } = this;
|
||||||
if (!playVideo || videoLoadingStatus != 100) {
|
if (!playVideo || videoLoadingStatus != 100) {
|
||||||
console.log('非播放状态下点击截图');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log('开始截图');
|
|
||||||
// livePlayerContext.snapshot('raw');
|
// livePlayerContext.snapshot('raw');
|
||||||
let that = this;
|
let that = this;
|
||||||
uni.getSetting({
|
uni.getSetting({
|
||||||
|
|
@ -786,13 +759,10 @@ export default {
|
||||||
livePlayerContext
|
livePlayerContext
|
||||||
.snapshot('raw')
|
.snapshot('raw')
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log('data', data);
|
|
||||||
if (data) {
|
if (data) {
|
||||||
console.log(data);
|
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: data.tempImagePath,
|
filePath: data.tempImagePath,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('保存成功', res);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '截图已保存至手机相册',
|
title: '截图已保存至手机相册',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|
@ -850,7 +820,6 @@ export default {
|
||||||
|
|
||||||
// 时间选择器
|
// 时间选择器
|
||||||
bindDateChange: function (e) {
|
bindDateChange: function (e) {
|
||||||
console.log('picker发送选择改变,携带值为', e.detail.value);
|
|
||||||
this.date=e.detail.value
|
this.date=e.detail.value
|
||||||
this.getTimeLine();
|
this.getTimeLine();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,6 @@
|
||||||
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
|
||||||
var navigationHeight = 44 * pxToRpxScale
|
var navigationHeight = 44 * pxToRpxScale
|
||||||
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
|
||||||
console.log(this.height,ktxStatusHeight,navigationHeight)
|
|
||||||
this.scorllheight = this.height - 120
|
this.scorllheight = this.height - 120
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -199,21 +198,17 @@
|
||||||
this.$set(item, 'checked', true)
|
this.$set(item, 'checked', true)
|
||||||
})
|
})
|
||||||
this.checkList = this.alllist
|
this.checkList = this.alllist
|
||||||
console.log(this.checkList,156)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
checkSelectItem(e, item) {
|
checkSelectItem(e, item) {
|
||||||
console.log(item,156)
|
|
||||||
// 如果是取消选中,就把checked置为false,如果是选中,就给添加一个checked=true
|
// 如果是取消选中,就把checked置为false,如果是选中,就给添加一个checked=true
|
||||||
if (item.checked == true) {
|
if (item.checked == true) {
|
||||||
this.$set(item, 'checked', false)
|
this.$set(item, 'checked', false)
|
||||||
this.checkList = this.checkList.filter(items => (items.value !== item.value))
|
this.checkList = this.checkList.filter(items => (items.value !== item.value))
|
||||||
console.log(this.checkList,'true')
|
|
||||||
} else {
|
} else {
|
||||||
this.$set(item, 'checked', true)
|
this.$set(item, 'checked', true)
|
||||||
this.checkList.push(item)
|
this.checkList.push(item)
|
||||||
console.log(this.checkList,'false')
|
|
||||||
}
|
}
|
||||||
// 过滤出数组中checked为true的项目,如果和原alllist长度相等,就全选显示
|
// 过滤出数组中checked为true的项目,如果和原alllist长度相等,就全选显示
|
||||||
let newArr = this.alllist.filter(item => (item.checked == true))
|
let newArr = this.alllist.filter(item => (item.checked == true))
|
||||||
|
|
@ -222,7 +217,6 @@
|
||||||
} else {
|
} else {
|
||||||
this.checkTrue = false;
|
this.checkTrue = false;
|
||||||
}
|
}
|
||||||
console.log(this.checkList,41561456)
|
|
||||||
},
|
},
|
||||||
submit(){
|
submit(){
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
|
||||||
14
pages.json
14
pages.json
|
|
@ -4,7 +4,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "汾西小流域面源污染监测",
|
"navigationBarTitleText": "农业面源污染监测系统",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/operations/index",
|
"path": "pages/operations/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "站点运维",
|
"navigationBarTitleText": "运维记录",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/operations/detail",
|
"path": "pages/operations/detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "站点运维详情",
|
"navigationBarTitleText": "运维记录详情",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/operations/add",
|
"path": "pages/operations/add",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新增站点运维",
|
"navigationBarTitleText": "新增运维记录",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/operations/edit",
|
"path": "pages/operations/edit",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "编辑站点运维",
|
"navigationBarTitleText": "编辑运维记录",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +196,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/analysis/index",
|
"path": "pages/analysis/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "统计分析",
|
"navigationBarTitleText": "监测数据统计分析",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@
|
||||||
{
|
{
|
||||||
"path": "pages/sjdyj/index",
|
"path": "pages/sjdyj/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "预警信息",
|
"navigationBarTitleText": "智能预警",
|
||||||
"navigationStyle": "default",
|
"navigationStyle": "default",
|
||||||
"navigationBarBackgroundColor":"#0F6EFF"
|
"navigationBarBackgroundColor":"#0F6EFF"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,449 @@
|
||||||
|
const indexData = {
|
||||||
|
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
|
||||||
|
}],
|
||||||
|
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": "默认"
|
||||||
|
}],
|
||||||
|
|
||||||
|
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": "小流域监测站1#站",
|
||||||
|
"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": "小流域监测站1#站",
|
||||||
|
"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": "小流域监测站1#站",
|
||||||
|
"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
|
||||||
|
}],
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
name: '监测站点',
|
||||||
|
img: require('../../static/home_icon_jiance.png'),
|
||||||
|
path: '/packDetail/pages/Site/index'
|
||||||
|
}, {
|
||||||
|
name: '智能预警',
|
||||||
|
img: require('../../static/scd.png'),
|
||||||
|
path: '/packDetail/pages/sjdyj/index'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '视频监控',
|
||||||
|
img: require('../../static/home_icon_shipin.png'),
|
||||||
|
path: '/packDetail1/pages/device/index'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '运维记录',
|
||||||
|
img: require('../../static/home_icon_yunwei.png'),
|
||||||
|
path: '/packDetail/pages/operations/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'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '设备管理',
|
||||||
|
img: require('../../static/home_icon_shebei.png'),
|
||||||
|
path: '/packDetail/pages/vidio/index'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '统计分析',
|
||||||
|
img: require('../../static/home_icon_shuju.png'),
|
||||||
|
path: '/packDetail/pages/analysis/index'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default indexData;
|
||||||
|
|
@ -1,108 +0,0 @@
|
||||||
import { getApi } from "@/utils/common.js"
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
latitude: 29.519418, // 纬度
|
|
||||||
longitude: 106.687094, // 经度
|
|
||||||
allMarkers: [] // 标记点
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onReady() {
|
|
||||||
// 1.页面准备好后,获取到map组件的执行上下文。注意:这里是取的map的id属性
|
|
||||||
this.mapContext = uni.createMapContext("alarm_map", this);
|
|
||||||
// 2.请求数据
|
|
||||||
this.getallStations()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getallStations() {
|
|
||||||
uni.showLoading()
|
|
||||||
let obj = {
|
|
||||||
id: id,
|
|
||||||
stationQuery: query
|
|
||||||
}
|
|
||||||
getApi(obj).then(res => {
|
|
||||||
uni.hideLoading();
|
|
||||||
if (res.code == 0) {
|
|
||||||
if (!Array.isArray(res.data) || res.data.length <= 0) return
|
|
||||||
// 拿到请求数据后,把数据传给点聚合功能;
|
|
||||||
this.setMarkersAndCluster(res.data) // 3、调用聚合功能
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 聚合功能
|
|
||||||
setMarkersAndCluster(markerList) {
|
|
||||||
// 1.组装数据之后,并赋值给地图上的marker
|
|
||||||
this.allMarkers = Array.from(markerList).map((item, i) => {
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
width: 41,
|
|
||||||
height: 41,
|
|
||||||
iconPath: 'https://cdn.uviewui.com/uview/album/1.jpg',
|
|
||||||
joinCluster: true, // 这个属性很重要,必须要
|
|
||||||
callout: { // 自定义标记点上方的气泡窗口
|
|
||||||
content: '***聚合1',
|
|
||||||
display: 'ALWAYS', // 'BYCLICK':点击显示; 'ALWAYS':常显
|
|
||||||
padding: 5,
|
|
||||||
textAlign: 'center',
|
|
||||||
color: '#C2874D',
|
|
||||||
borderRadius: 4
|
|
||||||
},
|
|
||||||
label: { // 为标记点旁边增加标签
|
|
||||||
content: '你好,marker',
|
|
||||||
borderColor: '#ff0000',
|
|
||||||
bgColor: '#ffffff'## 标题
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 2.初始化点聚合的配置,未调用时采用默认配置
|
|
||||||
this.mapContext.initMarkerCluster({
|
|
||||||
enableDefaultStyle: false, // 是否启用默认的聚合样式(是否用自定义图标)
|
|
||||||
zoomOnClick: true,
|
|
||||||
gridSize: 60,
|
|
||||||
complete(res) {
|
|
||||||
console.log('initMarkerCluster', res)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 3.发生聚合时,给聚合点设置marker标签
|
|
||||||
this.mapContext.on('markerClusterCreate', res => {
|
|
||||||
const clusters = res.clusters // 新产生的聚合簇
|
|
||||||
const zhou = clusters.map(item=> {
|
|
||||||
const {
|
|
||||||
center, // 聚合点的经纬度数组
|
|
||||||
clusterId, // 聚合簇id
|
|
||||||
markerIds // 已经聚合了的标记点id数组
|
|
||||||
} = item
|
|
||||||
|
|
||||||
return {
|
|
||||||
...center,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
clusterId, // 必须有
|
|
||||||
iconPath: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png',
|
|
||||||
borderRadius: 8,
|
|
||||||
joinCluster: true,
|
|
||||||
label: { // 定制聚合点样式
|
|
||||||
content: markerIds.length + '',
|
|
||||||
fontSize: 14,
|
|
||||||
width: 18,
|
|
||||||
height: 18,
|
|
||||||
color: '#ffffff',
|
|
||||||
bgColor: '#C2874D',
|
|
||||||
borderRadius: 6,
|
|
||||||
textAlign: 'center',
|
|
||||||
anchorX: 25,
|
|
||||||
anchorY: -60,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 4. 添加聚合簇标签
|
|
||||||
this.mapContext.addMarkers({
|
|
||||||
markers: zhou,
|
|
||||||
clear: false, //是否先清空地图上所有的marker
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,457 +0,0 @@
|
||||||
<template>
|
|
||||||
<view class="container">
|
|
||||||
<map id="map" ref="map" style="width: 100%; height:2000rpx;" scale="13" :markers="markers" longitude="111.436625"
|
|
||||||
latitude="36.771975" show-location @markertap="markertap" @callouttap="callouttap">
|
|
||||||
</map>
|
|
||||||
<view class="zdxq">
|
|
||||||
<view class="zdxqitem" @click="switch2Change('团柏河')">
|
|
||||||
<image src="../../static/zhandian_nongtian_dingwei.png" mode=""></image>
|
|
||||||
<view class="textss">
|
|
||||||
团柏河典型小流域监测站
|
|
||||||
</view>
|
|
||||||
<!-- <view class="crildon" :style="!issscd?'background:#00ff37':'background: #ccc;'"></view> -->
|
|
||||||
</view>
|
|
||||||
<view class="zdxqitem" @click="switch2Change('对竹河')">
|
|
||||||
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
|
|
||||||
<view class="textss">
|
|
||||||
对竹河典型小流域监测站
|
|
||||||
</view>
|
|
||||||
<!-- <view class="crildon" :style="!isssscd?'background:#00ff37':'background: #ccc;'"></view> -->
|
|
||||||
</view>
|
|
||||||
<view class="zdxqitem" @click="switch2Change('土壤')">
|
|
||||||
<image src="../../static/iconsheturangzs.png" mode=""></image>
|
|
||||||
<view class="textss">
|
|
||||||
土壤监测
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import api from '@/api/api'
|
|
||||||
import configService from '@/common/service/config.service.js';
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
baseUrl:configService.staticDomainURL,
|
|
||||||
markers: [],
|
|
||||||
list: [],
|
|
||||||
issscd: false, // 团柏河显示状态 (false表示显示)
|
|
||||||
isssscd: false, // 对竹河显示状态 (false表示显示)
|
|
||||||
stationInfo: [],
|
|
||||||
cusLocation: [],
|
|
||||||
stationlist: [],
|
|
||||||
stationTwolist:[],
|
|
||||||
mapCtx: null // 添加地图上下文
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.getList()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onReady() {
|
|
||||||
// 在onReady中初始化地图上下文
|
|
||||||
this.mapCtx = uni.createMapContext('map', this);
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
if (!uni.getStorageSync('third_session')) {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '/packDetail/pages/login/login'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getList() {
|
|
||||||
this.markers = []
|
|
||||||
this.list = []
|
|
||||||
this.stationInfo = []
|
|
||||||
this.cusLocation = []
|
|
||||||
this.stationlist = []
|
|
||||||
this.stationTwolist = []
|
|
||||||
|
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中'
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$http.get('/applet/survStationInfo/stationMap').then(res => {
|
|
||||||
// 合并 stationInfo 和 deviceList
|
|
||||||
const combinedList = [...res.data.data.stationInfo, ...res.data.data.deviceList];
|
|
||||||
this.stationlist = combinedList;
|
|
||||||
this.stationTwolist = [...res.data.data.stationInfo];
|
|
||||||
|
|
||||||
console.log("合并后的stationlist+++++", this.stationlist);
|
|
||||||
|
|
||||||
// 处理所有标记点
|
|
||||||
this.stationlist.forEach((item, index) => {
|
|
||||||
item.id = index;
|
|
||||||
|
|
||||||
// 统一字段名称,处理 deviceList 和 stationInfo 的字段差异
|
|
||||||
const markerItem = {
|
|
||||||
id: item.id,
|
|
||||||
latitude: Number(item.latitude || item.stationLatitude),
|
|
||||||
longitude: Number(item.longitude || item.stationLongitude),
|
|
||||||
stationType: item.stationType || 'device', // deviceList 没有 stationType,默认为 'device'
|
|
||||||
sortNo: item.sortNo || index,
|
|
||||||
stationName: item.name || item.stationName,
|
|
||||||
stationCode: item.ids || item.stationCode || item.id,
|
|
||||||
// 添加分组信息
|
|
||||||
groupName: item.groupName || '',
|
|
||||||
// 设备类型
|
|
||||||
deviceType: item.type || null
|
|
||||||
};
|
|
||||||
|
|
||||||
this.list.push(markerItem);
|
|
||||||
|
|
||||||
// 分类处理
|
|
||||||
if (item.stationType === 'cusLocaltion') {
|
|
||||||
this.cusLocation.push(item);
|
|
||||||
}
|
|
||||||
if (item.stationType === 'orient' || item.stationType === 'livestock') {
|
|
||||||
this.stationInfo.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.issscd = false
|
|
||||||
this.isssscd = false
|
|
||||||
this.qiyeChange()
|
|
||||||
this.list1query()
|
|
||||||
this.addDeviceMarkers() // 添加设备标记
|
|
||||||
|
|
||||||
// 延迟执行以确保标记已经添加到地图
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToFitAllMarkers();
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
uni.hideLoading();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 添加设备标记
|
|
||||||
addDeviceMarkers() {
|
|
||||||
this.stationlist.forEach((item, index) => {
|
|
||||||
// 如果是 deviceList 中的设备(有 type 字段但没有 stationType 字段)
|
|
||||||
if (item.type && !item.stationType) {
|
|
||||||
let iconPath = '';
|
|
||||||
let width = 35;
|
|
||||||
let height = 35;
|
|
||||||
|
|
||||||
// 根据设备类型设置不同的图标
|
|
||||||
switch(item.type) {
|
|
||||||
case 'soil':
|
|
||||||
iconPath = this.baseUrl + '/icon/device/soil.png';
|
|
||||||
width = 40;
|
|
||||||
height = 40;
|
|
||||||
break;
|
|
||||||
case 'camera':
|
|
||||||
iconPath = this.baseUrl + '/icon/device/cam.png';
|
|
||||||
width = 45;
|
|
||||||
height = 45;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iconPath = this.baseUrl + '/icon/device/default.png';
|
|
||||||
}
|
|
||||||
|
|
||||||
const markerItem = {
|
|
||||||
id: item.id,
|
|
||||||
iconPath: iconPath,
|
|
||||||
latitude: Number(item.latitude),
|
|
||||||
longitude: Number(item.longitude),
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
customCallout: {
|
|
||||||
anchorY: 0,
|
|
||||||
anchorX: 0,
|
|
||||||
display: 'ALWAYS'
|
|
||||||
},
|
|
||||||
stationType: 'device',
|
|
||||||
stationName: item.name,
|
|
||||||
stationCode: item.ids,
|
|
||||||
deviceType: item.type,
|
|
||||||
joinCluster: true
|
|
||||||
};
|
|
||||||
this.markers.push(markerItem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 调整地图视野以包含所有标记点
|
|
||||||
adjustMapToFitAllMarkers() {
|
|
||||||
if (this.mapCtx && this.list.length > 0) {
|
|
||||||
this.mapCtx.includePoints({
|
|
||||||
points: this.list.map(item => ({
|
|
||||||
latitude: item.latitude,
|
|
||||||
longitude: item.longitude
|
|
||||||
})),
|
|
||||||
padding: [40, 40, 40, 40] // 上下左右的边距
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 调整地图视野到特定区域的标记点
|
|
||||||
adjustMapToRegion(regionName) {
|
|
||||||
let points = [];
|
|
||||||
|
|
||||||
if (regionName === '团柏河') {
|
|
||||||
// 获取团柏河区域的所有标记点
|
|
||||||
points = this.stationTwolist
|
|
||||||
.filter(item => item.groupName === '团柏河')
|
|
||||||
.map(item => ({
|
|
||||||
latitude: Number(item.stationLatitude),
|
|
||||||
longitude: Number(item.stationLongitude)
|
|
||||||
}));
|
|
||||||
} else if (regionName === '对竹河') {
|
|
||||||
// 获取对竹河区域的所有标记点
|
|
||||||
points = this.stationTwolist
|
|
||||||
.filter(item => item.groupName === '对竹河')
|
|
||||||
.map(item => ({
|
|
||||||
latitude: Number(item.stationLatitude),
|
|
||||||
longitude: Number(item.stationLongitude)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (points.length > 0 && this.mapCtx) {
|
|
||||||
this.mapCtx.includePoints({
|
|
||||||
points: points,
|
|
||||||
padding: [60, 60, 60, 60] // 可以调整边距以获得更好的显示效果
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
markertap(e) {
|
|
||||||
const index = e.detail.markerId
|
|
||||||
const marker = this.markers.find(m => m.id === index);
|
|
||||||
if (marker) {
|
|
||||||
if (['orient', 'livestock'].includes(marker.stationType)) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
|
|
||||||
})
|
|
||||||
} else if (marker.stationType === 'device') {
|
|
||||||
// 处理设备点击事件
|
|
||||||
uni.showToast({
|
|
||||||
title: `设备: ${marker.stationName}`,
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
// 可以在这里添加设备详情页面的跳转逻辑
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
callouttap(e) {
|
|
||||||
const index = e.detail.markerId
|
|
||||||
const marker = this.markers.find(m => m.id === index);
|
|
||||||
if (marker) {
|
|
||||||
if (['orient', 'livestock'].includes(marker.stationType)) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
|
|
||||||
})
|
|
||||||
} else if (marker.stationType === 'device') {
|
|
||||||
// 处理设备点击事件
|
|
||||||
uni.showToast({
|
|
||||||
title: `设备: ${marker.stationName}`,
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
qiyeChange() {
|
|
||||||
for (let i = 0; i < this.cusLocation.length; i++) {
|
|
||||||
const item = this.cusLocation[i];
|
|
||||||
item.iconPath = '/static/qiyeIcon.png';
|
|
||||||
item.latitude = Number(item.stationLatitude);
|
|
||||||
item.longitude = Number(item.stationLongitude);
|
|
||||||
item.width = 35;
|
|
||||||
item.height = 52;
|
|
||||||
|
|
||||||
const markerItem = {
|
|
||||||
id: item.id,
|
|
||||||
iconPath: item.iconPath,
|
|
||||||
latitude: item.latitude,
|
|
||||||
longitude: item.longitude,
|
|
||||||
width: item.width,
|
|
||||||
height: item.height,
|
|
||||||
customCallout: {
|
|
||||||
anchorY: 0,
|
|
||||||
anchorX: 0,
|
|
||||||
display: 'ALWAYS'
|
|
||||||
},
|
|
||||||
stationType: item.stationType,
|
|
||||||
stationName: item.stationName,
|
|
||||||
stationCode: item.stationCode,
|
|
||||||
joinCluster: true
|
|
||||||
};
|
|
||||||
this.markers.push(markerItem);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
switch2Change(name) {
|
|
||||||
if (name === "团柏河") {
|
|
||||||
this.issscd = !this.issscd;
|
|
||||||
} else {
|
|
||||||
this.isssscd = !this.isssscd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据当前状态调整地图视野
|
|
||||||
if ((name === "团柏河" && !this.issscd) || (name === "对竹河" && !this.isssscd)) {
|
|
||||||
// 如果是显示状态(绿色圆点),调整到指定区域
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToRegion(name);
|
|
||||||
}, 300);
|
|
||||||
} else {
|
|
||||||
// 如果是隐藏状态(灰色圆点),调整到所有标记点
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToFitAllMarkers();
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
list1query() {
|
|
||||||
// 先清除所有orient类型的标记
|
|
||||||
this.markers = this.markers.filter(item => item.stationType !== 'orient');
|
|
||||||
|
|
||||||
if (!this.issscd) {
|
|
||||||
for (let i = 0; i < this.stationlist.length; i++) {
|
|
||||||
const item = this.stationlist[i];
|
|
||||||
if (item.stationType === 'orient') {
|
|
||||||
item.iconPath = this.baseUrl +'/'+ item.stationIcon;
|
|
||||||
item.latitude = Number(item.stationLatitude);
|
|
||||||
item.longitude = Number(item.stationLongitude);
|
|
||||||
item.width = 172;
|
|
||||||
item.height = 148;
|
|
||||||
|
|
||||||
const markerItem = {
|
|
||||||
id: item.id,
|
|
||||||
iconPath: item.iconPath,
|
|
||||||
latitude: item.latitude,
|
|
||||||
longitude: item.longitude,
|
|
||||||
width: item.width,
|
|
||||||
height: item.height,
|
|
||||||
customCallout: {
|
|
||||||
anchorY: 0,
|
|
||||||
anchorX: 0,
|
|
||||||
display: 'ALWAYS'
|
|
||||||
},
|
|
||||||
stationType: item.stationType,
|
|
||||||
stationName: item.stationName,
|
|
||||||
stationCode: item.stationCode,
|
|
||||||
joinCluster: true
|
|
||||||
};
|
|
||||||
this.markers.push(markerItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
/* 样式保持不变 */
|
|
||||||
.bgimg {
|
|
||||||
position: fixed;
|
|
||||||
// z-index: -99;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customCallout {
|
|
||||||
width: 349rpx;
|
|
||||||
height: 49rpx;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 24rpx;
|
|
||||||
text-shadow: 1rpx 2rpx 0rpx #0D1934;
|
|
||||||
font-weight: bold;
|
|
||||||
// background-image: url('@/static/zhandian_icon_nongtian_title.png');
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customCallout1 {
|
|
||||||
width: 349rpx;
|
|
||||||
height: 49rpx;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 24rpx;
|
|
||||||
text-shadow: 1rpx 2rpx 0rpx #0D1934;
|
|
||||||
font-weight: bold;
|
|
||||||
// background-image: url('@/static/zhandian_icon_xuqin_title.png');
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zdxq {
|
|
||||||
position: fixed;
|
|
||||||
left: 33rpx;
|
|
||||||
bottom: 36rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zdxqitem {
|
|
||||||
padding: 8rpx 0 7rpx 17rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
font-size: 22rpx;
|
|
||||||
font-family: Source Han Sans SC;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #FFFFFF;
|
|
||||||
text-shadow: 0rpx 1rpx 0rpx rgba(4, 49, 52, 0.55);
|
|
||||||
width: 359rpx;
|
|
||||||
background: rgba(0, 0, 0, 0.52);
|
|
||||||
border: 1px solid #4B677C;
|
|
||||||
border-radius: 6rpx;
|
|
||||||
margin-bottom: 10rpx;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.crildon {
|
|
||||||
width: 10rpx;
|
|
||||||
height: 10rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 15rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zdxqitem:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zdxqitem image {
|
|
||||||
width: 33rpx;
|
|
||||||
height: 50rpx;
|
|
||||||
margin-right: 15rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zdxqitem:first-child image {
|
|
||||||
width: 30rpx;
|
|
||||||
height: 40rpx;
|
|
||||||
margin-right: 15rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.textss {
|
|
||||||
flex: 1;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgs {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: -9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switchs {
|
|
||||||
position: fixed;
|
|
||||||
top: 36rpx;
|
|
||||||
right: 40rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,326 +1,455 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<map id="map" ref="map" style="width: 100%; height: calc(100vh + 50rpx);" scale="13" :markers="markers" longitude="111.436625"
|
<!-- <image src="../../static/zddt.jpg" mode="" class="bgimg" @click="todetail()"></image> -->
|
||||||
latitude="36.771975" show-location @markertap="markertap" @callouttap="callouttap">
|
<map id="map" style="width: 100%; height:2000rpx;" scale="13" :markers="markers" longitude="110.628279"
|
||||||
|
latitude="35.546105" show-location @markertap="markertap" @callouttap="callouttap">
|
||||||
|
<cover-view slot="callout">
|
||||||
|
<cover-view v-for="(item,index) in markers" :key="index" class="customCallout" :marker-id="item.id">
|
||||||
|
<cover-image class="imgs" src="@/static/zhandian_icon_xuqin_title.png"
|
||||||
|
v-if="item.stationType == 'livestock'"></cover-image>
|
||||||
|
<cover-image class="imgs" src="@/static/zhandian_icon_nongtian_title.png"
|
||||||
|
v-if="item.stationType == 'orient'"></cover-image>
|
||||||
|
<cover-image class="imgs" src="@/static/zhandian_icon_qiye_title.png"
|
||||||
|
v-if="item.stationType == 'cusLocaltion'"></cover-image>
|
||||||
|
<cover-view class="content"
|
||||||
|
v-if="item.stationType == 'livestock' || item.stationType == 'orient'|| item.stationType == 'cusLocaltion'">
|
||||||
|
{{item.stationName}}
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
</map>
|
</map>
|
||||||
<view class="zdxq">
|
<view class="zdxq">
|
||||||
<view class="zdxqitem" @click="switch2Change('团柏河')">
|
<view class="zdxqitem" @click="switch1Change">
|
||||||
<image src="../../static/zhandian_nongtian_dingwei.png" mode=""></image>
|
<image src="../../static/zhandian_sahchong_dingwei.png" mode=""></image>
|
||||||
<view class="textss">
|
<view class="textss">
|
||||||
团柏河监测站
|
联网式太阳能杀虫灯
|
||||||
</view>
|
</view>
|
||||||
|
<view class="crildon" :style="!isscd?'background:#00ff37':'background: #ccc;'"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="zdxqitem" @click="switch2Change('对竹河')">
|
<view class="zdxqitem" @click="switch2Change">
|
||||||
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
|
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
|
||||||
<view class="textss">
|
<view class="textss">
|
||||||
对竹河监测站
|
畜禽养殖污染监测站
|
||||||
</view>
|
</view>
|
||||||
|
<view class="crildon" :style="!issscd?'background:#00ff37':'background: #ccc;'"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="zdxqitem" @click="switch2Change('土壤')">
|
<view class="zdxqitem" @click="switch3Change">
|
||||||
<image src="../../static/iconsheturangzs.png" mode=""></image>
|
<image src="../../static/zhandian_nongtian_dingwei.png" mode=""></image>
|
||||||
<view class="textss">
|
<view class="textss">
|
||||||
长期定位监测点
|
农田面源污染监测站
|
||||||
</view>
|
</view>
|
||||||
|
<view class="crildon" :style="!isssscd?'background:#00ff37':'background: #ccc;'"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view class="switchs" :defaultSwitch="isscd">-->
|
||||||
|
<!-- <selectSwitch @change="switch1Change" :defaultSwitch="isscd" checked_bj_color="#13ce66"/>-->
|
||||||
|
<!-- <switch style="margin-right: 10rpx;" :checked="isscd" @change="switch1Change" />-->
|
||||||
|
<!-- <!– 显示/隐藏杀虫灯 –>-->
|
||||||
|
<!-- </view>-->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import api from '@/api/api'
|
import api from '@/api/api'
|
||||||
import configService from '@/common/service/config.service.js';
|
import selectSwitch from "@/components/xuan-switch/xuan-switch.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
selectSwitch
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseUrl: configService.staticDomainURL,
|
|
||||||
center: {
|
|
||||||
latitude: 36.5,
|
|
||||||
longitude: 111.7
|
|
||||||
},
|
|
||||||
scale: 14,
|
|
||||||
markers: [],
|
markers: [],
|
||||||
|
markersNoPest: [],
|
||||||
list: [],
|
list: [],
|
||||||
issscd: false, // 团柏河显示状态 (false表示显示)
|
pointers: [],
|
||||||
isssscd: false, // 对竹河显示状态 (false表示显示)
|
imgurl1: '@/static/zhandian_icon_nongtian_title.png',
|
||||||
isSoilShow: false, // 土壤显示状态 (false表示显示)
|
imgurl2: '@/static/zhandian_icon_xuqin_title.png',
|
||||||
stationInfo: [],
|
isscd: true,
|
||||||
|
issscd: true,
|
||||||
|
isssscd: true,
|
||||||
|
pestlight: [],
|
||||||
cusLocation: [],
|
cusLocation: [],
|
||||||
|
stationInfo: [],
|
||||||
|
pestlightMarker: null,
|
||||||
stationlist: [],
|
stationlist: [],
|
||||||
stationTwolist: [],
|
timerSet: null,
|
||||||
mapCtx: null // 添加地图上下文
|
isDataLoaded: false,
|
||||||
|
isCheckingLogin: false, // 防止重复检查
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.$nextTick(() => {
|
console.log('地图页面加载');
|
||||||
this.getList()
|
// 不在这里加载数据
|
||||||
})
|
|
||||||
},
|
|
||||||
onReady() {
|
|
||||||
// 在onReady中初始化地图上下文
|
|
||||||
this.mapCtx = uni.createMapContext('map', this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
if(uni.getStorageSync('third_session')){
|
console.log('地图页面显示');
|
||||||
uni.login({
|
// 如果正在检查登录,不重复执行
|
||||||
success: function (res) {
|
if (this.isCheckingLogin) {
|
||||||
this.code = res.code
|
return;
|
||||||
let params = {}
|
}
|
||||||
params.jsCode = this.code
|
this.checkLoginStatus();
|
||||||
api.wxlogin(params).then(res=>{
|
},
|
||||||
if(res.data.code == 0){
|
|
||||||
let userInfo = res.data.data;
|
onReady() {
|
||||||
// uni.setStorageSync('third_session', userInfo.thirdSession);
|
this.mapContext = uni.createMapContext("alarm_map", this);
|
||||||
if(!userInfo.id){
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
// 统一的登录状态检查方法
|
||||||
|
checkLoginStatus() {
|
||||||
|
this.isCheckingLogin = true;
|
||||||
|
|
||||||
|
const token = uni.getStorageSync('constant');
|
||||||
|
const session = uni.getStorageSync('third_session');
|
||||||
|
|
||||||
|
console.log('登录检查 - token:', !!token, 'session:', !!session);
|
||||||
|
|
||||||
|
// 情况1:没有任何登录凭证 -> 跳转欢迎页
|
||||||
|
if (!token && !session) {
|
||||||
|
console.log('无登录凭证,跳转欢迎页');
|
||||||
|
this.isCheckingLogin = false;
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/packDetail/pages/login/login'
|
url: '/pages/loginindex'
|
||||||
})
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 情况2:有 third_session 但没有用户信息 -> 需要验证
|
||||||
|
if (session && !token) {
|
||||||
|
console.log('有session无token,验证用户');
|
||||||
|
this.verifyUserInfo();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 情况3:有完整登录信息 -> 加载数据
|
||||||
|
if (token) {
|
||||||
|
console.log('有完整登录信息,加载地图数据');
|
||||||
|
this.isCheckingLogin = false;
|
||||||
|
if (!this.isDataLoaded) {
|
||||||
|
this.getList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
|
||||||
|
// 验证用户信息
|
||||||
|
verifyUserInfo() {
|
||||||
|
const that = this;
|
||||||
|
|
||||||
|
uni.login({
|
||||||
|
success: (res) => {
|
||||||
|
console.log('微信登录成功,code:', res.code);
|
||||||
|
const params = {
|
||||||
|
jsCode: res.code
|
||||||
|
};
|
||||||
|
|
||||||
|
api.wxlogin(params).then(res => {
|
||||||
|
console.log('wxlogin接口返回:', res.data);
|
||||||
|
|
||||||
|
// 检查接口返回状态
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
const userInfo = res.data.data;
|
||||||
|
|
||||||
|
// 检查用户信息是否完整
|
||||||
|
if (userInfo.id && userInfo.id !== null && userInfo.id !== 'null') {
|
||||||
|
// 登录有效,保存信息
|
||||||
|
uni.setStorageSync('constant', userInfo);
|
||||||
|
console.log('用户验证通过,保存token');
|
||||||
|
that.isCheckingLogin = false;
|
||||||
|
// 加载地图数据
|
||||||
|
if (!that.isDataLoaded) {
|
||||||
|
that.getList();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 用户信息不完整,跳转登录
|
||||||
|
console.log('用户信息不完整,跳转登录页');
|
||||||
|
that.isCheckingLogin = false;
|
||||||
|
that.clearCacheAndGoLogin();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 接口返回错误
|
||||||
|
console.log('接口返回错误:', res.data.msg || '未知错误');
|
||||||
|
that.isCheckingLogin = false;
|
||||||
|
that.clearCacheAndGoLogin();
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error('wxlogin请求失败:', err);
|
||||||
|
that.isCheckingLogin = false;
|
||||||
|
that.clearCacheAndGoLogin();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('微信登录失败:', err);
|
||||||
|
that.isCheckingLogin = false;
|
||||||
|
that.clearCacheAndGoLogin();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else if(!uni.getStorageSync('third_session')){
|
},
|
||||||
uni.reLaunch({
|
|
||||||
url:'/packDetail/pages/login/login'
|
// 验证 token 有效性
|
||||||
})
|
verifyToken() {
|
||||||
|
this.isCheckingLogin = false;
|
||||||
|
if (!this.isDataLoaded) {
|
||||||
|
this.getList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
|
// 清理缓存并跳转登录
|
||||||
|
clearCacheAndGoLogin() {
|
||||||
|
const keys = ['constant', 'third_session', 'userName', 'password'];
|
||||||
|
keys.forEach(key => {
|
||||||
|
uni.removeStorageSync(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/packDetail/pages/login/login'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取地图数据(添加错误处理)
|
||||||
getList() {
|
getList() {
|
||||||
this.markers = []
|
// 防止重复加载
|
||||||
this.list = []
|
if (this.isDataLoaded) {
|
||||||
this.stationInfo = []
|
console.log('数据已加载,跳过');
|
||||||
this.cusLocation = []
|
return;
|
||||||
this.stationlist = []
|
}
|
||||||
this.stationTwolist = []
|
|
||||||
|
// 再次检查登录状态
|
||||||
|
const token = uni.getStorageSync('constant');
|
||||||
|
if (!token) {
|
||||||
|
console.log('没有登录token,不加载数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('开始加载地图数据');
|
||||||
|
|
||||||
|
this.markers = [];
|
||||||
|
this.markersNoPest = [];
|
||||||
|
this.pointers = [];
|
||||||
|
this.list = [];
|
||||||
|
this.pestlight = [];
|
||||||
|
this.cusLocation = [];
|
||||||
|
this.stationInfo = [];
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$http.get('/applet/survStationInfo/stationMap').then(res => {
|
this.$http.get('/applet/survStationInfo/stationMap').then(res => {
|
||||||
// 合并 stationInfo 和 deviceList
|
console.log('地图接口返回:', res.data);
|
||||||
const combinedList = [...res.data.data.stationInfo, ...res.data.data.deviceList];
|
|
||||||
this.stationlist = combinedList;
|
|
||||||
this.stationTwolist = [...res.data.data.stationInfo];
|
|
||||||
|
|
||||||
console.log("合并后的stationlist+++++", this.stationlist);
|
// ⚠️ 关键:检查数据是否存在
|
||||||
|
if (!res.data || res.data.code !== 0) {
|
||||||
// 处理所有标记点
|
console.error('地图数据加载失败:', res.data?.msg || '数据格式错误');
|
||||||
this.stationlist.forEach((item, index) => {
|
uni.hideLoading();
|
||||||
item.id = index;
|
uni.showToast({
|
||||||
|
title: res.data?.msg || '加载失败',
|
||||||
// 统一字段名称,处理 deviceList 和 stationInfo 的字段差异
|
icon: 'none'
|
||||||
const markerItem = {
|
|
||||||
id: item.id,
|
|
||||||
latitude: Number(item.latitude || item.stationLatitude),
|
|
||||||
longitude: Number(item.longitude || item.stationLongitude),
|
|
||||||
stationType: item.stationType || 'device', // deviceList 没有 stationType,默认为 'device'
|
|
||||||
sortNo: item.sortNo || index,
|
|
||||||
stationName: item.name || item.stationName,
|
|
||||||
stationCode: item.ids || item.stationCode || item.id,
|
|
||||||
// 添加分组信息
|
|
||||||
groupName: item.groupName || '',
|
|
||||||
// 设备类型
|
|
||||||
deviceType: item.type || null
|
|
||||||
};
|
|
||||||
|
|
||||||
this.list.push(markerItem);
|
|
||||||
|
|
||||||
// 分类处理
|
|
||||||
if (item.stationType === 'cusLocaltion') {
|
|
||||||
this.cusLocation.push(item);
|
|
||||||
}
|
|
||||||
if (item.stationType === 'orient' || item.stationType === 'livestock') {
|
|
||||||
this.stationInfo.push(item);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.issscd = false
|
// 如果接口返回未登录,跳转登录
|
||||||
this.isssscd = false
|
if (res.data?.code === 401 || res.data?.code === 1001) {
|
||||||
this.isSoilShow = false
|
this.clearCacheAndGoLogin();
|
||||||
this.qiyeChange()
|
}
|
||||||
this.list1query()
|
return;
|
||||||
this.addDeviceMarkers() // 添加设备标记
|
|
||||||
|
|
||||||
// 延迟执行以确保标记已经添加到地图
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToFitAllMarkers();
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
uni.hideLoading();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 添加设备标记
|
|
||||||
addDeviceMarkers() {
|
|
||||||
this.stationlist.forEach((item, index) => {
|
|
||||||
// 如果是 deviceList 中的设备(有 type 字段但没有 stationType 字段)
|
|
||||||
if (item.type && !item.stationType) {
|
|
||||||
let iconPath = '';
|
|
||||||
let width = 35;
|
|
||||||
let height = 35;
|
|
||||||
|
|
||||||
// 根据设备类型设置不同的图标
|
|
||||||
switch(item.type) {
|
|
||||||
case 'soil':
|
|
||||||
iconPath = this.baseUrl + '/icon/device/soil.png';
|
|
||||||
width = 32;
|
|
||||||
height = 47;
|
|
||||||
break;
|
|
||||||
case 'camera':
|
|
||||||
iconPath = this.baseUrl + '/icon/device/cam.png';
|
|
||||||
width = 45;
|
|
||||||
height = 45;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iconPath = this.baseUrl + '/icon/device/default.png';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const markerItem = {
|
// ⚠️ 检查 data 对象是否存在
|
||||||
id: item.id,
|
if (!res.data.data) {
|
||||||
iconPath: iconPath,
|
console.error('地图数据为空');
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无数据',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安全地获取数据
|
||||||
|
const data = res.data.data;
|
||||||
|
const pestlightData = data.pestlight || [];
|
||||||
|
const cusLocationData = data.cusLocation || [];
|
||||||
|
const stationInfoData = data.stationInfo || [];
|
||||||
|
|
||||||
|
this.stationlist = [...pestlightData, ...cusLocationData, ...stationInfoData];
|
||||||
|
|
||||||
|
if (this.stationlist.length === 0) {
|
||||||
|
console.log('没有站点数据');
|
||||||
|
uni.hideLoading();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stationlist.forEach((item, index) => {
|
||||||
|
item.id = index;
|
||||||
|
if (item.inType == 'pestlight') {
|
||||||
|
this.pestlight.push(item);
|
||||||
|
}
|
||||||
|
if (item.stationType == 'cusLocaltion') {
|
||||||
|
this.cusLocation.push(item);
|
||||||
|
}
|
||||||
|
if (item.stationType == 'orient' || item.stationType == 'livestock') {
|
||||||
|
this.stationInfo.push(item);
|
||||||
|
}
|
||||||
|
this.list.push({
|
||||||
|
latitude: Number(item.stationLatitude),
|
||||||
|
longitude: Number(item.stationLongitude),
|
||||||
|
stationType: item.stationType,
|
||||||
|
sortNo: item.sortNo,
|
||||||
|
stationName: item.stationName,
|
||||||
|
stationCode: item.stationCode
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.issscd = false;
|
||||||
|
this.isssscd = false;
|
||||||
|
this.qiyeChange();
|
||||||
|
this.list1query();
|
||||||
|
this.list2query();
|
||||||
|
|
||||||
|
this.isDataLoaded = true;
|
||||||
|
|
||||||
|
uni.hideLoading();
|
||||||
|
console.log('地图数据加载完成,共', this.stationlist.length, '个站点');
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('加载地图数据失败:', err);
|
||||||
|
uni.hideLoading();
|
||||||
|
|
||||||
|
// 如果是网络错误,提示用户
|
||||||
|
uni.showToast({
|
||||||
|
title: '网络异常,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理 stationlist 数据方法
|
||||||
|
processStationList(stationlist) {
|
||||||
|
if (stationlist && Array.isArray(stationlist)) {
|
||||||
|
stationlist.forEach(item => {
|
||||||
|
this.list.push({
|
||||||
|
latitude: item.inType === 'pestlight' ? Number(item.latitude) : Number(item.stationLatitude),
|
||||||
|
longitude: item.inType === 'pestlight' ? Number(item.longitude) : Number(item.stationLongitude),
|
||||||
|
stationType: item.inType === 'pestlight' ? 'pestlight' : item.stationType,
|
||||||
|
sortNo: item.sortNo,
|
||||||
|
stationName: item.stationName,
|
||||||
|
stationCode: item.stationCode
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 生成 pointers 数据方法
|
||||||
|
generatePointers() {
|
||||||
|
const iconConfig = {
|
||||||
|
orient: {
|
||||||
|
iconPath: '/static/zhandian_nongtian_dingwei.png',
|
||||||
|
width: 35,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
livestock: {
|
||||||
|
iconPath: '/static/zhandian_xuqin_dingwei.png',
|
||||||
|
width: 35,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
cusLocaltion: {
|
||||||
|
iconPath: '/static/qiyeIcon.png',
|
||||||
|
width: 35,
|
||||||
|
height: 52
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.list.forEach((item, i) => {
|
||||||
|
const config = iconConfig[item.stationType] || {};
|
||||||
|
item.iconPath = config.iconPath || '';
|
||||||
|
item.width = config.width || 0;
|
||||||
|
item.height = config.height || 0;
|
||||||
|
this.pointers.push({
|
||||||
|
id: i,
|
||||||
|
iconPath: item.iconPath,
|
||||||
latitude: Number(item.latitude),
|
latitude: Number(item.latitude),
|
||||||
longitude: Number(item.longitude),
|
longitude: Number(item.longitude),
|
||||||
width: width,
|
width: item.width,
|
||||||
height: height,
|
height: item.height,
|
||||||
customCallout: {
|
customCallout: {
|
||||||
anchorY: 0,
|
anchorY: 0,
|
||||||
anchorX: 0,
|
anchorX: 0,
|
||||||
display: 'ALWAYS'
|
display: 'ALWAYS'
|
||||||
},
|
},
|
||||||
stationType: 'device',
|
stationType: item.stationType,
|
||||||
stationName: item.name,
|
stationName: item.stationName,
|
||||||
stationCode: item.ids,
|
stationCode: item.stationCode,
|
||||||
deviceType: item.type,
|
joinCluster: true
|
||||||
joinCluster: false //点聚合
|
|
||||||
};
|
|
||||||
this.markers.push(markerItem);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
// 调整地图视野以包含所有标记点(类似setFitView效果)
|
|
||||||
adjustMapToFitAllMarkers() {
|
|
||||||
if (this.mapCtx && this.list.length > 0) {
|
|
||||||
this.mapCtx.includePoints({
|
|
||||||
points: this.list.map(item => ({
|
|
||||||
latitude: item.latitude,
|
|
||||||
longitude: item.longitude
|
|
||||||
})),
|
|
||||||
padding: [60, 60, 60, 60] // 上下左右的边距
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 调整地图视野到特定区域的标记点
|
|
||||||
adjustMapToRegion(regionName) {
|
|
||||||
let points = [];
|
|
||||||
|
|
||||||
if (regionName === '团柏河') {
|
|
||||||
// 获取团柏河区域的所有标记点
|
|
||||||
points = this.stationTwolist
|
|
||||||
.filter(item => item.groupName === '团柏河')
|
|
||||||
.map(item => ({
|
|
||||||
latitude: Number(item.stationLatitude),
|
|
||||||
longitude: Number(item.stationLongitude)
|
|
||||||
}));
|
|
||||||
} else if (regionName === '对竹河') {
|
|
||||||
// 获取对竹河区域的所有标记点
|
|
||||||
points = this.stationTwolist
|
|
||||||
.filter(item => item.groupName === '对竹河')
|
|
||||||
.map(item => ({
|
|
||||||
latitude: Number(item.stationLatitude),
|
|
||||||
longitude: Number(item.stationLongitude)
|
|
||||||
}));
|
|
||||||
} else if (regionName === '土壤') {
|
|
||||||
// 获取所有土壤设备标记点
|
|
||||||
points = this.stationlist
|
|
||||||
.filter(item => item.type === 'soil' || item.deviceType === 'soil')
|
|
||||||
.map(item => ({
|
|
||||||
latitude: Number(item.latitude || item.stationLatitude),
|
|
||||||
longitude: Number(item.longitude || item.stationLongitude)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (points.length > 0 && this.mapCtx) {
|
|
||||||
this.mapCtx.includePoints({
|
|
||||||
points: points,
|
|
||||||
padding: [80, 110, 80, 110] // 增加边距以获得更好的显示效果
|
|
||||||
});
|
|
||||||
} else if (points.length === 0) {
|
|
||||||
// 如果没有找到对应的标记点,显示提示
|
|
||||||
uni.showToast({
|
|
||||||
title: `未找到${regionName}相关的监测点`,
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 更精确的地图定位方法(类似高德地图的setFitView)
|
|
||||||
preciseMapAdjustment(regionName) {
|
|
||||||
if (!this.mapCtx) return;
|
|
||||||
|
|
||||||
// 根据不同区域设置不同的中心和缩放级别
|
|
||||||
const regionConfigs = {
|
|
||||||
'团柏河': {
|
|
||||||
latitude: 36.5, // 实际中心纬度
|
|
||||||
longitude: 111.7, // 实际中心经度
|
|
||||||
scale: 14
|
|
||||||
},
|
|
||||||
'对竹河': {
|
|
||||||
latitude: 36.4, // 实际中心纬度
|
|
||||||
longitude: 111.6, // 实际中心经度
|
|
||||||
scale: 14
|
|
||||||
},
|
|
||||||
'土壤': {
|
|
||||||
latitude: 36.45, // 实际中心纬度
|
|
||||||
longitude: 111.65, // 实际中心经度
|
|
||||||
scale: 13
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const config = regionConfigs[regionName];
|
|
||||||
if (config) {
|
|
||||||
this.mapCtx.moveToLocation({
|
|
||||||
latitude: config.latitude,
|
|
||||||
longitude: config.longitude,
|
|
||||||
scale: config.scale
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
markertap(e) {
|
markertap(e) {
|
||||||
const index = e.detail.markerId
|
const index = e.detail.markerId;
|
||||||
const marker = this.markers.find(m => m.id === index);
|
if (this.list[index] && ['orient', 'livestock'].includes(this.list[index].stationType)) {
|
||||||
if (marker) {
|
|
||||||
if (['orient', 'livestock'].includes(marker.stationType)) {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
|
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(this.list[index]))}`
|
||||||
})
|
});
|
||||||
} else if (marker.stationType === 'device') {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/packDetail/pages/vidio/soilindex`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
callouttap(e) {
|
callouttap(e) {
|
||||||
const index = e.detail.markerId
|
const index = e.detail.markerId;
|
||||||
const marker = this.markers.find(m => m.id === index);
|
if (this.list[index] && ['orient', 'livestock'].includes(this.list[index].stationType)) {
|
||||||
if (marker) {
|
|
||||||
if (['orient', 'livestock'].includes(marker.stationType)) {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
|
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(this.list[index]))}`
|
||||||
})
|
|
||||||
} else if (marker.stationType === 'device') {
|
|
||||||
uni.showToast({
|
|
||||||
title: `设备: ${marker.stationName}`,
|
|
||||||
icon: 'none'
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
todetails(item) {
|
||||||
|
console.log(item, '还是个然后');
|
||||||
|
},
|
||||||
|
|
||||||
|
switch1Change() {
|
||||||
|
this.isscd = !this.isscd;
|
||||||
|
let index = 0;
|
||||||
|
if (!this.isscd) {
|
||||||
|
this.pestlightMarker = [];
|
||||||
|
this.timerSet = setInterval(() => {
|
||||||
|
for (let i = 0; i < 50 && index < this.pestlight.length; i++) {
|
||||||
|
const item = this.pestlight[index];
|
||||||
|
item.iconPath = '/static/zhandian_sahchong_dingwei.png';
|
||||||
|
item.latitude = Number(item.latitude);
|
||||||
|
item.longitude = Number(item.longitude);
|
||||||
|
item.width = 15;
|
||||||
|
item.height = 20;
|
||||||
|
const markerItem = {
|
||||||
|
id: item.id,
|
||||||
|
iconPath: item.iconPath,
|
||||||
|
latitude: item.latitude,
|
||||||
|
longitude: item.longitude,
|
||||||
|
width: item.width,
|
||||||
|
height: item.height,
|
||||||
|
customCallout: {
|
||||||
|
anchorY: 0,
|
||||||
|
anchorX: 0,
|
||||||
|
display: 'ALWAYS'
|
||||||
|
},
|
||||||
|
inType: item.inType,
|
||||||
|
stationName: item.stationName,
|
||||||
|
stationCode: item.stationCode,
|
||||||
|
joinCluster: false
|
||||||
|
};
|
||||||
|
this.markers.push(markerItem);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
if (index >= this.pestlight.length) {
|
||||||
|
clearInterval(this.timerSet);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
clearInterval(this.timerSet);
|
||||||
|
this.markers = this.markers.filter((item) => {
|
||||||
|
return item.inType !== 'pestlight';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -332,7 +461,14 @@
|
||||||
item.longitude = Number(item.stationLongitude);
|
item.longitude = Number(item.stationLongitude);
|
||||||
item.width = 35;
|
item.width = 35;
|
||||||
item.height = 52;
|
item.height = 52;
|
||||||
|
this.list.push({
|
||||||
|
latitude: Number(item.stationLatitude),
|
||||||
|
longitude: Number(item.stationLongitude),
|
||||||
|
stationType: item.stationType,
|
||||||
|
sortNo: item.sortNo,
|
||||||
|
stationName: item.stationName,
|
||||||
|
stationCode: item.stationCode
|
||||||
|
});
|
||||||
const markerItem = {
|
const markerItem = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
iconPath: item.iconPath,
|
iconPath: item.iconPath,
|
||||||
|
|
@ -348,58 +484,32 @@
|
||||||
stationType: item.stationType,
|
stationType: item.stationType,
|
||||||
stationName: item.stationName,
|
stationName: item.stationName,
|
||||||
stationCode: item.stationCode,
|
stationCode: item.stationCode,
|
||||||
joinCluster: false //点聚合
|
joinCluster: true
|
||||||
};
|
};
|
||||||
this.markers.push(markerItem);
|
this.markers.push(markerItem);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
switch2Change(name) {
|
switch2Change() {
|
||||||
// 更新对应区域的状态
|
this.issscd = !this.issscd;
|
||||||
const stateMap = {
|
this.list1query();
|
||||||
'团柏河': 'issscd',
|
},
|
||||||
'对竹河': 'isssscd',
|
|
||||||
'土壤': 'isSoilShow'
|
|
||||||
};
|
|
||||||
|
|
||||||
if (stateMap[name]) {
|
switch3Change() {
|
||||||
this[stateMap[name]] = !this[stateMap[name]];
|
this.isssscd = !this.isssscd;
|
||||||
}
|
this.list2query();
|
||||||
|
|
||||||
// 判断是否要聚焦到特定区域
|
|
||||||
const shouldFocus = {
|
|
||||||
'团柏河': !this.issscd,
|
|
||||||
'对竹河': !this.isssscd,
|
|
||||||
'土壤': !this.isSoilShow
|
|
||||||
};
|
|
||||||
|
|
||||||
if (shouldFocus[name]) {
|
|
||||||
// 聚焦到特定区域
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToRegion(name);
|
|
||||||
// 或者使用更精确的方法:this.preciseMapAdjustment(name);
|
|
||||||
}, 300);
|
|
||||||
} else {
|
|
||||||
// 恢复显示所有标记点
|
|
||||||
setTimeout(() => {
|
|
||||||
this.adjustMapToFitAllMarkers();
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
list1query() {
|
list1query() {
|
||||||
// 先清除所有orient类型的标记
|
|
||||||
this.markers = this.markers.filter(item => item.stationType !== 'orient');
|
|
||||||
|
|
||||||
if (!this.issscd) {
|
if (!this.issscd) {
|
||||||
for (let i = 0; i < this.stationlist.length; i++) {
|
for (let i = 0; i < this.stationInfo.length; i++) {
|
||||||
const item = this.stationlist[i];
|
const item = this.stationInfo[i];
|
||||||
if (item.stationType === 'orient') {
|
if (item.stationType === 'orient') {
|
||||||
item.iconPath = this.baseUrl +'/'+ item.stationIcon;
|
item.iconPath = '/static/zhandian_nongtian_dingwei.png';
|
||||||
item.latitude = Number(item.stationLatitude);
|
item.latitude = Number(item.stationLatitude);
|
||||||
item.longitude = Number(item.stationLongitude);
|
item.longitude = Number(item.stationLongitude);
|
||||||
item.width = 239;
|
item.width = 35;
|
||||||
item.height = 186;
|
item.height = 52;
|
||||||
const markerItem = {
|
const markerItem = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
iconPath: item.iconPath,
|
iconPath: item.iconPath,
|
||||||
|
|
@ -415,11 +525,52 @@
|
||||||
stationType: item.stationType,
|
stationType: item.stationType,
|
||||||
stationName: item.stationName,
|
stationName: item.stationName,
|
||||||
stationCode: item.stationCode,
|
stationCode: item.stationCode,
|
||||||
joinCluster: false //点聚合
|
joinCluster: true
|
||||||
};
|
};
|
||||||
this.markers.push(markerItem);
|
this.markers.push(markerItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.markers = this.markers.filter((item) => {
|
||||||
|
return item.stationType !== 'orient';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
list2query() {
|
||||||
|
if (!this.isssscd) {
|
||||||
|
for (let i = 0; i < this.stationInfo.length; i++) {
|
||||||
|
const item = this.stationInfo[i];
|
||||||
|
if (item.stationType === 'livestock') {
|
||||||
|
item.iconPath = '/static/zhandian_xuqin_dingwei.png';
|
||||||
|
item.latitude = Number(item.stationLatitude);
|
||||||
|
item.longitude = Number(item.stationLongitude);
|
||||||
|
item.width = 35;
|
||||||
|
item.height = 52;
|
||||||
|
const markerItem = {
|
||||||
|
id: item.id,
|
||||||
|
iconPath: item.iconPath,
|
||||||
|
latitude: item.latitude,
|
||||||
|
longitude: item.longitude,
|
||||||
|
width: item.width,
|
||||||
|
height: item.height,
|
||||||
|
customCallout: {
|
||||||
|
anchorY: 0,
|
||||||
|
anchorX: 0,
|
||||||
|
display: 'ALWAYS'
|
||||||
|
},
|
||||||
|
stationType: item.stationType,
|
||||||
|
stationName: item.stationName,
|
||||||
|
stationCode: item.stationCode,
|
||||||
|
joinCluster: true
|
||||||
|
};
|
||||||
|
this.markers.push(markerItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.markers = this.markers.filter((item) => {
|
||||||
|
return item.stationType !== 'livestock';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -427,7 +578,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/* 样式保持不变 */
|
|
||||||
.bgimg {
|
.bgimg {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
// z-index: -99;
|
// z-index: -99;
|
||||||
|
|
@ -483,7 +633,7 @@
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
text-shadow: 0rpx 1rpx 0rpx rgba(4, 49, 52, 0.55);
|
text-shadow: 0rpx 1rpx 0rpx rgba(4, 49, 52, 0.55);
|
||||||
width: 240rpx;
|
width: 299rpx;
|
||||||
background: rgba(0, 0, 0, 0.52);
|
background: rgba(0, 0, 0, 0.52);
|
||||||
border: 1px solid #4B677C;
|
border: 1px solid #4B677C;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
<view class="boxitem_left">
|
<view class="boxitem_left">
|
||||||
<image src="../../static/me_icon_shebei.png" mode=""></image>
|
<image src="../../static/me_icon_shebei.png" mode=""></image>
|
||||||
<view class="zl">
|
<view class="zl">
|
||||||
站点运维
|
运维记录
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="../../static/me_icon_in.png" mode=""></image>
|
<image src="../../static/me_icon_in.png" mode=""></image>
|
||||||
|
|
@ -78,31 +78,14 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if(uni.getStorageSync('third_session')){
|
api.checkLogin(()=>{
|
||||||
uni.login({
|
this.getuserInfo();
|
||||||
success: function (res) {
|
}, () => {
|
||||||
this.code = res.code
|
|
||||||
let params = {}
|
|
||||||
params.jsCode = this.code
|
|
||||||
api.wxlogin(params).then(res=>{
|
|
||||||
if(res.data.code == 0){
|
|
||||||
let userInfo = res.data.data;
|
|
||||||
// uni.setStorageSync('third_session', userInfo.thirdSession);
|
|
||||||
if(!userInfo.id){
|
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/packDetail/pages/login/login'
|
url:'/packDetail/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}else if(!uni.getStorageSync('third_session')){
|
|
||||||
uni.reLaunch({
|
|
||||||
url:'/packDetail/pages/login/login'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.getuserInfo()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getuserInfo(){
|
getuserInfo(){
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue