guonan
2025-04-17 e15245c624a20a3b46e428d646f5f2dd863cd1bc
src/views/Screen.vue
@@ -18,7 +18,10 @@
            <div class="screen-widget-text">
               {{ weather.now.text }} {{ weather.now.temperature + "℃" }}
            </div>
            <div class="screen-widget-time screen-widget-text" style="margin-left: 20px">
        <div
          class="screen-widget-time screen-widget-text"
          style="margin-left: 20px"
        >
               {{ $dayjs().format("YYYY/MM/DD HH:mm") }}
            </div>
         </div>
@@ -35,18 +38,18 @@
</template>
<script setup>
   import { ref, onMounted, computed, defineEmits } from "vue"
   import { useRouter } from "vue-router"
   const router = useRouter()
   const bgVisible = ref(true)
   const defaultCity = ref(cityData.name)
   const emits = defineEmits("showWeatherDetail")
import { ref, onMounted, computed, defineEmits } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const bgVisible = ref(true);
const defaultCity = ref(cityData.name);
const emits = defineEmits("showWeatherDetail");
   function init(visible) {
      bgVisible.value = visible
  bgVisible.value = visible;
   }
   const weatherIcon = computed(() => {
      return `https://cdn.sencdn.com/widget2/assets/img/chameleon/weather/${weather.value.now.code}.svg `
   })
  return `https://cdn.sencdn.com/widget2/assets/img/chameleon/weather/${weather.value.now.code}.svg `;
});
   const weather = ref({
      location: {
         id: "WKNM0GVFCUJJ",
@@ -72,12 +75,12 @@
         dew_point: "",
      },
      last_update: "2023-04-21T11:02:40+08:00",
   })
});
   const air = ref({
      city: {
         quality: "优",
      },
   })
});
   const getWeatherData = () => {
      fetch(
         "https://api.seniverse.com/v3/weather/now.json?key=Sn4df5dIxeplgBv3X&location=beijing&language=zh-Hans&unit=c",
@@ -90,14 +93,14 @@
            },
         }
      )
         .then(response => response.json())
         .then(data => {
            weather.value = data.results[0]
    .then((response) => response.json())
    .then((data) => {
      weather.value = data.results[0];
            // console.log(weather.value)
         })
   }
    });
};
   function initScene() {
      flyToHomeView()
  flyToHomeView();
      let desc = {
         func_name: "FlyTo",
         vectorType: "WGS84",
@@ -109,15 +112,22 @@
         distance: "4918164.228809",
         PlayRate: "5",
         Name: "甘肃顶视图",
      }
      ps.emitMessage(desc)
  };
  ps.emitMessage(desc);
   }
   function openWeather() {
      emits("showWeatherDetail")
  emits("showWeatherDetail");
   }
import { useSimStore } from "@/store/simulation";
import { storeToRefs } from "pinia";
const simStore = useSimStore();
const { showDangerAssess, rightRiverShow } = storeToRefs(simStore);
   function flyToHomeView() {
      router.push("/")
  rightRiverShow.value = false;
  showDangerAssess.value = false;
  router.push("/");
      const view = {
         destination: {
            x: -2355432.569004413,
@@ -129,12 +139,12 @@
            roll: 0.00031421159527500464,
            heading: 6.140424766644804,
         },
      }
      viewer.scene.camera.flyTo(view)
  };
  viewer.scene.camera.flyTo(view);
   }
   onMounted(() => {
      // getWeatherData()
   })
});
</script>
<style lang="less" scoped>
   @import url("../assets/css/screen.css");