diff --git a/src/views/sponeScreen/HaiMianScreen/index.vue b/src/views/sponeScreen/HaiMianScreen/index.vue index da88007..d365911 100644 --- a/src/views/sponeScreen/HaiMianScreen/index.vue +++ b/src/views/sponeScreen/HaiMianScreen/index.vue @@ -27,6 +27,14 @@ {{ item.name }}

+ +
+ + + +

{{ weatherInfo.text }} {{ weatherInfo.temp }}℃

+

{{ dateNow }}

+
@@ -52,8 +60,14 @@ import EvaluationKH from '@/views/sponeScreen/evaluationKH/index.vue'; //考核评估 import WaterFlood from '@/views/sponeScreen/waterFlood/index.vue'; //排水防涝 import LongYW from '@/views/sponeScreen/longYW/index.vue'; //长效运维 +import axios from 'axios'; +const { proxy } = getCurrentInstance(); const router = useRouter(); +const weatherInfo = ref({}); +const stationList = ref([]); +const stationCode = ref(''); +const dateNow = ref(proxy.moment(new Date()).format('YYYY-MM-DD')); const menuList = ref([ { name: '城市概况', id: 1 }, { name: '项目建设', id: 2 }, @@ -61,7 +75,7 @@ { name: '排水防涝', id: 4 }, { name: '长效运维', id: 5 }, ]); -const menuIndex = ref(4); +const menuIndex = ref(1); const showPanel = ref(false); const showLegend = ref(false); @@ -82,7 +96,19 @@ showPanel.value = !showPanel.value; } -onMounted(() => {}); +// 获取天气信息 +const getWeather = () => { + axios + .get(`https://gfapi.mlogcn.com/weather/v001/now?key=F2hH0eoTQS99jaKr3v4AIWFQkJwRjMAU&areacode=101180801`) + .then(res => { + weatherInfo.value = res.data.result.realtime; + }) + .catch(error => {}); +}; + +onMounted(() => { + getWeather(); +});