提交 89b9206d 作者: “kai”

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

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