diff --git a/src/api/modules/agjtLiveApi.ts b/src/api/modules/agjtLiveApi.ts index 8d6345f..a8b4efd 100644 --- a/src/api/modules/agjtLiveApi.ts +++ b/src/api/modules/agjtLiveApi.ts @@ -109,3 +109,11 @@ export const getcountDangerEngineerApi = (params: {}, noLoading: boolean) => { headers: { noLoading: noLoading } }); }; + +// 查询天气实况 +export const getWeatherLiveData = (params: {}, noLoading: boolean) => { + // return http.get(BASEURL + `/xmgl/xzFlow/getStatBySpecial`, params, { headers: { noLoading: noLoading } }); + return http.post(BASEURL + `/xmgl/airQualityAnalysis/getWeatherLiveData`, params, { + headers: { noLoading: noLoading } + }); +}; diff --git a/src/views/agjtLiveScreen/indexLive.vue b/src/views/agjtLiveScreen/indexLive.vue index fec91c8..ab565e7 100644 --- a/src/views/agjtLiveScreen/indexLive.vue +++ b/src/views/agjtLiveScreen/indexLive.vue @@ -184,7 +184,8 @@ function loginOut() { height: 100%; background: url("@/assets/images/bigImg.gif") no-repeat; background-size: 100% 100%; - + position: relative; + overflow: hidden; .header { width: 100%; height: 10%; diff --git a/src/views/agjtLiveScreen/liveScreen/centerTop.vue b/src/views/agjtLiveScreen/liveScreen/centerTop.vue index a81d55d..57c206c 100644 --- a/src/views/agjtLiveScreen/liveScreen/centerTop.vue +++ b/src/views/agjtLiveScreen/liveScreen/centerTop.vue @@ -140,7 +140,7 @@ const onChange = (newIndex: number, oldIndex?: number) => { if (videoInfo.videoList[newIndex].fileType == 1) { const resIndex = videoInfo.videoList.filter((item: any) => item.fileType == 1); console.log(videoInfo.newVideoIndex, resIndex.length - 1); - + if (videoInfo.newVideoIndex == resIndex.length - 1) { videoInfo.newVideoIndex = videoInfo.isPlus > 0 ? -1 : resIndex.length; } @@ -210,7 +210,7 @@ const getLiveScreenDanmuList = async () => { // console.log("我是弹幕", res.result.records); videoInfo.barrageString = res.result.records[0].content; const htmlText = videoInfo.barrageString.replace(/<[^>]*>/g, ""); - videoInfo.secondTime = Math.ceil(htmlText.length / 2); + videoInfo.secondTime = Math.ceil(htmlText.length / 1.2); // console.log(videoInfo.secondTime); // videoInfo.videoList = res.result.records; } @@ -326,9 +326,9 @@ onMounted(() => { .barrageText { font-size: 36px; color: #fff; - position: relative; + // position: relative; height: 10%; - overflow: hidden; + // overflow: hidden; div { // width: 100vw; diff --git a/src/views/agjtLiveScreen/liveScreen/index.vue b/src/views/agjtLiveScreen/liveScreen/index.vue index 39cafdb..fc988ef 100644 --- a/src/views/agjtLiveScreen/liveScreen/index.vue +++ b/src/views/agjtLiveScreen/liveScreen/index.vue @@ -24,6 +24,40 @@ +
+
+
+ + +
+
+ {{ userInfo.weatherInfo.tem }} + ℃ +
+
+
+
+ {{ userInfo.weatherInfo.wea }} + {{ userInfo.weatherInfo.win }}{{ userInfo.weatherInfo.win_speed }} +
+
+
+ {{ userInfo.weatherInfo.tem_night }} ~ {{ userInfo.weatherInfo.tem_day }} + ℃ +
+
+ {{ userInfo.weatherInfo.air == 0 ? "" : userInfo.weatherInfo.air + }}{{ userInfo.pollutionDegree != -1 ? userInfo.pollutionDegreeList[userInfo.pollutionDegree] : "" }} +
+
+
+
@@ -39,8 +73,10 @@ import rightCenter from "@/views/agjtLiveScreen/liveScreen/rightCenter.vue"; import rightBottom from "@/views/agjtLiveScreen/liveScreen/rightBottom.vue"; import { GlobalStore } from "@/stores"; import { getWorkerStatisticsCountApi, getProjectDetail } from "@/api/modules/projectOverview"; -import { ref, onMounted, onBeforeUnmount, nextTick } from "vue"; +import { ref, onMounted, onBeforeUnmount, nextTick, reactive } from "vue"; import { COMPANY } from "@/config/config"; +import { getWeatherLiveData } from "@/api/modules/agjtLiveApi"; +import { getTaskTimeDetail } from "@/api/modules/schedulePlan"; //引入现场大屏API import { getEnterpriseIdApi, countTaskProgressApi } from "@/api/modules/agjtLiveApi"; const store = GlobalStore(); @@ -76,6 +112,102 @@ async function countTaskProgress() { // }); } +//获取项目信息 +const userInfo = reactive({ + projectTimeInfo: {} as any, + weatherInfo: {} as any, + weatherIcon: [ + { + Image: new URL("@/assets/images/dustNoise/bingbao.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/qing.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/shachen.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/weather4.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/weather5.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/wu.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/xue.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/yin.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/yu.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/yu1.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/yun.png", import.meta.url).href + }, + { + Image: new URL("@/assets/images/dustNoise/yun1.png", import.meta.url).href + } + ], + pollutionDegree: -1, + pollutionDegreeList: ["数据错误", "优", "良", "轻度污染", "中度污染", "重度污染", "严重污染"] +}); +const getProjectInfo = async () => { + const res: any = await getTaskTimeDetail({ projectSn: store.sn }); + console.log("获取项目信息", res); + userInfo.projectTimeInfo = res.result; + loadWeather(); + // AMap.plugin("AMap.CitySearch", function () { + // let citySearch = new AMap.CitySearch(); + // citySearch.getLocalCity(function (status, result) { + // if (status === "complete" && result.info === "OK") { + // // 查询成功,result即为当前所在城市信息 + // console.log(status, result); + // } + // }); + // }); +}; +//获取天气 +const loadWeather = async () => { + const res: any = await getWeatherLiveData( + { + cityid: userInfo.projectTimeInfo.cityCode + // areaId: userInfo.projectTimeInfo.areaCode + }, + false + ); + const weatherImg = userInfo.weatherIcon.find((icon: any) => icon.Image.includes(res.result.wea_img)); + if (weatherImg) { + const imageUrl = weatherImg.Image; + // 将拼接好的URL赋值给element.url字段 + res.result.url = imageUrl; + } + userInfo.weatherInfo = res.result; + // let json = JSON.parse(res.result); + // let list = json; + console.log("获取天气", userInfo.weatherInfo); + res.result.air = Number(res.result.air); + if (!(new Number(res.result.air) instanceof Number)) return (userInfo.pollutionDegree = 0); + if (res.result.air <= 50) { + userInfo.pollutionDegree = 1; + } else if (res.result.air > 50 && res.result.air <= 100) { + userInfo.pollutionDegree = 2; + } else if (res.result.air > 100 && res.result.air <= 150) { + userInfo.pollutionDegree = 3; + } else if (res.result.air > 150 && res.result.air <= 200) { + userInfo.pollutionDegree = 4; + } else if (res.result.air > 200 && res.result.air <= 300) { + userInfo.pollutionDegree = 5; + } else if (res.result.air > 300) { + userInfo.pollutionDegree = 6; + } +}; + const leftTopRef = ref(); const leftCenterRef = ref(); const leftBottomRef = ref(); @@ -124,9 +256,81 @@ window.onbeforeunload = e => { onMounted(async () => { startInterval(); countTaskProgress(); + getProjectInfo(); });