| | |
| | | <template> |
| | | <Header></Header> |
| | | <div class="warp"> |
| | | <HomeLeft></HomeLeft> |
| | | <!-- <div>中间搜索</div> --> |
| | | <HomeRight></HomeRight> |
| | | </div> |
| | | <div :key="selectedAreaCode"> |
| | | <!-- 单个机巢页面--> |
| | | <SignMachineNest v-if="singleUavHome?.device_sn" :key="singleUavHome?.device_sn"/> |
| | | <!-- 事件概述详细信息页面--> |
| | | <EventOverviewDetail v-else-if="isEventOverviewDetail" /> |
| | | |
| | | <!-- 智引即飞 --> |
| | | <AINowFly v-else-if="isAINowFly" /> |
| | | <!-- 首页默认的页面--> |
| | | <template v-else> |
| | | <HomeLeft /> |
| | | <HomeRight /> |
| | | </template> |
| | | </div> |
| | | |
| | | |
| | | <SearchBox /> |
| | | <RSide /> |
| | | <Footer /> |
| | | </template> |
| | | |
| | | <script> |
| | | import index from '@/mixins'; |
| | | import { mapGetters } from 'vuex'; |
| | | import Header from '../Home/components/Header.vue'; |
| | | import HomeLeft from '../Home/components/HomeLeft/Index.vue' |
| | | import HomeRight from '../Home/components/HomeRight/Index.vue' |
| | | <script setup> |
| | | import HomeRight from '@/views/Home/HomeRight/HomeRight.vue' |
| | | import HomeLeft from '@/views/Home/HomeLeft/HomeLeft.vue' |
| | | import SearchBox from '@/views/Home/SearchBox.vue' |
| | | import SignMachineNest from '@/views/SignMachineNest/SignMachineNest.vue' |
| | | import { useStore } from 'vuex' |
| | | import Footer from '@/views/Home/Footer.vue' |
| | | import RSide from '@/views/Home/RSide.vue' |
| | | import { onMounted } from 'vue' |
| | | import cesiumOperation from '@/utils/cesium-tsa' |
| | | import EventOverviewDetail from '@/views/Home/EventOverviewDetail/EventOverviewDetail.vue' |
| | | import AINowFly from '@/views/Home/AINowFly.vue' |
| | | import { getMapCenterPoint } from '@/utils/cesium/mapUtil' |
| | | import { getAreaCodeApi } from '@/api/home' |
| | | import { getDroneSuggest } from '@/api/home/common' |
| | | import { MAP_LEVEL } from '@/const/drc' |
| | | import _ from 'lodash' |
| | | |
| | | export default { |
| | | mixins: [index], |
| | | components: { |
| | | Header, |
| | | HomeLeft, |
| | | HomeRight, |
| | | }, |
| | | name: 'index', |
| | | provide() { |
| | | return { |
| | | index: this, |
| | | }; |
| | | }, |
| | | computed: {}, |
| | | props: [], |
| | | methods: { |
| | | const store = useStore() |
| | | const { _init, viewerDestory } = cesiumOperation() |
| | | |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .page-home { |
| | | height: 100vh; |
| | | width: 100%; |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | font-family: YouSheBiaoTiHei, YouSheBiaoTiHei; |
| | | .warp { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | const singleUavHome = computed(() => store.state.home.singleUavHome) |
| | | const isEventOverviewDetail = computed(() => store.state.home.isEventOverviewDetail) |
| | | const isAINowFly = computed(() => store.state.home.footActiveIndex === 5) |
| | | const userAreaCode = computed(() => store.state.user.userInfo.detail.areaCode) |
| | | const selectedAreaCode = computed(() => store.state.user.selectedAreaCode) |
| | | |
| | | |
| | | |
| | | onUnmounted(() => { |
| | | store.commit('setSingleUavHome', null) |
| | | store.commit('setIsEventOverviewDetail', false) |
| | | store.commit('setFootActiveIndex', 0) |
| | | store.commit('setSelectedAreaCode', null) |
| | | viewerDestory() |
| | | }) |
| | | |
| | | // 获取飞行建议 |
| | | function getFlySuggestion(){ |
| | | const viewer = window.$viewer |
| | | const {longitude,latitude} = getMapCenterPoint(viewer) |
| | | let height = viewer.camera.positionCartographic.height; |
| | | if (height > MAP_LEVEL[0].heightRange[1]) { |
| | | store.commit('setFlySuggest', {}) |
| | | return |
| | | } |
| | | const params = { location: longitude + ',' + latitude} |
| | | getAreaCodeApi(params).then(res => { |
| | | const { adcode:areaCode } = res.data.data.regeocode.addressComponent |
| | | if (!areaCode) return |
| | | return getDroneSuggest({areaCode}) |
| | | }).then(res => { |
| | | const setFlySuggest = _.pick(res.data.data,['windPower','flightAdvice']) || {} |
| | | store.commit('setFlySuggest', setFlySuggest) |
| | | }) |
| | | } |
| | | </style> |
| | | |
| | | onBeforeUnmount(() =>{ |
| | | window.$viewer.camera.moveEnd.removeEventListener(getFlySuggestion); |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | _init('cesium') |
| | | nextTick(() => { |
| | | getFlySuggestion() |
| | | window.$viewer.camera.moveEnd.addEventListener(getFlySuggestion); |
| | | }) |
| | | }) |
| | | </script> |