Header.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <div id="header">
  3. <div class="main">
  4. <div class="title">黄浦江数字孪生系统</div>
  5. <div class="content">
  6. <div class="left">
  7. <i class="temperature"></i>
  8. <div class="wsd-title">
  9. <span>温度</span>
  10. <span>temperature</span>
  11. </div>
  12. <span class="wsd-data">{{temperature}}</span>
  13. <span class="wsd-unit">℃</span>
  14. </div>
  15. <div class="right">
  16. <div class="right-btns">
  17. <i class="rb-fulls" @click="ueCallfullExtent"></i>
  18. <i class="rb-search"></i>
  19. </div>
  20. <div class="right-box">
  21. <span class="now-time" @click="ueCallGetNowTime">{{time}}</span>
  22. <div class="date">
  23. <span>{{day}}</span>
  24. <span>{{date}}</span>
  25. </div>
  26. <i class="weather" :class="weather" @click="toggleScene"></i>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="sub">
  32. <ul>
  33. <li v-for="item,index in subList" :class="{'highlight': item.status}">
  34. <span @click="handleToggleLayer(index)">{{ item.name }}</span>
  35. </li>
  36. </ul>
  37. </div>
  38. <MiForChange v-if="miForChangeShow"/>
  39. <water-level v-if="waterDeepShow"/>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. name: 'HomeHeader',
  45. }
  46. </script>
  47. <script setup>
  48. import { onMounted, reactive, ref } from 'vue';
  49. import { useNow, useDateFormat } from '@vueuse/core'
  50. import bus from '@/utils/bus'
  51. import { GetWeather } from '@/apis/other'
  52. import {
  53. ueCallBoatRealtime, ueCallClearBoatTime, ueCallfullExtent,ueCallCloseMi,
  54. ueCallOpenVideoFusion, ueCallCloseVideoFusion, ueCallShowHangdaoLine, ueCallCloseHangdaoLine,
  55. ueCallOpenRlt, ueCallCloseRlt, ueCallFlyToHD, ueCallFlyToSP, ueCallFlyToZrcb, ueCallGetNowTime
  56. } from '@/utils/UIInteractions'
  57. import WaterLevel from './cpns/WaterLevel.vue'
  58. import MiForChange from './cpns/MiForChange.vue'
  59. onMounted(() => [
  60. getWeather()
  61. ])
  62. const weather = ref('qing')
  63. function getWeather() {
  64. GetWeather().then(res => {
  65. switch(res.data.weather) {
  66. case '晴': weather.value = 'qing'; break
  67. case '多云':weather.value = 'duoyun'; break
  68. case '小雨':weather.value = 'xiaoyu'; break
  69. case '中雨':weather.value = 'zhongyu'; break
  70. case '大雨':weather.value = 'dayu'; break
  71. case '雾':weather.value = 'wu'; break
  72. case '小雪':weather.value = 'xiaoxue'; break
  73. }
  74. })
  75. }
  76. const subList = reactive([
  77. { name: '航道', status: false },
  78. { name: '潮高', status: false },
  79. { name: '船舶', status: true },
  80. { name: '视频', status: false },
  81. { name: '水下地形', status: false },
  82. { name: '断面', status: false },
  83. { name: '中燃船舶', status: false },
  84. ])
  85. function handleToggleLayer(index) {
  86. subList[index].status = !subList[index].status
  87. if(subList[index].status===true) {
  88. switch(index) {
  89. case 0:
  90. ueCallFlyToHD()
  91. setTimeout(() => {
  92. ueCallShowHangdaoLine()
  93. }, 1000);
  94. break
  95. case 1:
  96. waterDeepShow.value = true
  97. break
  98. case 2:
  99. ueCallfullExtent()
  100. setTimeout(() => {
  101. ueCallBoatRealtime()
  102. }, 1000);
  103. break
  104. case 3:
  105. ueCallFlyToSP()
  106. setTimeout(() => {
  107. ueCallOpenVideoFusion()
  108. }, 1000);
  109. break
  110. case 4:
  111. bus.emit('toggle_sxdx', true)
  112. clickWeeather.value=true
  113. break
  114. case 5:
  115. if (clickWeeather.value) {
  116. miForChangeShow.value = true
  117. subList[index].status = true
  118. }else {
  119. subList[index].status = false
  120. }
  121. break
  122. case 6:
  123. ueCallFlyToZrcb()
  124. break
  125. }
  126. } else {
  127. switch(index) {
  128. case 0:
  129. ueCallCloseHangdaoLine()
  130. break
  131. case 1:
  132. waterDeepShow.value = false
  133. break
  134. case 2:
  135. ueCallClearBoatTime()
  136. break
  137. case 3:
  138. ueCallCloseVideoFusion()
  139. break
  140. case 4:
  141. clickWeeather.value=false
  142. miForChangeShow.value = false
  143. subList[index+1].status = false
  144. ueCallCloseMi()
  145. bus.emit('toggle_sxdx', false)
  146. break
  147. case 5:
  148. miForChangeShow.value = false
  149. ueCallCloseMi()
  150. break
  151. case 6:
  152. ueCallfullExtent()
  153. break
  154. }
  155. }
  156. }
  157. const clickWeeather = ref(false)
  158. const temperature = ref('8')
  159. const time = useDateFormat(useNow(), 'HH:mm')
  160. const date = useDateFormat(useNow(), 'YYYY.MM.DD')
  161. const day = useDateFormat(useNow(), 'ddd', { locales: 'en-US' })
  162. const waterDeepShow = ref(false)
  163. const miForChangeShow = ref(false)
  164. function toggleScene() {
  165. bus.emit('toggleSceneBox')
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. #header {
  170. position: absolute;
  171. top: 0;
  172. left: 0;
  173. width: 100%;
  174. height: 160px;
  175. .main {
  176. position: absolute;
  177. top: 0;
  178. left: 0;
  179. width: 100%;
  180. height: 119px;
  181. background: url('@/assets/imgs/header/bg-main.png') no-repeat;
  182. background-size: 100% 100%;
  183. }
  184. .sub {
  185. position: absolute;
  186. top: 50px;
  187. left: 50%;
  188. width: 1114px;
  189. height: 105px;
  190. transform: translateX(-50%);
  191. background: url('@/assets/imgs/header/bg-sub.png') no-repeat;
  192. background-size: 100% 100%;
  193. &>ul {
  194. position: absolute;
  195. bottom: 9px;
  196. left: 0;
  197. width: 100%;
  198. text-align: center;
  199. li {
  200. display: inline-block;
  201. width: 110px;
  202. height: 72px;
  203. margin: 0 5px;
  204. text-align: center;
  205. span {
  206. display: inline-block;
  207. margin-top: 40px;
  208. width: fit-content;
  209. font-size: 20px;
  210. font-family: YSBTH;
  211. font-weight: 400;
  212. color: #CCE6FF;
  213. opacity: 0.65;
  214. cursor: pointer;
  215. &:hover {
  216. transform: scale(1.1);
  217. }
  218. }
  219. }
  220. .highlight {
  221. background: url('@/assets/imgs/header/bg-sub-highl.png') no-repeat;
  222. background-size: 100% 100%;
  223. span {
  224. color: #EDF3FF;
  225. opacity: 1;
  226. }
  227. }
  228. }
  229. }
  230. .title {
  231. position: absolute;
  232. width: fit-content;
  233. top: 20px;
  234. left: 50%;
  235. transform: translateX(-50%);
  236. font-family: YSBTH;
  237. font-size: 42px;
  238. }
  239. .content {
  240. position: absolute;
  241. top: 32px;
  242. display: flex;
  243. justify-content: space-between;
  244. width: 100%;
  245. .left, .right {
  246. display: flex;
  247. align-items: center;
  248. justify-content: flex-start;
  249. }
  250. }
  251. .left {
  252. margin-left: 30px;
  253. .humidity, .temperature {
  254. display: inline-block;
  255. width: 36px;
  256. height: 36px;
  257. margin-right: 6px;
  258. }
  259. .humidity {
  260. background: url('@/assets/imgs/header/humidity.png') no-repeat;
  261. }
  262. .temperature {
  263. background: url('@/assets/imgs/header/temperature.png') no-repeat;
  264. }
  265. .humidity, .temperature {
  266. background-size: contain;
  267. }
  268. .wsd-title {
  269. text-align: left;
  270. margin-right: 9px;
  271. font-family: PFlight;
  272. span {
  273. display: block;
  274. color: #F6F6F6;
  275. }
  276. span:first-child {
  277. font-size: 16px;
  278. line-height: 16px;
  279. margin-bottom: 3px;
  280. }
  281. span:last-child {
  282. font-size: 8px;
  283. line-height: 8px;
  284. }
  285. }
  286. .wsd-data {
  287. font-family: PFlight;
  288. font-size: 26px;
  289. line-height: 26px;
  290. }
  291. .wsd-unit {
  292. font-family: PFlight;
  293. font-size: 14px;
  294. line-height: 14px;
  295. transform: translateY(-5px);
  296. margin: 0 18px 0 3px;
  297. }
  298. }
  299. .right {
  300. .right-btns {
  301. display: flex;
  302. align-items: center;
  303. &>i {
  304. display: inline-block;
  305. width: 32px;
  306. height: 32px;
  307. margin-right: 20px;
  308. cursor: pointer;
  309. }
  310. .rb-search {
  311. background: url('@/assets/imgs/header/search.png') no-repeat;
  312. background-size: contain;
  313. }
  314. .rb-fulls {
  315. width: 40px;
  316. height: 40px;
  317. background: url('@/assets/imgs/header/fulls.png') no-repeat;
  318. background-size: contain;
  319. }
  320. }
  321. .right-box {
  322. display: flex;
  323. justify-content: flex-start;
  324. align-items: center;
  325. // cursor: pointer;
  326. }
  327. .now-time {
  328. font-family: PFlight;
  329. font-size: 30px;
  330. margin-right: 16px;
  331. cursor: pointer;
  332. &:hover {
  333. filter: brightness(1.2);
  334. }
  335. }
  336. .date {
  337. position: relative;
  338. text-align: left;
  339. margin-right: 28px;
  340. span {
  341. color: #ccc;
  342. display: block;
  343. font-size: 12px;
  344. line-height: 14px;
  345. }
  346. &::after {
  347. content: '';
  348. position: absolute;
  349. right: -28px;
  350. top: 7px;
  351. display: inline-block;
  352. width: 1px;
  353. height: 14px;
  354. background-color: #fff;
  355. }
  356. }
  357. .weather {
  358. display: inline-block;
  359. width: 32px;
  360. height: 32px;
  361. background: url('@/assets/imgs/scene/w-qing.png') no-repeat;
  362. background-size: contain;
  363. margin: 0 36px;
  364. cursor: pointer;
  365. &.qing {
  366. background: url('@/assets/imgs/scene/w-qing.png') no-repeat;
  367. background-size: contain;
  368. }
  369. &.duoyun {
  370. background: url('@/assets/imgs/scene/w-duoyun.png') no-repeat;
  371. background-size: contain;
  372. }
  373. &.xiaoyu {
  374. background: url('@/assets/imgs/scene/w-xiaoyu.png') no-repeat;
  375. background-size: contain;
  376. }
  377. &.zhongyu {
  378. background: url('@/assets/imgs/scene/w-zhongyu.png') no-repeat;
  379. background-size: contain;
  380. }
  381. &.dayu {
  382. background: url('@/assets/imgs/scene/w-dayu.png') no-repeat;
  383. background-size: contain;
  384. }
  385. &.wu {
  386. background: url('@/assets/imgs/scene/w-wu.png') no-repeat;
  387. background-size: contain;
  388. }
  389. &.xiaoxue {
  390. background: url('@/assets/imgs/scene/w-xiaoxue.png') no-repeat;
  391. background-size: contain;
  392. }
  393. }
  394. }
  395. }
  396. </style>