提交 89b9206d 作者: “kai”

refactor(controlTop): 移除天气相关代码和功能

清理不再使用的天气显示组件和相关逻辑,简化控制面板顶部区域
上级 43958000
...@@ -4,17 +4,16 @@ ...@@ -4,17 +4,16 @@
<div>{{date}}</div> <div>{{date}}</div>
<div>{{week}} {{time}}</div> <div>{{week}} {{time}}</div>
</div> </div>
<div class="ct-item ct-weather"> <!-- <div class="ct-item ct-weather">
<img class="ctw-icon" :src="weatherIcon" /> <img class="ctw-icon" :src="weatherIcon" />
<div class="ctw-wind"> <div class="ctw-wind">
<div class="ctww-line1"> <div class="ctww-line1">
<!-- <img :src="weatherIcon" /> -->
<div>{{weather.windDirection}}</div> <div>{{weather.windDirection}}</div>
</div> </div>
<div>{{weather.windSpeed}}m/s</div> <div>{{weather.windSpeed}}m/s</div>
</div> </div>
</div> </div> -->
<div class="ct-item ct-take-off">{{weather.flyStatus ? $t('controlMenu.适宜起飞') : $t('controlMenu.不宜起飞')}}</div> <!-- <div class="ct-item ct-take-off">{{weather.flyStatus ? $t('controlMenu.适宜起飞') : $t('controlMenu.不宜起飞')}}</div> -->
<div class="ct-item ct-info"> <div class="ct-item ct-info">
<!-- 避障雷达 --> <!-- 避障雷达 -->
<el-tooltip <el-tooltip
...@@ -134,18 +133,18 @@ export default { ...@@ -134,18 +133,18 @@ export default {
timeHandler: null, timeHandler: null,
showTakeOverRecords: false, // 显示接管记录 showTakeOverRecords: false, // 显示接管记录
timeWeather: null, // timeWeather: null,
weather: { // weather: {
windSpeed: 0, // windSpeed: 0,
minTemp: 0, // minTemp: 0,
maxTemp: 0, // maxTemp: 0,
windDirection: this.$t('controlMenu.未知'), // windDirection: this.$t('controlMenu.未知'),
humidity: 0, // humidity: 0,
temp: 0, // temp: 0,
windLevel: 0, // windLevel: 0,
conditionDay: this.$t('controlMenu.未知'), // conditionDay: this.$t('controlMenu.未知'),
}, // },
weatherIcon: require(`./assets/images/weather/icon/iconfont/W0.png`) // weatherIcon: require(`./assets/images/weather/icon/iconfont/W0.png`)
}; };
}, },
computed: { computed: {
...@@ -337,12 +336,12 @@ export default { ...@@ -337,12 +336,12 @@ export default {
created() { created() {
this.updateTime(); this.updateTime();
this.timeHandler = setInterval(this.updateTime, 1000); this.timeHandler = setInterval(this.updateTime, 1000);
this.getWeather(); // this.getWeather();
this.timeWeather = setInterval(this.getWeather, 60000); // this.timeWeather = setInterval(this.getWeather, 60000);
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timeHandler); clearInterval(this.timeHandler);
clearInterval(this.timeWeather); // clearInterval(this.timeWeather);
}, },
methods: { methods: {
...mapActions("MMCFlightControlCenter/hangar", ["isTakeOver"]), ...mapActions("MMCFlightControlCenter/hangar", ["isTakeOver"]),
...@@ -435,32 +434,32 @@ export default { ...@@ -435,32 +434,32 @@ export default {
/** /**
* 获取天气数据 * 获取天气数据
*/ */
async getWeather() { // async getWeather() {
let lat; // let lat;
let lon; // let lon;
if (this.isHangar) { // if (this.isHangar) {
lat = this.hangar.latitude; // lat = this.hangar.latitude;
lon = this.hangar.longitude; // lon = this.hangar.longitude;
} else { // } else {
// 无人机需要通过实时数据获取经纬度 // // 无人机需要通过实时数据获取经纬度
if (this.uavRealTimeData?.locationCoordinate3D?.latitude) { // if (this.uavRealTimeData?.locationCoordinate3D?.latitude) {
lat = this.uavRealTimeData.locationCoordinate3D.latitude; // lat = this.uavRealTimeData.locationCoordinate3D.latitude;
lon = this.uavRealTimeData.locationCoordinate3D.longitude; // lon = this.uavRealTimeData.locationCoordinate3D.longitude;
} // }
} // }
if (lat) { // if (lat) {
let res = await System.getCoordinatesWeather({ // let res = await System.getCoordinatesWeather({
lat, // lat,
lon, // lon,
}); // });
this.weather = res.data[0]; // this.weather = res.data[0];
const date = new Date(); // const date = new Date();
let time = date.getHours(); // let time = date.getHours();
this.weatherIcon = require(`./assets/images/weather/icon/iconfont/W${ // this.weatherIcon = require(`./assets/images/weather/icon/iconfont/W${
time >= 18 ? this.weather.nightIcon : this.weather.dayIcon // time >= 18 ? this.weather.nightIcon : this.weather.dayIcon
}.png`); // }.png`);
} // }
}, // },
}, },
}; };
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论