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