From 86023302e47ccb091ea4e19ca5e4fee413ba2c76 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Fri, 23 Aug 2024 15:13:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E6=9D=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/video/video.css | 3 +- js/login/login2.js | 4 +- js/operEnvironment/operEnvironment.js | 234 +++++++++++++------------- js/pages/accessMge/accessMge.js | 6 +- js/pages/home/navigation.js | 2 +- pages/video/video.html | 10 +- 6 files changed, 132 insertions(+), 127 deletions(-) diff --git a/css/video/video.css b/css/video/video.css index e09b229..aebd9c7 100644 --- a/css/video/video.css +++ b/css/video/video.css @@ -193,7 +193,8 @@ body { #left-bottom { width: 100%; - height: 57.8%; + height: 95.8%; + /*height: 57.8%;*/ background: url("../../img/video/ball_list.png") no-repeat 0 0 / 100% 100%; background-position: center center !important; } diff --git a/js/login/login2.js b/js/login/login2.js index 9a2d753..0eaaeb8 100644 --- a/js/login/login2.js +++ b/js/login/login2.js @@ -2,8 +2,8 @@ let form, layer; layui.use(function () { let isc_login="http://iscssotest.ah.sgcc.com.cn/isc_sso/login?service="; let logUrl="http://27.50.49.56:21624/zhgd-web/sgIndex.html"; - // window.location.href =isc_login+logUrl; - // return false; + window.location.href =isc_login+logUrl; + return false; form = layui.form; layer = layui.layer; form.on('submit(demo-login)', function (data) { diff --git a/js/operEnvironment/operEnvironment.js b/js/operEnvironment/operEnvironment.js index 3aa20f7..64de845 100644 --- a/js/operEnvironment/operEnvironment.js +++ b/js/operEnvironment/operEnvironment.js @@ -66,7 +66,7 @@ function realTimeMonitoring(){
` } - + $("#flex-Box").append(itemHtml) }) } @@ -94,20 +94,20 @@ function DaylightDisplacementList(deviceId){ }, cols: [[ {field: 'number', width:80,title: '序号', align: 'center', type: 'numbers', fixed: 'left'}, - // {field: 'areaName', title: '区域'}, + // {field: 'areaName', title: '区域'}, {field: 'deviceName', title: '设备名称'}, {field: 'moduleName', title: '检测类型'}, {field: 'val', title: '检测值'}, - // {field: 'sourceData', title: '原数据'}, + // {field: 'sourceData', title: '原数据'}, {field: 'changeVal', title: '变化值'}, {field: 'createTime', title: '检测时间'}, {field: 'isWarn', title: '状态', templet: function (d) { - if (d.isWarn == 0) { + if (d.isWarn == 1) { return '告警'; - } else if (d.isWarn == 1) { + } else if (d.isWarn == 0) { return '正常'; }else{ - return ''; + return '正常'; } } } @@ -137,7 +137,8 @@ function DaylightDisplacementApi(){ "roleCode": roleCode, "orgId": orgId, "userId": userId, - "bidCode": bidCode + "bidCode": bidCode, + "deviceType":1908 } let encryptStr = encryptCBC(JSON.stringify(params)); ajaxRequest(url, "POST", encryptStr, true, function () { @@ -151,8 +152,8 @@ function DaylightDisplacementApi(){ loginout(1) } }, function (xhr, status, error) { - error(xhr, status, error) - }, "application/json",aqEnnable); + error(xhr, status, error) + }, "application/json",aqEnnable); } function DaylightDisplacement(environmentData) { @@ -204,111 +205,112 @@ function zephyrineWeather() { // navigator.geolocation.getCurrentPosition(function (position) { // let latitude = position.coords.latitude; // let longitude = position.coords.longitude; - let latitude = '31.93566198931321'; - let longitude = '117.16010067578883'; - console.log("经度:" + longitude + ", 纬度:" + latitude); - let latLon = longitude + ',' + latitude; - // 百度地图API - // 创建一个点坐标 - var point = new BMap.Point(longitude, latitude); + let latitude = '34.007143'; + let longitude = '116.884782'; + console.log("经度:" + longitude + ", 纬度:" + latitude); + let latLon = '116.747321,33.934215'; - // 根据坐标点获取位置信息 - var geoc = new BMap.Geocoder(); - geoc.getLocation(point, function(rs){ - var addComp = rs.addressComponents; - var city = addComp.city; - var urban = addComp.city + ", " + addComp.district; - $("#city").text(city); - $("#urban").text(urban); - }); + // 百度地图API + // 创建一个点坐标 + var point = new BMap.Point(longitude, latitude); - const apiUrl = `https://devapi.qweather.com/v7/weather/now?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; - fetch(apiUrl) - .then(response => response.json()) - .then(data => { - const dailyWeather = data.now; - $("#temp").text(dailyWeather.temp + "°"); - $("#environment").text(dailyWeather.text); - if (dailyWeather.text === "晴") { - $("#weather_icon").css("background-image", "url('../../img/operEnvironment/clearWeather2.png')"); - } else if (dailyWeather.text === "多云") { - $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy.png')"); - } else if (dailyWeather.text === "阴") { - $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy_sm.png')"); - } else if (dailyWeather.text === "中雨" || dailyWeather.text === "大雨" || dailyWeather.text === "雨" || dailyWeather.text === "小雨") { - $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy_sm.png')"); - } - }) - .catch(error => { - console.error('Error fetching weather data:', error); + // 根据坐标点获取位置信息 + var geoc = new BMap.Geocoder(); + geoc.getLocation(point, function(rs){ + var addComp = rs.addressComponents; + var city = addComp.city; + var urban = addComp.city + ", " + addComp.district; + $("#city").text(city); + $("#urban").text(urban); + }); + + const apiUrl = `https://devapi.qweather.com/v7/weather/now?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; + fetch(apiUrl) + .then(response => response.json()) + .then(data => { + const dailyWeather = data.now; + $("#temp").text(dailyWeather.temp + "°"); + $("#environment").text(dailyWeather.text); + if (dailyWeather.text === "晴") { + $("#weather_icon").css("background-image", "url('../../img/operEnvironment/clearWeather2.png')"); + } else if (dailyWeather.text === "多云") { + $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy.png')"); + } else if (dailyWeather.text === "阴") { + $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy_sm.png')"); + } else if (dailyWeather.text === "中雨" || dailyWeather.text === "大雨" || dailyWeather.text === "雨" || dailyWeather.text === "小雨") { + $("#weather_icon").css("background-image", "url('../../img/operEnvironment/cloudy_sm.png')"); + } + }) + .catch(error => { + console.error('Error fetching weather data:', error); + }); + + const apiUrls = `https://devapi.qweather.com/v7/weather/3d?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; + fetch(apiUrls) + .then(response => response.json()) + .then(data => { + // 获取每日天气数据 + const dailyWeather = data.daily; + if (dailyWeather && Array.isArray(dailyWeather)) { + dailyWeather.forEach((day, index) => { + const dayIndex = index + 1; + const dateId = `#date${dayIndex}`; + const tempsId = `#temps${dayIndex}`; + const airId = `#air${dayIndex}`; + const iconId = `#weather_small_icon${dayIndex}`; + + // 更新HTML元素内容 + $(dateId).text(day.fxDate); + $(tempsId).text(day.tempMin + '°~' + day.tempMax + '°'); + $(airId).text(day.textDay); + + // 根据天气情况更新背景图片 + const weatherIcon = getWeatherIcon(day.textDay); + $(iconId).css('backgroundImage', `url('../../img/operEnvironment/${weatherIcon}')`); }); + } else { + console.log('未能获取有效的天气数据'); + } + }) + .catch(error => { + console.error('Error fetching weather data:', error); + }); - const apiUrls = `https://devapi.qweather.com/v7/weather/3d?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; - fetch(apiUrls) - .then(response => response.json()) - .then(data => { - // 获取每日天气数据 - const dailyWeather = data.daily; - if (dailyWeather && Array.isArray(dailyWeather)) { - dailyWeather.forEach((day, index) => { - const dayIndex = index + 1; - const dateId = `#date${dayIndex}`; - const tempsId = `#temps${dayIndex}`; - const airId = `#air${dayIndex}`; - const iconId = `#weather_small_icon${dayIndex}`; + const apiUrlss = `https://devapi.qweather.com/v7/weather/24h?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; + fetch(apiUrlss) + .then(response => response.json()) + .then(data => { + // 获取每小时天气数据 + const dailyWeather = data.hourly; + if (dailyWeather && Array.isArray(dailyWeather) && dailyWeather.length >= 7) { - // 更新HTML元素内容 - $(dateId).text(day.fxDate); - $(tempsId).text(day.tempMin + '°~' + day.tempMax + '°'); - $(airId).text(day.textDay); - - // 根据天气情况更新背景图片 - const weatherIcon = getWeatherIcon(day.textDay); - $(iconId).css('backgroundImage', `url('../../img/operEnvironment/${weatherIcon}')`); - }); - } else { - console.log('未能获取有效的天气数据'); - } - }) - .catch(error => { - console.error('Error fetching weather data:', error); + dailyWeather.slice(0, 7).map(hourlyData => { + const weather = hourlyData.text; // 天气 + const temperature = hourlyData.temp; // 温度 + const time = new Date(hourlyData.fxTime); // 获取时间日期对象 + let weatherIcon = getWeatherIcon(weather); + weatherArray.push(weather); + weatherIconArray.push(`../../img/operEnvironment/${weatherIcon}`); + temperatureArray.push(temperature); + timeArray.push(`${time.getHours()}:${time.getMinutes()}`); // 将小时和分钟以字符串形式存入数组 }); + console.log('天气数组:', weatherArray); + console.log('天气图标数组:', weatherIconArray); + console.log('温度数组:', temperatureArray); + console.log('时间数组:', timeArray); + //天气echarts图表 + connect2(); - const apiUrlss = `https://devapi.qweather.com/v7/weather/24h?location=${latLon}&key=b353808cee6649dba8ea4c6838319ea4`; - fetch(apiUrlss) - .then(response => response.json()) - .then(data => { - // 获取每小时天气数据 - const dailyWeather = data.hourly; - if (dailyWeather && Array.isArray(dailyWeather) && dailyWeather.length >= 7) { + } else { + console.log('未能获取有效的天气数据或数据不足7组'); + } + }) + .catch(error => { + console.error('获取天气数据时发生错误:', error); + }); - dailyWeather.slice(0, 7).map(hourlyData => { - const weather = hourlyData.text; // 天气 - const temperature = hourlyData.temp; // 温度 - const time = new Date(hourlyData.fxTime); // 获取时间日期对象 - let weatherIcon = getWeatherIcon(weather); - weatherArray.push(weather); - weatherIconArray.push(`../../img/operEnvironment/${weatherIcon}`); - temperatureArray.push(temperature); - timeArray.push(`${time.getHours()}:${time.getMinutes()}`); // 将小时和分钟以字符串形式存入数组 - }); - console.log('天气数组:', weatherArray); - console.log('天气图标数组:', weatherIconArray); - console.log('温度数组:', temperatureArray); - console.log('时间数组:', timeArray); - //天气echarts图表 - connect2(); - - } else { - console.log('未能获取有效的天气数据或数据不足7组'); - } - }) - .catch(error => { - console.error('获取天气数据时发生错误:', error); - }); - - // }); + // }); // } else { // console.log("浏览器不支持 Geolocation API"); // } @@ -490,8 +492,8 @@ function LimitedSpaceApi(){ loginout(1) } }, function (xhr, status, error) { - error(xhr, status, error) - }, "application/json",aqEnnable); + error(xhr, status, error) + }, "application/json",aqEnnable); } function LimitedSpace(environmentData) { @@ -570,8 +572,8 @@ function LimitedSpaceEnvironmentApi(deviceId){ loginout(1) } }, function (xhr, status, error) { - error(xhr, status, error) - }, "application/json",aqEnnable); + error(xhr, status, error) + }, "application/json",aqEnnable); } //GPS安装检测 @@ -581,7 +583,8 @@ function GPSInstallationApi(){ "roleCode": roleCode, "orgId": orgId, "userId": userId, - "bidCode": bidCode + "bidCode": bidCode, + "deviceType":"1910" } let encryptStr = encryptCBC(JSON.stringify(params)); ajaxRequest(url, "POST", encryptStr, true, function () { @@ -595,11 +598,12 @@ function GPSInstallationApi(){ loginout(1) } }, function (xhr, status, error) { - error(xhr, status, error) - }, "application/json",aqEnnable); + error(xhr, status, error) + }, "application/json",aqEnnable); } -function GPSInstallation(environmentData) { +function +GPSInstallation(environmentData) { console.log(environmentData); if(environmentData && environmentData.length>0){ GPSInstallationEnvironmentApi(environmentData[0].deviceId); @@ -674,7 +678,7 @@ function GPSInstallationEnvironmentApi(deviceId){ loginout(1) } }, function (xhr, status, error) { - error(xhr, status, error) - }, "application/json",aqEnnable); + error(xhr, status, error) + }, "application/json",aqEnnable); } diff --git a/js/pages/accessMge/accessMge.js b/js/pages/accessMge/accessMge.js index 4129f70..a682301 100644 --- a/js/pages/accessMge/accessMge.js +++ b/js/pages/accessMge/accessMge.js @@ -204,9 +204,9 @@ function getVehicleStatisticsList(bidCode) { }, cols: [[ { type: 'numbers', title: '序号' }, // 添加序号列 - { field: 'proName', title: '工程名称', align: 'center', width: '10%' }, - { field: 'carNum', title: '车牌号', align: 'center', width: '15%' }, - { field: 'userName', title: '司机', align: 'center', width: '15%' }, + { field: 'proName', title: '工程名称', align: 'center', width: '20%' }, + { field: 'carNum', title: '车牌号', align: 'center', width: '10%' }, + { field: 'userName', title: '司机', align: 'center', width: '10%' }, { field: 'phone', title: '司机电话', align: 'center', width: '20%' }, { field: 'accessType', title: '状态', align: 'center', width: '10%' }, { field: 'accesssTime', title: '时间', align: 'center', width: '30%' } diff --git a/js/pages/home/navigation.js b/js/pages/home/navigation.js index 513fa97..a83486e 100644 --- a/js/pages/home/navigation.js +++ b/js/pages/home/navigation.js @@ -143,7 +143,7 @@ let loading; // 当语音识别服务错误时触发 recognition.onerror = function(error) { layer.close(loading); - // console.error('语音识别服务错误:', error); + console.error('语音识别服务错误:', error); layer.msg('浏览器不支持语音识别服务', { icon: 6, time: 1000 diff --git a/pages/video/video.html b/pages/video/video.html index 1af4b8e..068a530 100644 --- a/pages/video/video.html +++ b/pages/video/video.html @@ -25,7 +25,7 @@
-
+