fix: BUG修改

This commit is contained in:
kun 2024-03-21 11:33:53 +08:00
parent 5ee673b2fa
commit fd815634a8

View File

@ -21,12 +21,21 @@
<script lang="ts" setup>
import Card from "@/components/card.vue";
import { reactive, onMounted, ref } from "vue";
import { onMounted, ref } from "vue";
import { getWeatherDataApi } from "@/api/modules/headNoise";
import { getProjectDetail } from "@/api/modules/projectOverview";
import { GlobalStore } from "@/stores";
const store = GlobalStore();
const weatherList = ref([]);
const projectData = ref(null as any);
//
const getProjectInfo = async () => {
const res = await getProjectDetail({ projectSn: store.sn });
projectData.value = res.result;
};
//
const loadWeather = async () => {
const res = await getWeatherDataApi({ cityid: "" });
const res = await getWeatherDataApi({ areaId: projectData.value.areaCode || "" });
let json = JSON.parse(res.result);
let list = json;
console.log("获取天气", res.result);
@ -40,8 +49,9 @@ const loadWeather = async () => {
weatherList.value.push(element);
});
};
onMounted(() => {
loadWeather();
onMounted(async () => {
await getProjectInfo();
await loadWeather();
});
const weatherIcon = ref([
{